mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-05-08 14:23:03 +00:00
Existing images update name, visibility etc
Dropped default values of min_disk and min_ram parameters because it interferes with the update mechanism and glance uses those values anyway [1], [2]. If the image is already present and visibility param is defined we should check its visibility and correct it if needed. Added tests to verify that both is_public and visibility can change the image. If both name and id are specified for the image, we might want to update the image name. This rely on fact that id pram is checked first. Added rename tests to verify this. For some reason if image object is used for the image update, 409 error produced and exception trown, but the change is in place. So instead of image object, update query rely on the image.id [1]75051dd5a2/glance/db/simple/api.py (L226)[2]75051dd5a2/glance/domain/__init__.py (L125)Change-Id: I9ca6b78bec96b69e6946b65796f12314a1ec6ab4
This commit is contained in:
committed by
Jakob Meng
parent
1e27b6b69c
commit
53da712635
@@ -59,7 +59,6 @@
|
||||
- "image_info_result.images[0].name == image_name"
|
||||
- "image_info_result.images[0].tags | sort == image_tags | sort"
|
||||
|
||||
|
||||
- name: Create raw image again (defaults)
|
||||
openstack.cloud.image:
|
||||
cloud: "{{ cloud }}"
|
||||
@@ -81,7 +80,7 @@
|
||||
- item in returned_image.image
|
||||
loop: "{{ expected_fields }}"
|
||||
|
||||
- name: Update raw image (defaults)
|
||||
- name: Update is_protected on raw image (defaults)
|
||||
openstack.cloud.image:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
@@ -100,6 +99,69 @@
|
||||
that:
|
||||
- returned_image is changed
|
||||
|
||||
- name: Update visibility on raw image (defaults)
|
||||
openstack.cloud.image:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ image_name }}"
|
||||
is_public: false
|
||||
register: returned_image
|
||||
|
||||
- name: Assert changed
|
||||
assert:
|
||||
that:
|
||||
- returned_image.image.visibility == 'private'
|
||||
|
||||
- name: Update again visibility on raw image (defaults)
|
||||
openstack.cloud.image:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ image_name }}"
|
||||
is_public: true
|
||||
register: returned_image
|
||||
|
||||
- name: Assert changed
|
||||
assert:
|
||||
that:
|
||||
- returned_image is changed
|
||||
- returned_image.image.visibility == 'public'
|
||||
|
||||
- name: Define visibility on raw image (defaults)
|
||||
openstack.cloud.image:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ image_name }}"
|
||||
visibility: shared
|
||||
register: returned_image
|
||||
|
||||
- name: Assert changed
|
||||
assert:
|
||||
that:
|
||||
- returned_image is changed
|
||||
- returned_image.image.visibility == 'shared'
|
||||
|
||||
- name: Rename raw image (defaults)
|
||||
openstack.cloud.image:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
id: "{{ returned_image.id }}"
|
||||
name: "{{ image_name }}-changed"
|
||||
register: returned_image
|
||||
|
||||
- name: Assert changed
|
||||
assert:
|
||||
that:
|
||||
- returned_image is changed
|
||||
- returned_image.image.name == "{{ image_name }}-changed"
|
||||
|
||||
- name: Rename back raw image (defaults)
|
||||
openstack.cloud.image:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
id: "{{ returned_image.id }}"
|
||||
name: "{{ image_name }}"
|
||||
register: returned_image
|
||||
|
||||
- name: Delete raw image (defaults)
|
||||
openstack.cloud.image:
|
||||
cloud: "{{ cloud }}"
|
||||
|
||||
Reference in New Issue
Block a user