From 9d56ffa4ed6690bd859822a33229439fb0f98943 Mon Sep 17 00:00:00 2001 From: Jeremiah Millay Date: Wed, 22 Nov 2017 10:28:01 -0500 Subject: [PATCH] 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 --- .../modules/network/junos/junos_package.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/junos/junos_package.py b/lib/ansible/modules/network/junos/junos_package.py index 2601e3d1460..8467ad4a5b0 100644 --- a/lib/ansible/modules/network/junos/junos_package.py +++ b/lib/ansible/modules/network/junos/junos_package.py @@ -61,6 +61,16 @@ options: required: false default: 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: description: - The I(force) argument instructs the module to bypass the package @@ -135,12 +145,14 @@ def install_package(module, device): junos = SW(device) package = module.params['src'] no_copy = module.params['no_copy'] + validate = module.params['validate'] def progress_log(dev, report): module.log(report) 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: module.fail_json(msg='Unable to install package on device') @@ -158,6 +170,7 @@ def main(): version=dict(), reboot=dict(type='bool', default=True), no_copy=dict(default=False, type='bool'), + validate=dict(default=True, type='bool'), force=dict(type='bool', default=False), transport=dict(default='netconf', choices=['netconf']) )