Skip to content

Commit 7b5990c

Browse files
author
Matthew Fisher
committed
1 parent 68662b0 commit 7b5990c

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

client/deis.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,22 @@ def encode(obj):
296296
return obj
297297

298298

299+
def parse_repository_tag(repo):
300+
"""Parses a given docker image and splits the tag from the repository.
301+
302+
See github.com/docker/docker-py#be73aaf, lines 188-197
303+
"""
304+
column_index = repo.rfind(':')
305+
if column_index < 0:
306+
return repo, None
307+
tag = repo[column_index + 1:]
308+
slash_index = tag.find('/')
309+
if slash_index < 0:
310+
return repo[:column_index], tag
311+
312+
return repo, None
313+
314+
299315
def readable_datetime(datetime_str):
300316
"""
301317
Return a human-readable datetime string from an ECMA-262 (JavaScript)
@@ -968,7 +984,8 @@ def builds_create(self, args):
968984
-p --procfile=<procfile>
969985
A YAML string used to supply a Procfile to the application.
970986
"""
971-
if ':' not in args['<image>']:
987+
_, tag = parse_repository_tag(args['<image>'])
988+
if tag is None:
972989
self._logger.error('<image> must contain a tag')
973990
sys.exit(1)
974991
app = args.get('--app')

0 commit comments

Comments
 (0)