Skip to content

Commit

Permalink
cephadm: podman inspect: image field was called ImageID:
Browse files Browse the repository at this point in the history
See containers/podman#4195

Signed-off-by: Sebastian Wagner <[email protected]>
  • Loading branch information
sebastian-philipp committed Jan 13, 2020
1 parent 24aa280 commit eee2665
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/cephadm/cephadm
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,16 @@ def pathify(p):
return os.path.join(os.getcwd(), p)
return p


def get_podman_version():
# type: () -> List[int]
if 'podman' not in container_path:
raise ValueError('not using podman')
out, _, _ = call_throws([container_path, '--version'])
_, _, version_str = out.strip().split()
return list(map(int, version_str.split('.')))


def get_hostname():
# type: () -> str
return socket.gethostname()
Expand Down Expand Up @@ -2054,10 +2064,16 @@ def list_daemons(detail=True, legacy_dir=None):
image_name = None
image_id = None
version = None

if 'podman' in container_path and get_podman_version() < [1, 6, 2]:
image_field = '.ImageID'
else:
image_field = '.Image'

out, err, code = call(
[
container_path, 'inspect',
'--format', '{{.Id}},{{.Config.Image}},{{.Image}}',
'--format', '{{.Id}},{{.Config.Image}},{{%s}}' % image_field,
'ceph-%s-%s' % (fsid, j)
],
verbose_on_failure=False)
Expand Down

0 comments on commit eee2665

Please sign in to comment.