Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To extend the existing wait_for states with timeout parameter #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,16 @@ Module function's example:
machines:
- kvm01
- kvm02
timeout: 1200 # in seconds
{%- if region.timeout is defined and region.timeout.ready is defined %}
timeout: {{ region.timeout.ready }}
{%- endif %}
req_status: "Ready"
- require:
- cmd: maas_login_admin
...

The timeout setting is taken from the reclass pillar data. If the pillar data is not defined, it will use the default value.

If module run w/\o any extra paremeters - `wait_for_machines_ready` will wait for defined in salt machines. In those case, will be usefull to skip some machines:

.. code-block:: bash
Expand All @@ -515,7 +519,9 @@ If module run w/\o any extra paremeters - `wait_for_machines_ready` will wait fo
module.run:
- name: maas.wait_for_machine_status
- kwargs:
timeout: 1200 # in seconds
{%- if region.timeout is defined and region.timeout.deployed is defined %}
timeout: {{ region.timeout.deployed }}
{%- endif %}
req_status: "Deployed"
ignore_machines:
- kvm01 # in case it's broken or whatever
Expand Down
3 changes: 3 additions & 0 deletions maas/machines/wait_for_deployed.sls
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ wait_for_machines_deployed:
- name: maas.wait_for_machine_status
- kwargs:
req_status: "Deployed"
{%- if region.timeout is defined and region.timeout.deployed is defined %}
timeout: {{ region.timeout.deployed }}
{%- endif %}
- require:
- cmd: maas_login_admin
4 changes: 4 additions & 0 deletions maas/machines/wait_for_ready.sls
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ maas_login_admin:
wait_for_machines_ready:
module.run:
- name: maas.wait_for_machine_status
- kwargs:
{%- if region.timeout is defined and region.timeout.ready is defined %}
timeout: {{ region.timeout.ready }}
{%- endif %}
- require:
- cmd: maas_login_admin
3 changes: 3 additions & 0 deletions tests/pillar/maas_region.sls
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ maas:
username: maas
enabled: true
salt_master_ip: 127.0.0.1
timeout:
deployed: 900
ready: 900