* Check for provider values inside check_args of respective network code
* Partial revert of b9ee5aa
The no_log change is okay, but take out the action result munging
This commit is contained in:
parent
6314169afd
commit
86c714548f
20 changed files with 60 additions and 72 deletions
|
@ -31,7 +31,7 @@
|
||||||
#
|
#
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback, return_values
|
||||||
from ansible.module_utils.network_common import to_list, ComplexList
|
from ansible.module_utils.network_common import to_list, ComplexList
|
||||||
from ansible.module_utils.connection import exec_command
|
from ansible.module_utils.connection import exec_command
|
||||||
from ansible.module_utils.netcfg import NetworkConfig,ConfigLine
|
from ansible.module_utils.netcfg import NetworkConfig,ConfigLine
|
||||||
|
@ -63,6 +63,11 @@ def check_args(module, warnings):
|
||||||
warnings.append('argument %s has been deprecated and will be '
|
warnings.append('argument %s has been deprecated and will be '
|
||||||
'removed in a future version' % key)
|
'removed in a future version' % key)
|
||||||
|
|
||||||
|
if provider:
|
||||||
|
for param in ('auth_pass', 'password'):
|
||||||
|
if provider.get(param):
|
||||||
|
module.no_log_values.update(return_values(provider[param]))
|
||||||
|
|
||||||
|
|
||||||
def get_config(module, flags=[]):
|
def get_config(module, flags=[]):
|
||||||
cmd = 'show running-config '
|
cmd = 'show running-config '
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#
|
#
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback, return_values
|
||||||
from ansible.module_utils.network_common import to_list, ComplexList
|
from ansible.module_utils.network_common import to_list, ComplexList
|
||||||
from ansible.module_utils.connection import exec_command
|
from ansible.module_utils.connection import exec_command
|
||||||
from ansible.module_utils.netcfg import NetworkConfig, ConfigLine, ignore_line, DEFAULT_COMMENT_TOKENS
|
from ansible.module_utils.netcfg import NetworkConfig, ConfigLine, ignore_line, DEFAULT_COMMENT_TOKENS
|
||||||
|
@ -63,6 +63,11 @@ def check_args(module, warnings):
|
||||||
warnings.append('argument %s has been deprecated and will be '
|
warnings.append('argument %s has been deprecated and will be '
|
||||||
'removed in a future version' % key)
|
'removed in a future version' % key)
|
||||||
|
|
||||||
|
if provider:
|
||||||
|
for param in ('auth_pass', 'password'):
|
||||||
|
if provider.get(param):
|
||||||
|
module.no_log_values.update(return_values(provider[param]))
|
||||||
|
|
||||||
|
|
||||||
def get_config(module, flags=[]):
|
def get_config(module, flags=[]):
|
||||||
cmd = 'show running-config '
|
cmd = 'show running-config '
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#
|
#
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback, return_values
|
||||||
from ansible.module_utils.network_common import to_list, ComplexList
|
from ansible.module_utils.network_common import to_list, ComplexList
|
||||||
from ansible.module_utils.connection import exec_command
|
from ansible.module_utils.connection import exec_command
|
||||||
from ansible.module_utils.netcfg import NetworkConfig,ConfigLine
|
from ansible.module_utils.netcfg import NetworkConfig,ConfigLine
|
||||||
|
@ -63,6 +63,11 @@ def check_args(module, warnings):
|
||||||
warnings.append('argument %s has been deprecated and will be '
|
warnings.append('argument %s has been deprecated and will be '
|
||||||
'removed in a future version' % key)
|
'removed in a future version' % key)
|
||||||
|
|
||||||
|
if provider:
|
||||||
|
for param in ('auth_pass', 'password'):
|
||||||
|
if provider.get(param):
|
||||||
|
module.no_log_values.update(return_values(provider[param]))
|
||||||
|
|
||||||
|
|
||||||
def get_config(module, flags=[]):
|
def get_config(module, flags=[]):
|
||||||
cmd = 'show running-config '
|
cmd = 'show running-config '
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback, return_values
|
||||||
from ansible.module_utils.connection import exec_command
|
from ansible.module_utils.connection import exec_command
|
||||||
from ansible.module_utils.network_common import to_list, ComplexList
|
from ansible.module_utils.network_common import to_list, ComplexList
|
||||||
from ansible.module_utils.six import iteritems
|
from ansible.module_utils.six import iteritems
|
||||||
|
@ -64,6 +64,11 @@ def check_args(module, warnings):
|
||||||
warnings.append('argument %s has been deprecated and will be '
|
warnings.append('argument %s has been deprecated and will be '
|
||||||
'removed in a future version' % key)
|
'removed in a future version' % key)
|
||||||
|
|
||||||
|
if provider:
|
||||||
|
for param in ('auth_pass', 'password'):
|
||||||
|
if provider.get(param):
|
||||||
|
module.no_log_values.update(return_values(provider[param]))
|
||||||
|
|
||||||
def load_params(module):
|
def load_params(module):
|
||||||
provider = module.params.get('provider') or dict()
|
provider = module.params.get('provider') or dict()
|
||||||
for key, value in iteritems(provider):
|
for key, value in iteritems(provider):
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback, return_values
|
||||||
from ansible.module_utils.network_common import to_list, ComplexList
|
from ansible.module_utils.network_common import to_list, ComplexList
|
||||||
from ansible.module_utils.connection import exec_command
|
from ansible.module_utils.connection import exec_command
|
||||||
|
|
||||||
|
@ -50,6 +50,11 @@ def check_args(module, warnings):
|
||||||
warnings.append('argument %s has been deprecated and will be '
|
warnings.append('argument %s has been deprecated and will be '
|
||||||
'removed in a future version' % key)
|
'removed in a future version' % key)
|
||||||
|
|
||||||
|
if provider:
|
||||||
|
for param in ('auth_pass', 'password'):
|
||||||
|
if provider.get(param):
|
||||||
|
module.no_log_values.update(return_values(provider[param]))
|
||||||
|
|
||||||
def get_defaults_flag(module):
|
def get_defaults_flag(module):
|
||||||
rc, out, err = exec_command(module, 'show running-config ?')
|
rc, out, err = exec_command(module, 'show running-config ?')
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback, return_values
|
||||||
from ansible.module_utils.network_common import to_list, ComplexList
|
from ansible.module_utils.network_common import to_list, ComplexList
|
||||||
from ansible.module_utils.connection import exec_command
|
from ansible.module_utils.connection import exec_command
|
||||||
|
|
||||||
|
@ -49,6 +49,11 @@ def check_args(module, warnings):
|
||||||
warnings.append('argument %s has been deprecated and will be '
|
warnings.append('argument %s has been deprecated and will be '
|
||||||
'removed in a future version' % key)
|
'removed in a future version' % key)
|
||||||
|
|
||||||
|
if provider:
|
||||||
|
for param in ('password',):
|
||||||
|
if provider.get(param):
|
||||||
|
module.no_log_values.update(return_values(provider[param]))
|
||||||
|
|
||||||
def get_config(module, flags=[]):
|
def get_config(module, flags=[]):
|
||||||
cmd = 'show running-config '
|
cmd = 'show running-config '
|
||||||
cmd += ' '.join(flags)
|
cmd += ' '.join(flags)
|
||||||
|
|
|
@ -20,7 +20,7 @@ from contextlib import contextmanager
|
||||||
|
|
||||||
from xml.etree.ElementTree import Element, SubElement
|
from xml.etree.ElementTree import Element, SubElement
|
||||||
|
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback, return_values
|
||||||
from ansible.module_utils.netconf import send_request, children
|
from ansible.module_utils.netconf import send_request, children
|
||||||
from ansible.module_utils.netconf import discard_changes, validate
|
from ansible.module_utils.netconf import discard_changes, validate
|
||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
|
@ -48,6 +48,11 @@ def check_args(module, warnings):
|
||||||
warnings.append('argument %s has been deprecated and will be '
|
warnings.append('argument %s has been deprecated and will be '
|
||||||
'removed in a future version' % key)
|
'removed in a future version' % key)
|
||||||
|
|
||||||
|
if provider:
|
||||||
|
for param in ('password',):
|
||||||
|
if provider.get(param):
|
||||||
|
module.no_log_values.update(return_values(provider[param]))
|
||||||
|
|
||||||
def _validate_rollback_id(module, value):
|
def _validate_rollback_id(module, value):
|
||||||
try:
|
try:
|
||||||
if not 0 <= int(value) <= 49:
|
if not 0 <= int(value) <= 49:
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
import re
|
import re
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback, return_values
|
||||||
from ansible.module_utils.network_common import to_list, ComplexList
|
from ansible.module_utils.network_common import to_list, ComplexList
|
||||||
from ansible.module_utils.connection import exec_command
|
from ansible.module_utils.connection import exec_command
|
||||||
from ansible.module_utils.six import iteritems
|
from ansible.module_utils.six import iteritems
|
||||||
|
@ -61,6 +61,11 @@ def check_args(module, warnings):
|
||||||
warnings.append('argument %s has been deprecated and will be '
|
warnings.append('argument %s has been deprecated and will be '
|
||||||
'removed in a future version' % key)
|
'removed in a future version' % key)
|
||||||
|
|
||||||
|
if provider:
|
||||||
|
for param in ('password',):
|
||||||
|
if provider.get(param):
|
||||||
|
module.no_log_values.update(return_values(provider[param]))
|
||||||
|
|
||||||
def load_params(module):
|
def load_params(module):
|
||||||
provider = module.params.get('provider') or dict()
|
provider = module.params.get('provider') or dict()
|
||||||
for key, value in iteritems(provider):
|
for key, value in iteritems(provider):
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback, return_values
|
||||||
from ansible.module_utils.network_common import to_list, ComplexList
|
from ansible.module_utils.network_common import to_list, ComplexList
|
||||||
from ansible.module_utils.connection import exec_command
|
from ansible.module_utils.connection import exec_command
|
||||||
|
|
||||||
|
@ -51,6 +51,11 @@ def check_args(module, warnings):
|
||||||
warnings.append('argument %s has been deprecated and will be '
|
warnings.append('argument %s has been deprecated and will be '
|
||||||
'removed in a future version' % key)
|
'removed in a future version' % key)
|
||||||
|
|
||||||
|
if provider:
|
||||||
|
for param in ('password',):
|
||||||
|
if provider.get(param):
|
||||||
|
module.no_log_values.update(return_values(provider[param]))
|
||||||
|
|
||||||
def get_config(module, flags=[]):
|
def get_config(module, flags=[]):
|
||||||
cmd = 'admin display-config '
|
cmd = 'admin display-config '
|
||||||
cmd += ' '.join(flags)
|
cmd += ' '.join(flags)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
from ansible.module_utils.basic import env_fallback
|
from ansible.module_utils.basic import env_fallback, return_values
|
||||||
from ansible.module_utils.network_common import to_list
|
from ansible.module_utils.network_common import to_list
|
||||||
from ansible.module_utils.connection import exec_command
|
from ansible.module_utils.connection import exec_command
|
||||||
|
|
||||||
|
@ -50,6 +50,11 @@ def check_args(module, warnings):
|
||||||
warnings.append('argument %s has been deprecated and will be '
|
warnings.append('argument %s has been deprecated and will be '
|
||||||
'removed in a future version' % key)
|
'removed in a future version' % key)
|
||||||
|
|
||||||
|
if provider:
|
||||||
|
for param in ('password',):
|
||||||
|
if provider.get(param):
|
||||||
|
module.no_log_values.update(return_values(provider[param]))
|
||||||
|
|
||||||
def get_config(module, target='commands'):
|
def get_config(module, target='commands'):
|
||||||
cmd = ' '.join(['show configuration', target])
|
cmd = ' '.join(['show configuration', target])
|
||||||
|
|
||||||
|
|
|
@ -93,12 +93,6 @@ class ActionModule(_ActionModule):
|
||||||
self._play_context.become_method = None
|
self._play_context.become_method = None
|
||||||
|
|
||||||
result = super(ActionModule, self).run(tmp, task_vars)
|
result = super(ActionModule, self).run(tmp, task_vars)
|
||||||
|
|
||||||
try:
|
|
||||||
del result['invocation']['module_args']['provider']
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_socket_path(self, play_context):
|
def _get_socket_path(self, play_context):
|
||||||
|
|
|
@ -89,12 +89,6 @@ class ActionModule(_ActionModule):
|
||||||
self._play_context.become_method = None
|
self._play_context.become_method = None
|
||||||
|
|
||||||
result = super(ActionModule, self).run(tmp, task_vars)
|
result = super(ActionModule, self).run(tmp, task_vars)
|
||||||
|
|
||||||
try:
|
|
||||||
del result['invocation']['module_args']['provider']
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_socket_path(self, play_context):
|
def _get_socket_path(self, play_context):
|
||||||
|
|
|
@ -93,12 +93,6 @@ class ActionModule(_ActionModule):
|
||||||
self._play_context.become_method = None
|
self._play_context.become_method = None
|
||||||
|
|
||||||
result = super(ActionModule, self).run(tmp, task_vars)
|
result = super(ActionModule, self).run(tmp, task_vars)
|
||||||
|
|
||||||
try:
|
|
||||||
del result['invocation']['module_args']['provider']
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_socket_path(self, play_context):
|
def _get_socket_path(self, play_context):
|
||||||
|
|
|
@ -118,12 +118,6 @@ class ActionModule(_ActionModule):
|
||||||
self._task.args['provider'] = provider
|
self._task.args['provider'] = provider
|
||||||
|
|
||||||
result = super(ActionModule, self).run(tmp, task_vars)
|
result = super(ActionModule, self).run(tmp, task_vars)
|
||||||
|
|
||||||
try:
|
|
||||||
del result['invocation']['module_args']['provider']
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_socket_path(self, play_context):
|
def _get_socket_path(self, play_context):
|
||||||
|
|
|
@ -88,12 +88,6 @@ class ActionModule(_ActionModule):
|
||||||
self._play_context.become_method = None
|
self._play_context.become_method = None
|
||||||
|
|
||||||
result = super(ActionModule, self).run(tmp, task_vars)
|
result = super(ActionModule, self).run(tmp, task_vars)
|
||||||
|
|
||||||
try:
|
|
||||||
del result['invocation']['module_args']['provider']
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_socket_path(self, play_context):
|
def _get_socket_path(self, play_context):
|
||||||
|
|
|
@ -83,12 +83,6 @@ class ActionModule(_ActionModule):
|
||||||
task_vars['ansible_socket'] = socket_path
|
task_vars['ansible_socket'] = socket_path
|
||||||
|
|
||||||
result = super(ActionModule, self).run(tmp, task_vars)
|
result = super(ActionModule, self).run(tmp, task_vars)
|
||||||
|
|
||||||
try:
|
|
||||||
del result['invocation']['module_args']['provider']
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_socket_path(self, play_context):
|
def _get_socket_path(self, play_context):
|
||||||
|
|
|
@ -103,12 +103,6 @@ class ActionModule(_ActionModule):
|
||||||
task_vars['ansible_socket'] = socket_path
|
task_vars['ansible_socket'] = socket_path
|
||||||
|
|
||||||
result = super(ActionModule, self).run(tmp, task_vars)
|
result = super(ActionModule, self).run(tmp, task_vars)
|
||||||
|
|
||||||
try:
|
|
||||||
del result['invocation']['module_args']['provider']
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_socket_path(self, play_context):
|
def _get_socket_path(self, play_context):
|
||||||
|
|
|
@ -120,12 +120,6 @@ class ActionModule(_ActionModule):
|
||||||
self._task.args['transport'] = transport
|
self._task.args['transport'] = transport
|
||||||
|
|
||||||
result = super(ActionModule, self).run(tmp, task_vars)
|
result = super(ActionModule, self).run(tmp, task_vars)
|
||||||
|
|
||||||
try:
|
|
||||||
del result['invocation']['module_args']['provider']
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_socket_path(self, play_context):
|
def _get_socket_path(self, play_context):
|
||||||
|
@ -160,5 +154,3 @@ class ActionModule(_ActionModule):
|
||||||
return strategy(*args, **kwargs)
|
return strategy(*args, **kwargs)
|
||||||
except AnsibleFallbackNotFound:
|
except AnsibleFallbackNotFound:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -79,12 +79,6 @@ class ActionModule(_ActionModule):
|
||||||
task_vars['ansible_socket'] = socket_path
|
task_vars['ansible_socket'] = socket_path
|
||||||
|
|
||||||
result = super(ActionModule, self).run(tmp, task_vars)
|
result = super(ActionModule, self).run(tmp, task_vars)
|
||||||
|
|
||||||
try:
|
|
||||||
del result['invocation']['module_args']['provider']
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_socket_path(self, play_context):
|
def _get_socket_path(self, play_context):
|
||||||
|
|
|
@ -81,12 +81,6 @@ class ActionModule(_ActionModule):
|
||||||
task_vars['ansible_socket'] = socket_path
|
task_vars['ansible_socket'] = socket_path
|
||||||
|
|
||||||
result = super(ActionModule, self).run(tmp, task_vars)
|
result = super(ActionModule, self).run(tmp, task_vars)
|
||||||
|
|
||||||
try:
|
|
||||||
del result['invocation']['module_args']['provider']
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_socket_path(self, play_context):
|
def _get_socket_path(self, play_context):
|
||||||
|
|
Loading…
Reference in a new issue