* 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

(cherry picked from commit 86c714548f)
pull/23433/head
Nathaniel Case 8 years ago committed by Nathaniel Case
parent d72dbffa23
commit bb5202fa7e

@ -31,7 +31,7 @@
#
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.connection import exec_command
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 '
'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=[]):
cmd = 'show running-config '

@ -30,7 +30,7 @@
#
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.connection import exec_command
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 '
'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=[]):
cmd = 'show running-config '

@ -31,7 +31,7 @@
#
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.connection import exec_command
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 '
'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=[]):
cmd = 'show running-config '

@ -30,7 +30,7 @@
import os
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.network_common import to_list, ComplexList
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 '
'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):
provider = module.params.get('provider') or dict()
for key, value in iteritems(provider):

@ -25,7 +25,7 @@
# 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.
#
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.connection import exec_command
@ -50,6 +50,11 @@ def check_args(module, warnings):
warnings.append('argument %s has been deprecated and will be '
'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):
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
# 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.connection import exec_command
@ -49,6 +49,11 @@ def check_args(module, warnings):
warnings.append('argument %s has been deprecated and will be '
'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=[]):
cmd = 'show running-config '
cmd += ' '.join(flags)

@ -20,7 +20,7 @@ from contextlib import contextmanager
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 discard_changes, validate
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 '
'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):
try:
if not 0 <= int(value) <= 49:

@ -30,7 +30,7 @@
import re
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.connection import exec_command
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 '
'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):
provider = module.params.get('provider') or dict()
for key, value in iteritems(provider):

@ -28,7 +28,7 @@
# 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.
#
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.connection import exec_command
@ -51,6 +51,11 @@ def check_args(module, warnings):
warnings.append('argument %s has been deprecated and will be '
'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=[]):
cmd = 'admin display-config '
cmd += ' '.join(flags)

@ -25,7 +25,7 @@
# 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.
#
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.connection import exec_command
@ -50,6 +50,11 @@ def check_args(module, warnings):
warnings.append('argument %s has been deprecated and will be '
'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'):
cmd = ' '.join(['show configuration', target])

@ -93,12 +93,6 @@ class ActionModule(_ActionModule):
self._play_context.become_method = None
result = super(ActionModule, self).run(tmp, task_vars)
try:
del result['invocation']['module_args']['provider']
except KeyError:
pass
return result
def _get_socket_path(self, play_context):

@ -89,12 +89,6 @@ class ActionModule(_ActionModule):
self._play_context.become_method = None
result = super(ActionModule, self).run(tmp, task_vars)
try:
del result['invocation']['module_args']['provider']
except KeyError:
pass
return result
def _get_socket_path(self, play_context):

@ -93,12 +93,6 @@ class ActionModule(_ActionModule):
self._play_context.become_method = None
result = super(ActionModule, self).run(tmp, task_vars)
try:
del result['invocation']['module_args']['provider']
except KeyError:
pass
return result
def _get_socket_path(self, play_context):

@ -117,12 +117,6 @@ class ActionModule(_ActionModule):
self._task.args['provider'] = provider
result = super(ActionModule, self).run(tmp, task_vars)
try:
del result['invocation']['module_args']['provider']
except KeyError:
pass
return result
def _get_socket_path(self, play_context):

@ -87,12 +87,6 @@ class ActionModule(_ActionModule):
self._play_context.become_method = None
result = super(ActionModule, self).run(tmp, task_vars)
try:
del result['invocation']['module_args']['provider']
except KeyError:
pass
return result
def _get_socket_path(self, play_context):

@ -83,12 +83,6 @@ class ActionModule(_ActionModule):
task_vars['ansible_socket'] = socket_path
result = super(ActionModule, self).run(tmp, task_vars)
try:
del result['invocation']['module_args']['provider']
except KeyError:
pass
return result
def _get_socket_path(self, play_context):

@ -102,12 +102,6 @@ class ActionModule(_ActionModule):
task_vars['ansible_socket'] = socket_path
result = super(ActionModule, self).run(tmp, task_vars)
try:
del result['invocation']['module_args']['provider']
except KeyError:
pass
return result
def _get_socket_path(self, play_context):

@ -119,12 +119,6 @@ class ActionModule(_ActionModule):
self._task.args['transport'] = transport
result = super(ActionModule, self).run(tmp, task_vars)
try:
del result['invocation']['module_args']['provider']
except KeyError:
pass
return result
def _get_socket_path(self, play_context):
@ -159,5 +153,3 @@ class ActionModule(_ActionModule):
return strategy(*args, **kwargs)
except AnsibleFallbackNotFound:
pass

@ -79,12 +79,6 @@ class ActionModule(_ActionModule):
task_vars['ansible_socket'] = socket_path
result = super(ActionModule, self).run(tmp, task_vars)
try:
del result['invocation']['module_args']['provider']
except KeyError:
pass
return result
def _get_socket_path(self, play_context):

@ -80,12 +80,6 @@ class ActionModule(_ActionModule):
task_vars['ansible_socket'] = socket_path
result = super(ActionModule, self).run(tmp, task_vars)
try:
del result['invocation']['module_args']['provider']
except KeyError:
pass
return result
def _get_socket_path(self, play_context):

Loading…
Cancel
Save