Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imgadm docker #51563

Merged
merged 2 commits into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions salt/modules/smartos_imgadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ def _split_docker_uuid(uuid):
if len(uuid) == 2:
tag = uuid[1]
repo = uuid[0]
if len(repo.split('/')) == 2:
return repo, tag
return repo, tag
return None, None


Expand Down
16 changes: 14 additions & 2 deletions salt/states/smartos.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ def _split_docker_uuid(uuid):
if len(uuid) == 2:
tag = uuid[1]
repo = uuid[0]
if len(repo.split('/')) == 2:
return repo, tag
return repo, tag
return None, None


Expand Down Expand Up @@ -810,6 +809,19 @@ def vm_present(name, vmconfig, config=None):
ret['result'] = False
ret['comment'] = 'image {0} not installed'.format(vmconfig['image_uuid'])

# prepare disk.*.image_uuid
for disk in vmconfig['disks'] if 'disks' in vmconfig else []:
if 'image_uuid' in disk and disk['image_uuid'] not in __salt__['imgadm.list']():
if config['auto_import']:
if not __opts__['test']:
res = __salt__['imgadm.import'](disk['image_uuid'])
if disk['image_uuid'] not in res:
ret['result'] = False
ret['comment'] = 'failed to import image {0}'.format(disk['image_uuid'])
else:
ret['result'] = False
ret['comment'] = 'image {0} not installed'.format(disk['image_uuid'])

# docker json-array handling
if 'internal_metadata' in vmconfig:
for var in vmconfig_docker_array:
Expand Down