Skip to content

Commit

Permalink
Added upgrade_timeout parameter to zhmc_console and zhmc_cpc modules (#…
Browse files Browse the repository at this point in the history
…843)

* Added upgrade_timeout parameter to zhmc_console and zhmc_cpc modules

Signed-off-by: Abhiram Santhosh <[email protected]>

* updated rst files

Signed-off-by: Abhiram Santhosh <[email protected]>

---------

Signed-off-by: Abhiram Santhosh <[email protected]>
  • Loading branch information
abhirams-1 authored and andy-maier committed Dec 20, 2023
1 parent e08381e commit 950a1c1
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
9 changes: 9 additions & 0 deletions docs/source/modules/zhmc_console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ bundle_level
| **type**: str

upgrade_timeout
Timeout in seconds for waiting for completion of upgrade (e.g. 3600)

| **required**: False
| **type**: int
| **default**: 3600

backup_location_type
Type of backup location for the HMC backup that is performed:

Expand Down Expand Up @@ -161,6 +169,7 @@ Examples
hmc_auth: "{{ my_hmc_auth }}"
state: upgrade
bundle_level: "H71"
upgrade_timeout: 3600
register: hmc1


Expand Down
9 changes: 9 additions & 0 deletions docs/source/modules/zhmc_cpc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ bundle_level
| **type**: str

upgrade_timeout
Timeout in seconds for waiting for completion of upgrade (e.g. 10800)

| **required**: False
| **type**: int
| **default**: 10800

accept_firmware
Accept the previous bundle level before installing the new level.

Expand Down Expand Up @@ -213,6 +221,7 @@ Examples
name: "{{ my_cpc_name }}"
state: upgrade
bundle_level: "S71"
upgrade_timeout: 10800
register: cpc1


Expand Down
2 changes: 2 additions & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Availability: `AutomationHub`_, `Galaxy`_, `GitHub`_

**Enhancements:**

* Added upgrade_timeout parameter to zhmc_console and zhmc_cpc modules.

**Cleanup:**

**Known issues:**
Expand Down
11 changes: 10 additions & 1 deletion plugins/modules/zhmc_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@
type: str
required: false
default: null
upgrade_timeout:
description:
- "Timeout in seconds for waiting for completion of upgrade (e.g. 3600)"
type: int
required: false
default: 3600
backup_location_type:
description:
- "Type of backup location for the HMC backup that is performed:"
Expand Down Expand Up @@ -166,6 +172,7 @@
hmc_auth: "{{ my_hmc_auth }}"
state: upgrade
bundle_level: "H71"
upgrade_timeout: 3600
register: hmc1
"""

Expand Down Expand Up @@ -292,6 +299,7 @@ def upgrade(module):

module.fail_on_missing_params(['bundle_level'])
bundle_level = module.params['bundle_level']
upgrade_timeout = module.params['upgrade_timeout']
accept_firmware = module.params['accept_firmware']
backup_location_type = module.params['backup_location_type']

Expand Down Expand Up @@ -320,7 +328,7 @@ def upgrade(module):
accept_firmware=accept_firmware,
backup_location_type=backup_location_type,
wait_for_completion=True,
operation_timeout=None)
operation_timeout=upgrade_timeout)
changed = True
except zhmcclient.HTTPError as exc:
if exc.http_status == 400 and exc.reason == 356:
Expand Down Expand Up @@ -367,6 +375,7 @@ def main():
hmc_auth=hmc_auth_parameter(),
state=dict(required=True, type='str', choices=['facts', 'upgrade']),
bundle_level=dict(required=False, type='str', default=None),
upgrade_timeout=dict(required=False, type='int', default=3600),
backup_location_type=dict(
required=False, type='str', choices=['ftp', 'usb'], default='usb'),
accept_firmware=dict(required=False, type='bool', default=True),
Expand Down
11 changes: 10 additions & 1 deletion plugins/modules/zhmc_cpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@
type: str
required: false
default: null
upgrade_timeout:
description:
- "Timeout in seconds for waiting for completion of upgrade (e.g. 10800)"
type: int
required: false
default: 10800
accept_firmware:
description:
- "Accept the previous bundle level before installing the new level."
Expand Down Expand Up @@ -230,6 +236,7 @@
name: "{{ my_cpc_name }}"
state: upgrade
bundle_level: "S71"
upgrade_timeout: 10800
register: cpc1
"""
Expand Down Expand Up @@ -733,6 +740,7 @@ def upgrade(module):

module.fail_on_missing_params(['bundle_level'])
bundle_level = module.params['bundle_level']
upgrade_timeout = module.params['upgrade_timeout']
accept_firmware = module.params['accept_firmware']
cpc_name = module.params['name']

Expand All @@ -759,7 +767,7 @@ def upgrade(module):
bundle_level=bundle_level,
accept_firmware=accept_firmware,
wait_for_completion=True,
operation_timeout=None)
operation_timeout=upgrade_timeout)
changed = True
except zhmcclient.HTTPError as exc:
if exc.http_status == 400 and exc.reason == 356:
Expand Down Expand Up @@ -813,6 +821,7 @@ def main():
activation_profile_name=dict(required=False, type='str', default=None),
properties=dict(required=False, type='dict', default=None),
bundle_level=dict(required=False, type='str', default=None),
upgrade_timeout=dict(required=False, type='int', default=10800),
accept_firmware=dict(required=False, type='bool', default=True),
log_file=dict(required=False, type='str', default=None),
_faked_session=dict(required=False, type='raw'),
Expand Down

0 comments on commit 950a1c1

Please sign in to comment.