From f71cea052db61f4947053aca9769b6ce4437d10e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Wed, 23 May 2018 08:53:58 +0200 Subject: [PATCH] cs_vpc: fix state=present to start vpc (#40587) --- lib/ansible/modules/cloud/cloudstack/cs_vpc.py | 11 ++++++----- test/integration/targets/cs_vpc/tasks/main.yml | 6 +++--- test/integration/targets/cs_vpn_connection/aliases | 1 - test/integration/targets/cs_vpn_gateway/aliases | 1 - 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/ansible/modules/cloud/cloudstack/cs_vpc.py b/lib/ansible/modules/cloud/cloudstack/cs_vpc.py index 691c47bbc5..304aa8b307 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_vpc.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_vpc.py @@ -51,12 +51,13 @@ options: state: description: - "State of the VPC." - - "The state C(started) is only considered while creating the VPC, added in version 2.6." + - "The state C(present) creates a started VPC." + - "The state C(stopped) is only considered while creating the VPC, added in version 2.6." default: present choices: - present - absent - - started + - stopped - restarted domain: description: @@ -92,6 +93,7 @@ EXAMPLES = ''' name: my_vpc display_text: My example VPC cidr: 10.10.0.0/16 + state: stopped - name: Ensure a VPC is present and started after creating local_action: @@ -99,7 +101,6 @@ EXAMPLES = ''' name: my_vpc display_text: My example VPC cidr: 10.10.0.0/16 - state: started - name: Ensure a VPC is absent local_action: @@ -289,7 +290,7 @@ class AnsibleCloudStackVpc(AnsibleCloudStack): 'domainid': self.get_domain(key='id'), 'projectid': self.get_project(key='id'), 'zoneid': self.get_zone(key='id'), - 'start': self.module.params.get('state') == 'started' + 'start': self.module.params.get('state') != 'stopped' } self.result['diff']['after'] = args if not self.module.check_mode: @@ -338,7 +339,7 @@ def main(): vpc_offering=dict(), network_domain=dict(), clean_up=dict(type='bool'), - state=dict(choices=['present', 'absent', 'started', 'restarted'], default='present'), + state=dict(choices=['present', 'absent', 'stopped', 'restarted'], default='present'), domain=dict(), account=dict(), project=dict(), diff --git a/test/integration/targets/cs_vpc/tasks/main.yml b/test/integration/targets/cs_vpc/tasks/main.yml index aafc860781..9c87fde464 100644 --- a/test/integration/targets/cs_vpc/tasks/main.yml +++ b/test/integration/targets/cs_vpc/tasks/main.yml @@ -55,7 +55,7 @@ vpc_offering: Redundant VPC offering network_domain: test.example.com zone: "{{ cs_common_zone_adv }}" - state: started + state: stopped register: vpc check_mode: true - name: verify test create vpc with custom offering in check mode @@ -72,7 +72,7 @@ vpc_offering: Redundant VPC offering network_domain: test.example.com zone: "{{ cs_common_zone_adv }}" - state: started + state: stopped register: vpc - name: verify test create vpc with custom offering assert: @@ -92,7 +92,7 @@ vpc_offering: Redundant VPC offering network_domain: test.example.com zone: "{{ cs_common_zone_adv }}" - state: started + state: stopped register: vpc - name: verify test create vpc with custom offering idempotence assert: diff --git a/test/integration/targets/cs_vpn_connection/aliases b/test/integration/targets/cs_vpn_connection/aliases index 5214bd9274..ee8454c6d1 100644 --- a/test/integration/targets/cs_vpn_connection/aliases +++ b/test/integration/targets/cs_vpn_connection/aliases @@ -1,3 +1,2 @@ cloud/cs posix/ci/cloud/group1/cs -disabled diff --git a/test/integration/targets/cs_vpn_gateway/aliases b/test/integration/targets/cs_vpn_gateway/aliases index 5214bd9274..ee8454c6d1 100644 --- a/test/integration/targets/cs_vpn_gateway/aliases +++ b/test/integration/targets/cs_vpn_gateway/aliases @@ -1,3 +1,2 @@ cloud/cs posix/ci/cloud/group1/cs -disabled