Renamed image->image_name and flavor->flavor_name to avoid collisions

Change-Id: I09a133b5c4f6c71e10d274be1c70b7edcce1c83c
(cherry picked from commit a8f6dbd904)
This commit is contained in:
Jakob Meng 2022-11-03 14:37:00 +01:00
parent 84160f6f78
commit a11943d9b1
9 changed files with 51 additions and 48 deletions

View File

@ -7,12 +7,12 @@
openstack.cloud.compute_flavor_info:
cloud: "{{ cloud }}"
name: "m1.tiny"
register: flavor_name
register: flavor
- name: Check output of list flavors with filter
assert:
that:
- flavor_name.openstack_flavors | length == 1
- flavor.openstack_flavors | length == 1
- name: Assert fields on SDK 0.*
when: sdk_version is version(1.0, '<')
@ -20,7 +20,7 @@
that:
- '["name", "description", "disk", "is_public", "ram",
"vcpus", "swap", "ephemeral", "is_disabled", "rxtx_factor", "id",
"extra_specs"] | difference(flavor_name.openstack_flavors.0.keys())
"extra_specs"] | difference(flavor.openstack_flavors.0.keys())
| length == 0'
- name: Assert fields on SDK 1.*
@ -29,5 +29,5 @@
that:
- '["name", "original_name", "description", "disk", "is_public", "ram",
"vcpus", "swap", "ephemeral", "is_disabled", "rxtx_factor", "id",
"extra_specs"] | difference(flavor_name.openstack_flavors.0.keys())
"extra_specs"] | difference(flavor.openstack_flavors.0.keys())
| length == 0'

View File

@ -143,7 +143,7 @@
cloud: "{{ cloud }}"
state: present
name: ansible_server1
image: "{{ image }}"
image: "{{ image_name }}"
flavor: m1.tiny
nics:
# one nic only else simple, first floating ip test does not work
@ -173,7 +173,7 @@
cloud: "{{ cloud }}"
state: present
name: ansible_server2
image: "{{ image }}"
image: "{{ image_name }}"
flavor: m1.tiny
nics:
- port-name: ansible_internal_port2

View File

@ -1,4 +0,0 @@
image_name: ansible_image
image_tags:
- test
- ansible

View File

@ -10,35 +10,37 @@
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
name: ansible_image
filename: "{{ tmp_file.stdout }}"
disk_format: raw
tags: "{{ image_tags }}"
tags:
- test
- ansible
register: image
- name: Get details of created image
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: "{{ image_name }}"
image: ansible_image
register: image_info_result
- name: Verify image info
assert:
that:
- "image_info_result.openstack_images[0].name == image_name"
- "image_info_result.openstack_images[0].tags | sort == image_tags | sort"
- image_info_result.openstack_images[0].name == "ansible_image"
- image_info_result.openstack_images[0].tags | sort == ['test', 'ansible'] | sort
- name: Delete raw image (defaults)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
name: ansible_image
- name: Create raw image (complex)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
name: ansible_image
filename: "{{ tmp_file.stdout }}"
disk_format: raw
is_public: True
@ -55,12 +57,12 @@
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
name: ansible_image
- name: Try to get details of deleted image
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: "{{ image_name }}"
image: ansible_image
register: deleted_image_info_result
- name: Verify image is deleted
@ -82,17 +84,19 @@
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
name: ansible_image
filename: "{{ tmp_file.stdout }}"
disk_format: raw
tags: "{{ image_tags }}"
tags:
- test
- ansible
project: image_owner_project
register: image
- name: Get details of created image (owner by project name)
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: "{{ image_name }}"
image: ansible_image
register: image_info_result
- name: Verify image owner (owner by project name)
@ -104,16 +108,18 @@
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
name: ansible_image
- name: Create raw image (owner by project name and domain name)
openstack.cloud.image:
cloud: "{{ cloud }}"
state: present
name: "{{ image_name }}"
name: ansible_image
filename: "{{ tmp_file.stdout }}"
disk_format: raw
tags: "{{ image_tags }}"
tags:
- test
- ansible
project: image_owner_project
project_domain: default
register: image
@ -121,7 +127,7 @@
- name: Get details of created image (owner by project name and domain name)
openstack.cloud.image_info:
cloud: "{{ cloud }}"
image: "{{ image_name }}"
image: ansible_image
register: image_info_result
- name: Verify image owner (owner by project name and domain name)
@ -133,7 +139,7 @@
openstack.cloud.image:
cloud: "{{ cloud }}"
state: absent
name: "{{ image_name }}"
name: ansible_image
- name: Delete owner project
openstack.cloud.project:

View File

@ -11,7 +11,7 @@
assert:
that:
- "'domain' in os_domain"
- os_domain.domain.name == "{{ domain_name }}"
- os_domain.domain.name == domain_name
- >-
('enabled' in os_domain.domain.keys() and os_domain.domain['enabled']|bool) or
('is_enabled' in os_domain.domain and os_domain.domain['is_enabled']|bool)

View File

@ -3,6 +3,6 @@ server_name: ansible_server
server_alt_network: private_alt
server_alt_subnet: subnet_alt
server_alt_name: ansible_server_alt
flavor: m1.tiny
flavor_name: m1.tiny
floating_ip_pool_name: public
boot_volume_size: 5

View File

@ -4,8 +4,8 @@
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_network }}"
auto_floating_ip: false
meta: "key1=value1,key2=value2"
@ -46,8 +46,8 @@
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
auto_floating_ip: false
network: "{{ server_network }}"
meta:
@ -67,7 +67,7 @@
- name: Check info about server name
assert:
that:
info.openstack_servers[0].name == "{{ server_name }}"
info.openstack_servers[0].name == server_name
- name: Delete server with meta as dict
openstack.cloud.server:
@ -81,8 +81,8 @@
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_network }}"
floating_ip_pools:
- "{{ floating_ip_pool_name }}"
@ -101,7 +101,7 @@
- name: Check info about server image name
assert:
that:
info.openstack_servers[0].image.name == "{{ image }}"
info.openstack_servers[0].image.name == image_name
- name: Delete server (FIP from pool/network)
openstack.cloud.server:
@ -115,8 +115,8 @@
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_network }}"
auto_floating_ip: false
boot_from_volume: true
@ -133,13 +133,14 @@
state: absent
name: "{{ server_name }}"
wait: true
- name: Create a minimal server
openstack.cloud.server:
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_network }}"
auto_floating_ip: false
wait: true

View File

@ -3,8 +3,8 @@
cloud: "{{ cloud }}"
state: present
name: "{{ server_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_network }}"
auto_floating_ip: false
wait: true
@ -380,7 +380,7 @@
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
image: "{{ image }}"
image: "{{ image_name }}"
action: rebuild
wait: true
register: server
@ -401,7 +401,7 @@
openstack.cloud.server_action:
cloud: "{{ cloud }}"
server: "{{ server_name }}"
image: "{{ image }}"
image: "{{ image_name }}"
action: rebuild
wait: true
admin_password: random
@ -538,8 +538,8 @@
cloud: "{{ cloud_alt }}"
state: present
name: "{{ server_alt_name }}"
image: "{{ image }}"
flavor: "{{ flavor }}"
image: "{{ image_name }}"
flavor: "{{ flavor_name }}"
network: "{{ server_alt_network }}"
auto_floating_ip: false
wait: true

View File

@ -138,6 +138,6 @@ pushd ci/
set -o pipefail
ANSIBLE_COLLECTIONS_PATHS=$TEST_COLLECTIONS_PATHS ansible-playbook \
-vvv ./run-collection.yml \
-e "sdk_version=${SDK_VER} cloud=${CLOUD} cloud_alt=${CLOUD_ALT} image=${IMAGE} ${ANSIBLE_VARS}" \
-e "sdk_version=${SDK_VER} cloud=${CLOUD} cloud_alt=${CLOUD_ALT} image_name=${IMAGE} ${ANSIBLE_VARS}" \
${tag_opt} 2>&1 | sudo tee /opt/stack/logs/test_output.log
popd