mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Add a 'validate' parameter to the juniper_package network module (#33155)
* Add a 'validate' parameter to the juniper_package module to optionally skip checking configuration compatibility against the JUNOS package being installed * Fixing CI failure - E309 version_added for new option (validate) should be 2.5 * Revert previous change and add version_added to 'validate' parameter
This commit is contained in:
parent
c0fced0d89
commit
9d56ffa4ed
1 changed files with 14 additions and 1 deletions
|
@ -61,6 +61,16 @@ options:
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
choices: ['true', 'false']
|
choices: ['true', 'false']
|
||||||
|
validate:
|
||||||
|
description:
|
||||||
|
- The I(validate) argument is responsible for instructing the remote
|
||||||
|
device to skip checking the current device configuration
|
||||||
|
compatibility with the package being installed. When set to false
|
||||||
|
validation is not performed.
|
||||||
|
version_added: 2.5
|
||||||
|
required: false
|
||||||
|
default: true
|
||||||
|
choices: ['true', 'false']
|
||||||
force:
|
force:
|
||||||
description:
|
description:
|
||||||
- The I(force) argument instructs the module to bypass the package
|
- The I(force) argument instructs the module to bypass the package
|
||||||
|
@ -135,12 +145,14 @@ def install_package(module, device):
|
||||||
junos = SW(device)
|
junos = SW(device)
|
||||||
package = module.params['src']
|
package = module.params['src']
|
||||||
no_copy = module.params['no_copy']
|
no_copy = module.params['no_copy']
|
||||||
|
validate = module.params['validate']
|
||||||
|
|
||||||
def progress_log(dev, report):
|
def progress_log(dev, report):
|
||||||
module.log(report)
|
module.log(report)
|
||||||
|
|
||||||
module.log('installing package')
|
module.log('installing package')
|
||||||
result = junos.install(package, progress=progress_log, no_copy=no_copy)
|
result = junos.install(package, progress=progress_log, no_copy=no_copy,
|
||||||
|
validate=validate)
|
||||||
|
|
||||||
if not result:
|
if not result:
|
||||||
module.fail_json(msg='Unable to install package on device')
|
module.fail_json(msg='Unable to install package on device')
|
||||||
|
@ -158,6 +170,7 @@ def main():
|
||||||
version=dict(),
|
version=dict(),
|
||||||
reboot=dict(type='bool', default=True),
|
reboot=dict(type='bool', default=True),
|
||||||
no_copy=dict(default=False, type='bool'),
|
no_copy=dict(default=False, type='bool'),
|
||||||
|
validate=dict(default=True, type='bool'),
|
||||||
force=dict(type='bool', default=False),
|
force=dict(type='bool', default=False),
|
||||||
transport=dict(default='netconf', choices=['netconf'])
|
transport=dict(default='netconf', choices=['netconf'])
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue