Skip to content

Commit 35f74fe

Browse files
do not set entrypoint when it is None
1 parent 3fca4c5 commit 35f74fe

File tree

7 files changed

+15
-52
lines changed

7 files changed

+15
-52
lines changed

apis/base_app.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
normalize_meta_version,
1212
search_images_from_registry,
1313
get_meta_from_registry,
14-
get_image_config_from_registry,
1514
read_from_etcd,
1615
delete_from_etcd,
1716
set_value_to_etcd,
@@ -175,20 +174,10 @@ def lain_config(self):
175174
def _get_lain_config(self):
176175
if self.meta == '' or self.meta_version == '':
177176
return None
178-
try:
179-
config = LainConf()
180-
image_config = get_image_config_from_registry(
181-
self.appname, self.meta_version)
182-
config.load(self.meta, self.meta_version, self.default_image,
183-
image_config=image_config, registry=PRIVATE_REGISTRY,
184-
domains=get_domains())
185-
return config
186-
except Exception as e:
187-
logger.error('_get_lain_config() failed, error: %s' % e)
188-
config = LainConf()
189-
config.load(self.meta, self.meta_version, self.default_image,
190-
registry=PRIVATE_REGISTRY, domains=get_domains())
191-
return config
177+
config = LainConf()
178+
config.load(self.meta, self.meta_version, self.default_image,
179+
registry=PRIVATE_REGISTRY, domains=get_domains())
180+
return config
192181

193182
@property
194183
def app_spec(self):

apis/specs.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ class ContainerSpec(ImSpec):
112112
Volumes = []
113113
SystemVolumes = []
114114
CloudVolumes = []
115-
Command = []
116-
Entrypoint = []
115+
Command = None
116+
Entrypoint = None
117117
CpuLimit = 0
118118
MemoryLimit = 0
119119
Expose = 0
@@ -471,14 +471,8 @@ def render_container_spec_from_json(app_name, spec_json):
471471
cloud_volumes = []
472472
c.CloudVolumes = [render_cloud_volumes_spec_from_json(
473473
cv) for cv in cloud_volumes]
474-
command = spec_json.get('Command')
475-
if not command:
476-
command = []
477-
c.Command = command
478-
entrypoint = spec_json.get('entrypoint')
479-
if not entrypoint:
480-
entrypoint = []
481-
c.Entrypoint = entrypoint
474+
c.Command = spec_json.get('Command')
475+
c.Entrypoint = spec_json.get('Entrypoint')
482476
c.CpuLimit = spec_json['CpuLimit']
483477
c.MemoryLimit = spec_json['MemoryLimit']
484478
c.Expose = spec_json['Expose'] if spec_json['Expose'] else 0

apis/tests/test_specs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_ContainerSpec_smoke():
4848
assert s.CreateAt is None
4949
assert s.Version == 0
5050
assert s.Image == ""
51-
assert s.Command == []
51+
assert s.Command == None
5252
assert s.LogConfig is None
5353

5454

apis/utils.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -171,31 +171,6 @@ def get_meta_from_registry(app, meta_version, registry=None):
171171
return y
172172

173173

174-
def get_image_config_from_registry(app, meta_version, registry=None):
175-
logger.debug("ready get meta version %s for app %s from registry" %
176-
(meta_version, app))
177-
meta_version = normalize_meta_version(meta_version)
178-
if not registry:
179-
registry = PRIVATE_REGISTRY
180-
181-
headers = _get_registry_access_header(app, registry)
182-
headers['Accept'] = 'application/vnd.docker.distribution.manifest.v2+json'
183-
url = 'http://%s/v2/%s/manifests/release-%s' % (
184-
registry, app, meta_version)
185-
resp = requests.get(url, headers=headers)
186-
if resp.status_code != 200:
187-
raise Exception("requests.get(%s, %s) failed, resp: %s" %
188-
(url, headers, resp))
189-
config_digest = resp.json()['config']['digest']
190-
headers = _get_registry_access_header(app, registry)
191-
url = 'http://%s/v2/%s/blobs/%s' % (registry, app, config_digest)
192-
resp = requests.get(url, headers=headers)
193-
if resp.status_code != 200:
194-
raise Exception("requests.get(%s, %s) failed, resp: %s" %
195-
(url, headers, resp))
196-
return resp.json()['config']
197-
198-
199174
def shell(cmd):
200175
retcode = 0
201176
output = None

lain.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ build:
1717
- touch /sbin/modprobe && chmod +x /sbin/modprobe
1818
- pip install -r pip-req.txt
1919
script:
20+
- mkdir -p /root/.pip
21+
- cp -f pip.conf /root/.pip/pip.conf
2022
- cd $(npm root -g)/npm && npm install fs-extra && sed -i -e s/graceful-fs/fs-extra/ -e s/fs\.rename/fs.move/ ./lib/utils/rename.js # fix npm error
2123
- cd $GOPATH/src/github.com/laincloud/archon && git pull && gobuildweb dist && cp archon-0.1.zip /lain/app/ # note docker may use cache, you should delete the old image
2224
- unzip -o /lain/app/archon-0.1.zip

pip-req.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ pyjwt==1.4.0
2626
netaddr==0.7.18
2727
raven==5.13.0
2828
mysqlclient==1.3.10
29-
lain-sdk==2.3.7
29+
lain-sdk==2.4.0
3030
-e git+https://github.com/projectcalico/[email protected]#egg=pycalico-0.8.0-dev

pip.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[global]
2+
index-url = https://mirrors.ustc.edu.cn/pypi/web/simple
3+
format = columns

0 commit comments

Comments
 (0)