Skip to content

Commit fd12894

Browse files
committed
fix(scheduler): not all images sent to create_rc will have a dash in them
1 parent b4eee63 commit fd12894

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

rootfs/scheduler/__init__.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ def _scale_rc(self, name, namespace, num):
592592

593593
time.sleep(1)
594594

595-
def _create_rc(self, name, image, command, **kwargs):
595+
def _create_rc(self, name, image, command, **kwargs): # noqa
596596
container_fullname = name
597597
app_name = kwargs.get('aname', {})
598598
app_type = name.split('-')[-1]
@@ -604,13 +604,15 @@ def _create_rc(self, name, image, command, **kwargs):
604604

605605
# Check if it is a slug builder image.
606606
# Example format: golden-earrings:git-5450cbcdaaf9afe6fadd219c94ac9c449bd62413s
607-
vcs, sha = image[image.index(':')+1:].split('-')
608-
if vcs == 'git' and len(sha) in [8, 40] and app_type == 'web':
609-
imgurl = 'http://{}/git/home/{}/push/slug.tgz'.format(
610-
settings.S3EP,
611-
image.replace(':', '-')
612-
)
613-
TEMPLATE = RCB_TEMPLATE
607+
image_name = image[image.index(':')+1:]
608+
if '-' in image_name:
609+
vcs, sha = image_name.split('-')
610+
if vcs == 'git' and len(sha) in [8, 40] and app_type == 'web':
611+
imgurl = 'http://{}/git/home/{}/push/slug.tgz'.format(
612+
settings.S3EP,
613+
image.replace(':', '-')
614+
)
615+
TEMPLATE = RCB_TEMPLATE
614616

615617
l = {
616618
"name": name,

0 commit comments

Comments
 (0)