From 73c24001d97aefa09d586b7d4a6cffc96782f7ee Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Wed, 3 May 2017 14:28:20 +0530 Subject: [PATCH] Fix netconf port validation and minor doc change (#24210) * Fix netconf port validation and minor doc change Add check to confirm if `validate_*` funcion is callable. Add `config_format` in `junos_facts` documentation * Fix review comments --- lib/ansible/modules/network/junos/junos_facts.py | 9 +++++++++ lib/ansible/modules/network/junos/junos_netconf.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/junos/junos_facts.py b/lib/ansible/modules/network/junos/junos_facts.py index 973e67b8cd1..7f40d866c86 100644 --- a/lib/ansible/modules/network/junos/junos_facts.py +++ b/lib/ansible/modules/network/junos/junos_facts.py @@ -46,6 +46,15 @@ options: required: false default: "!config" version_added: "2.3" + config_format: + description: + - The I(config_format) argument specifies the format of the configuration + when serializing output from the device. This argument is applicable + only when C(config) value is present in I(gather_subset). + required: false + default: text + choices: ['xml', 'set', 'text', 'json'] + version_added: "2.3" """ EXAMPLES = """ diff --git a/lib/ansible/modules/network/junos/junos_netconf.py b/lib/ansible/modules/network/junos/junos_netconf.py index 09474118fe7..90680b3f26e 100644 --- a/lib/ansible/modules/network/junos/junos_netconf.py +++ b/lib/ansible/modules/network/junos/junos_netconf.py @@ -139,7 +139,7 @@ def map_params_to_obj(module): for key, value in iteritems(obj): # validate the param value (if validator func exists) validator = globals().get('validate_%s' % key) - if all((value, validator)): + if callable(validator): validator(value, module) return obj