Skip to content

Commit 90ecec1

Browse files
committed
wait for active state in subsequent run of rbs module
1 parent 90b64aa commit 90ecec1

File tree

2 files changed

+36
-1
lines changed
  • ansible_collections/serverscom/sc_api

2 files changed

+36
-1
lines changed

ansible_collections/serverscom/sc_api/plugins/module_utils/modules.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2284,7 +2284,8 @@ def update_volume(self):
22842284
result["changed"] = True
22852285
return result
22862286
else:
2287-
result["changed"] = False
2287+
self.wait_for_active()
2288+
result["rbs_volume"]["status"] = "active"
22882289
return result
22892290

22902291
def create_or_update_volume(self):

ansible_collections/serverscom/sc_api/tests/integration/targets/sc_rbs_volume/tasks/main.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,40 @@
157157
- test8 is not changed
158158
- test8.rbs_volume == {}
159159

160+
- name: Create RBS Volume without wait
161+
serverscom.sc_api.sc_rbs_volume:
162+
endpoint: "{{ sc_endpoint }}"
163+
token: "{{ sc_token }}"
164+
state: present
165+
name: "test-rbs-volume-module"
166+
location_id: 45
167+
labels:
168+
environment: staging
169+
size: 50
170+
flavor_id: 17363 # Basic
171+
wait: 0
172+
173+
- name: Wait for RBS Volume to be active
174+
serverscom.sc_api.sc_rbs_volume:
175+
endpoint: "{{ sc_endpoint }}"
176+
token: "{{ sc_token }}"
177+
state: present
178+
name: "test-rbs-volume-module"
179+
location_id: 45
180+
labels:
181+
environment: staging
182+
size: 50
183+
flavor_id: 17363 # Basic
184+
wait: 600
185+
register: test9
186+
187+
- name: Check Test9
188+
assert:
189+
that:
190+
- test9 is not changed
191+
- not test2.failed
192+
- test9.rbs_volume.status == "active"
193+
160194
always:
161195
- name: Remove test volume
162196
serverscom.sc_api.sc_rbs_volume:

0 commit comments

Comments
 (0)