def get_container_name(self, *args):
"""
Given an incomplete container identifier, construct the name
with the project name included. Args can be a string like 'nginx_1'
or an iterable like ('nginx', 2). If the arg is the container ID
then it will be returned unchanged.
"""
if (len(args) == 1 and all(c in string.hexdigits for c in args[0])):
return args[0]
name = '_'.join([str(a) for a in args])
if (name.startswith(self.project_name)
and name.startswith('{0}_{0}_'.format(self.project_name))):
# some projects have services with the same name
return name
return '{}_{}'.format(self.project_name, name)
评论列表
文章目录