cs_vpc: fix state=present to start vpc (#40587)

This commit is contained in:
René Moser 2018-05-23 08:53:58 +02:00 committed by GitHub
parent 8e38668285
commit f71cea052d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 10 deletions

View file

@ -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(),

View file

@ -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:

View file

@ -1,3 +1,2 @@
cloud/cs
posix/ci/cloud/group1/cs
disabled

View file

@ -1,3 +1,2 @@
cloud/cs
posix/ci/cloud/group1/cs
disabled