cloudstack: fix E326 (#54657)

* cloudstack: remove choice list for hypervisor param

* cloudstack: streamline network_type with returned value by the API

* cloudstack: remove E326

* add changelog fragment
This commit is contained in:
René Moser 2019-03-31 23:36:56 +02:00 committed by GitHub
parent 833512b07c
commit 01f63ee871
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 35 additions and 69 deletions

View file

@ -0,0 +1,4 @@
---
minor_changes:
- cs_zone - The option network_type uses capitalized values for the types e.g. 'Advanced' and 'Basic' to match the return from the API.
- cloudstack - The choice list for the param 'hypervisor' had been removed to allow the API to validate depending on your setup directly.

View file

@ -22,17 +22,6 @@ except ImportError:
CS_IMP_ERR = traceback.format_exc() CS_IMP_ERR = traceback.format_exc()
HAS_LIB_CS = False HAS_LIB_CS = False
CS_HYPERVISORS = [
'KVM', 'kvm',
'VMware', 'vmware',
'BareMetal', 'baremetal',
'XenServer', 'xenserver',
'LXC', 'lxc',
'HyperV', 'hyperv',
'UCS', 'ucs',
'OVM', 'ovm',
'Simulator', 'simulator',
]
if sys.version_info > (3,): if sys.version_info > (3,):
long = int long = int

View file

@ -42,8 +42,8 @@ options:
description: description:
- Name the hypervisor to be used. - Name the hypervisor to be used.
- Required if I(state=present). - Required if I(state=present).
- Possible values are C(KVM), C(VMware), C(BareMetal), C(XenServer), C(LXC), C(HyperV), C(UCS), C(OVM), C(Simulator).
type: str type: str
choices: [ KVM, VMware, BareMetal, XenServer, LXC, HyperV, UCS, OVM ]
url: url:
description: description:
- URL for the cluster - URL for the cluster
@ -206,7 +206,6 @@ from ansible.module_utils.cloudstack import (
AnsibleCloudStack, AnsibleCloudStack,
cs_argument_spec, cs_argument_spec,
cs_required_together, cs_required_together,
CS_HYPERVISORS
) )
@ -350,7 +349,7 @@ def main():
zone=dict(), zone=dict(),
pod=dict(), pod=dict(),
cluster_type=dict(choices=['CloudManaged', 'ExternalManaged']), cluster_type=dict(choices=['CloudManaged', 'ExternalManaged']),
hypervisor=dict(choices=CS_HYPERVISORS), hypervisor=dict(),
state=dict(choices=['present', 'enabled', 'disabled', 'absent'], default='present'), state=dict(choices=['present', 'enabled', 'disabled', 'absent'], default='present'),
url=dict(), url=dict(),
username=dict(), username=dict(),

View file

@ -53,8 +53,8 @@ options:
description: description:
- Name of the cluster. - Name of the cluster.
- Required if I(state=present) and host does not yet exist. - Required if I(state=present) and host does not yet exist.
- Possible values are C(KVM), C(VMware), C(BareMetal), C(XenServer), C(LXC), C(HyperV), C(UCS), C(OVM), C(Simulator).
type: str type: str
choices: [ KVM, VMware, BareMetal, XenServer, LXC, HyperV, UCS, OVM, Simulator ]
allocation_state: allocation_state:
description: description:
- Allocation state of the host. - Allocation state of the host.
@ -330,7 +330,6 @@ from ansible.module_utils.cloudstack import (
AnsibleCloudStack, AnsibleCloudStack,
cs_argument_spec, cs_argument_spec,
cs_required_together, cs_required_together,
CS_HYPERVISORS
) )
import time import time
@ -592,7 +591,7 @@ def main():
url=dict(), url=dict(),
password=dict(no_log=True), password=dict(no_log=True),
username=dict(), username=dict(),
hypervisor=dict(choices=CS_HYPERVISORS), hypervisor=dict(),
allocation_state=dict(choices=['enabled', 'disabled', 'maintenance']), allocation_state=dict(choices=['enabled', 'disabled', 'maintenance']),
pod=dict(), pod=dict(),
cluster=dict(), cluster=dict(),

View file

@ -88,8 +88,8 @@ options:
- Name the hypervisor to be used for creating the new instance. - Name the hypervisor to be used for creating the new instance.
- Relevant when using I(state=present), but only considered if not set on ISO/template. - Relevant when using I(state=present), but only considered if not set on ISO/template.
- If not set or found on ISO/template, first found hypervisor will be used. - If not set or found on ISO/template, first found hypervisor will be used.
- Possible values are C(KVM), C(VMware), C(BareMetal), C(XenServer), C(LXC), C(HyperV), C(UCS), C(OVM), C(Simulator).
type: str type: str
choices: [ KVM, kvm, VMware, vmware, BareMetal, baremetal, XenServer, xenserver, LXC, lxc, HyperV, hyperv, UCS, ucs, OVM, ovm, Simulator, simulator ]
keyboard: keyboard:
description: description:
- Keyboard device type for the instance. - Keyboard device type for the instance.
@ -424,7 +424,6 @@ from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_bytes, to_text from ansible.module_utils._text import to_bytes, to_text
from ansible.module_utils.cloudstack import ( from ansible.module_utils.cloudstack import (
AnsibleCloudStack, AnsibleCloudStack,
CS_HYPERVISORS,
cs_argument_spec, cs_argument_spec,
cs_required_together cs_required_together
) )
@ -1041,7 +1040,7 @@ def main():
disk_size=dict(type='int'), disk_size=dict(type='int'),
root_disk_size=dict(type='int'), root_disk_size=dict(type='int'),
keyboard=dict(type='str', choices=['de', 'de-ch', 'es', 'fi', 'fr', 'fr-be', 'fr-ch', 'is', 'it', 'jp', 'nl-be', 'no', 'pt', 'uk', 'us']), keyboard=dict(type='str', choices=['de', 'de-ch', 'es', 'fi', 'fr', 'fr-be', 'fr-ch', 'is', 'it', 'jp', 'nl-be', 'no', 'pt', 'uk', 'us']),
hypervisor=dict(choices=CS_HYPERVISORS), hypervisor=dict(),
host=dict(), host=dict(),
security_groups=dict(type='list', aliases=['security_group']), security_groups=dict(type='list', aliases=['security_group']),
affinity_groups=dict(type='list', aliases=['affinity_group']), affinity_groups=dict(type='list', aliases=['affinity_group']),

View file

@ -58,8 +58,8 @@ options:
hypervisor: hypervisor:
description: description:
- Required when creating a zone scoped pool. - Required when creating a zone scoped pool.
- Possible values are C(KVM), C(VMware), C(BareMetal), C(XenServer), C(LXC), C(HyperV), C(UCS), C(OVM), C(Simulator).
type: str type: str
choices: [ KVM, VMware, BareMetal, XenServer, LXC, HyperV, UCS, OVM, Simulator ]
storage_tags: storage_tags:
description: description:
- Tags associated with this storage pool. - Tags associated with this storage pool.
@ -234,7 +234,6 @@ from ansible.module_utils.cloudstack import (
AnsibleCloudStack, AnsibleCloudStack,
cs_argument_spec, cs_argument_spec,
cs_required_together, cs_required_together,
CS_HYPERVISORS,
) )
@ -468,7 +467,7 @@ def main():
pod=dict(), pod=dict(),
cluster=dict(), cluster=dict(),
scope=dict(choices=['zone', 'cluster']), scope=dict(choices=['zone', 'cluster']),
hypervisor=dict(choices=CS_HYPERVISORS), hypervisor=dict(),
provider=dict(default='DefaultPrimary'), provider=dict(default='DefaultPrimary'),
capacity_bytes=dict(type='int'), capacity_bytes=dict(type='int'),
capacity_iops=dict(type='int'), capacity_iops=dict(type='int'),

View file

@ -121,26 +121,8 @@ options:
description: description:
- Name the hypervisor to be used for creating the new template. - Name the hypervisor to be used for creating the new template.
- Relevant when using I(state=present). - Relevant when using I(state=present).
- Possible values are C(KVM), C(VMware), C(BareMetal), C(XenServer), C(LXC), C(HyperV), C(UCS), C(OVM), C(Simulator).
type: str type: str
choices:
- KVM
- kvm
- VMware
- vmware
- BareMetal
- baremetal
- XenServer
- xenserver
- LXC
- lxc
- HyperV
- hyperv
- UCS
- ucs
- OVM
- ovm
- Simulator
- simulator
requires_hvm: requires_hvm:
description: description:
- Whether the template requires HVM or not. - Whether the template requires HVM or not.
@ -400,7 +382,6 @@ from ansible.module_utils.cloudstack import (
AnsibleCloudStack, AnsibleCloudStack,
cs_argument_spec, cs_argument_spec,
cs_required_together, cs_required_together,
CS_HYPERVISORS
) )
@ -712,7 +693,7 @@ def main():
checksum=dict(), checksum=dict(),
template_filter=dict(default='self', choices=['all', 'featured', 'self', 'selfexecutable', 'sharedexecutable', 'executable', 'community']), template_filter=dict(default='self', choices=['all', 'featured', 'self', 'selfexecutable', 'sharedexecutable', 'executable', 'community']),
template_find_options=dict(type='list', choices=['display_text', 'checksum', 'cross_zones'], aliases=['template_find_option'], default=[]), template_find_options=dict(type='list', choices=['display_text', 'checksum', 'cross_zones'], aliases=['template_find_option'], default=[]),
hypervisor=dict(choices=CS_HYPERVISORS), hypervisor=dict(),
requires_hvm=dict(type='bool'), requires_hvm=dict(type='bool'),
password_enabled=dict(type='bool'), password_enabled=dict(type='bool'),
template_tag=dict(), template_tag=dict(),

View file

@ -46,8 +46,8 @@ options:
description: description:
- Network type of the zone. - Network type of the zone.
type: str type: str
default: basic default: Basic
choices: [ basic, advanced ] choices: [ Basic, Advanced ]
dns1: dns1:
description: description:
- First DNS for the zone. - First DNS for the zone.
@ -348,7 +348,7 @@ def main():
internal_dns2=dict(), internal_dns2=dict(),
dns1_ipv6=dict(), dns1_ipv6=dict(),
dns2_ipv6=dict(), dns2_ipv6=dict(),
network_type=dict(default='basic', choices=['Basic', 'basic', 'Advanced', 'advanced']), network_type=dict(default='Basic', choices=['Basic', 'Advanced']),
network_domain=dict(), network_domain=dict(),
guest_cidr_address=dict(), guest_cidr_address=dict(),
dhcp_provider=dict(), dhcp_provider=dict(),

View file

@ -14,7 +14,7 @@
name: "{{ cs_resource_prefix }}-zone" name: "{{ cs_resource_prefix }}-zone"
dns1: 8.8.8.8 dns1: 8.8.8.8
dns2: 8.8.4.4 dns2: 8.8.4.4
network_type: basic network_type: Basic
register: zone register: zone
- name: verify setup zone is present - name: verify setup zone is present
assert: assert:
@ -48,7 +48,7 @@
cs_cluster: cs_cluster:
name: "{{ cs_resource_prefix }}-cluster" name: "{{ cs_resource_prefix }}-cluster"
zone: "{{ cs_resource_prefix }}-zone" zone: "{{ cs_resource_prefix }}-zone"
hypervisor: simulator hypervisor: Simulator
cluster_type: CloudManaged cluster_type: CloudManaged
pod: unexistent pod: unexistent
register: cluster register: cluster
@ -63,7 +63,7 @@
cs_cluster: cs_cluster:
name: "{{ cs_resource_prefix }}-cluster" name: "{{ cs_resource_prefix }}-cluster"
zone: "{{ cs_resource_prefix }}-zone" zone: "{{ cs_resource_prefix }}-zone"
hypervisor: simulator hypervisor: Simulator
cluster_type: CloudManaged cluster_type: CloudManaged
register: cluster_origin register: cluster_origin
check_mode: true check_mode: true
@ -77,7 +77,7 @@
cs_cluster: cs_cluster:
name: "{{ cs_resource_prefix }}-cluster" name: "{{ cs_resource_prefix }}-cluster"
zone: "{{ cs_resource_prefix }}-zone" zone: "{{ cs_resource_prefix }}-zone"
hypervisor: simulator hypervisor: Simulator
cluster_type: CloudManaged cluster_type: CloudManaged
register: cluster_origin register: cluster_origin
tags: disable tags: disable
@ -113,7 +113,7 @@
cs_cluster: cs_cluster:
name: "{{ cs_resource_prefix }}-cluster" name: "{{ cs_resource_prefix }}-cluster"
zone: "{{ cs_resource_prefix }}-zone" zone: "{{ cs_resource_prefix }}-zone"
hypervisor: simulator hypervisor: Simulator
cluster_type: ExternalManaged cluster_type: ExternalManaged
register: cluster register: cluster
check_mode: true check_mode: true
@ -132,7 +132,7 @@
cs_cluster: cs_cluster:
name: "{{ cs_resource_prefix }}-cluster" name: "{{ cs_resource_prefix }}-cluster"
zone: "{{ cs_resource_prefix }}-zone" zone: "{{ cs_resource_prefix }}-zone"
hypervisor: simulator hypervisor: Simulator
cluster_type: ExternalManaged cluster_type: ExternalManaged
register: cluster register: cluster
- name: verify test update cluster - name: verify test update cluster
@ -150,7 +150,7 @@
cs_cluster: cs_cluster:
name: "{{ cs_resource_prefix }}-cluster" name: "{{ cs_resource_prefix }}-cluster"
zone: "{{ cs_resource_prefix }}-zone" zone: "{{ cs_resource_prefix }}-zone"
hypervisor: simulator hypervisor: Simulator
cluster_type: ExternalManaged cluster_type: ExternalManaged
register: cluster register: cluster
- name: verify test update cluster idempotence - name: verify test update cluster idempotence

View file

@ -5,7 +5,7 @@
name: cs-test-zone name: cs-test-zone
state: present state: present
dns1: 8.8.8.8 dns1: 8.8.8.8
network_type: advanced network_type: Advanced
register: cszone register: cszone
- name: ensure the zone is disabled - name: ensure the zone is disabled

View file

@ -4,7 +4,7 @@
name: "{{ cs_resource_prefix }}-zone" name: "{{ cs_resource_prefix }}-zone"
dns1: 8.8.8.8 dns1: 8.8.8.8
dns2: 8.8.4.4 dns2: 8.8.4.4
network_type: basic network_type: Basic
register: zone register: zone
- name: verify setup zone is present - name: verify setup zone is present
assert: assert:

View file

@ -5,7 +5,7 @@
name: cs-test-zone name: cs-test-zone
state: present state: present
dns1: 8.8.8.8 dns1: 8.8.8.8
network_type: advanced network_type: Advanced
register: cszone register: cszone
- name: ensure the zone is disabled - name: ensure the zone is disabled

View file

@ -376,7 +376,7 @@
name: cs-test-zone name: cs-test-zone
state: present state: present
dns1: 8.8.8.8 dns1: 8.8.8.8
network_type: advanced network_type: Advanced
register: cszone register: cszone
- name: ensure the zone is disabled - name: ensure the zone is disabled

View file

@ -25,7 +25,7 @@
name: "{{ cs_resource_prefix }}-zone" name: "{{ cs_resource_prefix }}-zone"
dns1: 8.8.8.8 dns1: 8.8.8.8
dns2: 8.8.4.4 dns2: 8.8.4.4
network_type: basic network_type: Basic
register: zone register: zone
check_mode: true check_mode: true
- name: verify test create zone in check mode - name: verify test create zone in check mode
@ -39,7 +39,7 @@
name: "{{ cs_resource_prefix }}-zone" name: "{{ cs_resource_prefix }}-zone"
dns1: 8.8.8.8 dns1: 8.8.8.8
dns2: 8.8.4.4 dns2: 8.8.4.4
network_type: basic network_type: Basic
register: zone register: zone
- name: verify test create zone - name: verify test create zone
assert: assert:
@ -61,7 +61,7 @@
name: "{{ cs_resource_prefix }}-zone" name: "{{ cs_resource_prefix }}-zone"
dns1: 8.8.8.8 dns1: 8.8.8.8
dns2: 8.8.4.4 dns2: 8.8.4.4
network_type: basic network_type: Basic
register: zone register: zone
- name: verify test create zone idempotency - name: verify test create zone idempotency
assert: assert:
@ -86,7 +86,7 @@
internal_dns1: 10.10.1.100 internal_dns1: 10.10.1.100
internal_dns2: 10.10.1.101 internal_dns2: 10.10.1.101
local_storage_enabled: true local_storage_enabled: true
network_type: basic network_type: Basic
register: zone register: zone
check_mode: true check_mode: true
- name: verify test update zone in check mode - name: verify test update zone in check mode
@ -112,7 +112,7 @@
internal_dns1: 10.10.1.100 internal_dns1: 10.10.1.100
internal_dns2: 10.10.1.101 internal_dns2: 10.10.1.101
local_storage_enabled: true local_storage_enabled: true
network_type: basic network_type: Basic
register: zone register: zone
- name: verify test update zone - name: verify test update zone
assert: assert:
@ -137,7 +137,7 @@
internal_dns1: 10.10.1.100 internal_dns1: 10.10.1.100
internal_dns2: 10.10.1.101 internal_dns2: 10.10.1.101
local_storage_enabled: true local_storage_enabled: true
network_type: basic network_type: Basic
register: zone register: zone
- name: verify test update zone idempotency - name: verify test update zone idempotency
assert: assert:

View file

@ -4,7 +4,7 @@
name: "{{ cs_resource_prefix }}-zone" name: "{{ cs_resource_prefix }}-zone"
dns1: 8.8.8.8 dns1: 8.8.8.8
dns2: 8.8.4.4 dns2: 8.8.4.4
network_type: basic network_type: Basic
register: zone register: zone
- name: verify setup zone is present - name: verify setup zone is present
assert: assert:

View file

@ -94,10 +94,6 @@ lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E324
lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E326 lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E326
lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E335 lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E335
lib/ansible/modules/cloud/centurylink/clc_server_snapshot.py E335 lib/ansible/modules/cloud/centurylink/clc_server_snapshot.py E335
lib/ansible/modules/cloud/cloudstack/cs_cluster.py E326
lib/ansible/modules/cloud/cloudstack/cs_host.py E326
lib/ansible/modules/cloud/cloudstack/cs_storage_pool.py E326
lib/ansible/modules/cloud/cloudstack/cs_zone.py E326
lib/ansible/modules/cloud/digital_ocean/_digital_ocean.py E322 lib/ansible/modules/cloud/digital_ocean/_digital_ocean.py E322
lib/ansible/modules/cloud/digital_ocean/digital_ocean_floating_ip.py E322 lib/ansible/modules/cloud/digital_ocean/digital_ocean_floating_ip.py E322
lib/ansible/modules/cloud/digital_ocean/digital_ocean_floating_ip.py E324 lib/ansible/modules/cloud/digital_ocean/digital_ocean_floating_ip.py E324