Update project_info module to new sdk

Make project_info module compatible with the new sdk 1.0.0 and also add
ansible tests for project_info module

Change-Id: I413200cf6a9b8bada7e5d78087246b888d53fac2
This commit is contained in:
Arx Cruz
2022-03-14 16:08:53 +01:00
committed by Jakob Meng
parent 802e46d554
commit bcca2efe1a
4 changed files with 78 additions and 30 deletions

View File

@@ -0,0 +1,46 @@
---
- name: List admin project
openstack.cloud.project_info:
cloud: "{{ cloud }}"
name: 'admin'
register: project_admin
- name: List admin project with filter
openstack.cloud.project_info:
cloud: "{{ cloud }}"
filters:
name: 'admin'
- name: Check output of list admin project
assert:
that:
- project_admin.openstack_projects | length == 1
- name: List all projects
openstack.cloud.project_info:
cloud: "{{ cloud }}"
register: all_projects
- name: Check output of list all projects
assert:
that:
- all_projects.openstack_projects | length > 0
- name: List admin project with domain
openstack.cloud.project_info:
cloud: "{{ cloud }}"
name: 'admin'
domain: 'default'
register: project_domain
- name: Check output of list admin project with admin domain
assert:
that:
- project_domain.openstack_projects | length == 1
- name: Assert fields on SDK 1.*
assert:
that:
- '["description", "domain_id", "is_domain", "is_enabled", "options",
"parent_id", "id", "name", "tags"] |
difference(project_admin.openstack_projects.0.keys()) | length == 0'

View File

@@ -52,6 +52,7 @@
- { role: object, tags: object }
- { role: port, tags: port }
- { role: project, tags: project }
- { role: project_info, tags: project_info }
- { role: recordset, tags: recordset }
- { role: role_assignment, tags: role_assignment }
- { role: router, tags: router }