Handle Swarm-style prefixed names in Service.containers()
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
608f29c7cb
commit
edb6b24b8f
2 changed files with 14 additions and 3 deletions
|
|
@ -545,9 +545,8 @@ def get_container_name(container):
|
|||
if 'Name' in container:
|
||||
return container['Name']
|
||||
# ps
|
||||
for name in container['Names']:
|
||||
if len(name.split('/')) == 2:
|
||||
return name[1:]
|
||||
shortest_name = min(container['Names'], key=lambda n: len(n.split('/')))
|
||||
return shortest_name.split('/')[-1]
|
||||
|
||||
|
||||
def parse_restart_spec(restart_config):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue