Network *_config action plugin updates (#43838)

* Compatibility fixes for ${network_os}_config action plugins
pull/43795/merge
Nathaniel Case 6 years ago committed by GitHub
parent ceb49bdf12
commit 35f625ee3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,7 +40,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect
@ -55,7 +55,7 @@ class ActionModule(_ActionModule):
# strip out any keys that have two leading and two trailing # strip out any keys that have two leading and two trailing
# underscore characters # underscore characters
for key in result.keys(): for key in list(result):
if PRIVATE_KEYS_RE.match(key): if PRIVATE_KEYS_RE.match(key):
del result[key] del result[key]

@ -40,7 +40,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect
@ -55,7 +55,7 @@ class ActionModule(_ActionModule):
# strip out any keys that have two leading and two trailing # strip out any keys that have two leading and two trailing
# underscore characters # underscore characters
for key in result.keys(): for key in list(result):
if PRIVATE_KEYS_RE.match(key): if PRIVATE_KEYS_RE.match(key):
del result[key] del result[key]

@ -40,7 +40,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect

@ -29,7 +29,6 @@ from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves.urllib.parse import urlsplit from ansible.module_utils.six.moves.urllib.parse import urlsplit
from ansible.utils.vars import merge_hash from ansible.utils.vars import merge_hash
PRIVATE_KEYS_RE = re.compile('__.+__') PRIVATE_KEYS_RE = re.compile('__.+__')
@ -41,7 +40,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect
@ -56,7 +55,7 @@ class ActionModule(_ActionModule):
# strip out any keys that have two leading and two trailing # strip out any keys that have two leading and two trailing
# underscore characters # underscore characters
for key in result.keys(): for key in list(result):
if PRIVATE_KEYS_RE.match(key): if PRIVATE_KEYS_RE.match(key):
del result[key] del result[key]

@ -25,7 +25,6 @@ from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves.urllib.parse import urlsplit from ansible.module_utils.six.moves.urllib.parse import urlsplit
from ansible.utils.vars import merge_hash from ansible.utils.vars import merge_hash
PRIVATE_KEYS_RE = re.compile('__.+__') PRIVATE_KEYS_RE = re.compile('__.+__')
@ -52,7 +51,7 @@ class ActionModule(_ActionModule):
# strip out any keys that have two leading and two trailing # strip out any keys that have two leading and two trailing
# underscore characters # underscore characters
for key in list(result.keys()): for key in list(result):
if PRIVATE_KEYS_RE.match(key): if PRIVATE_KEYS_RE.match(key):
del result[key] del result[key]

@ -42,7 +42,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect
@ -57,7 +57,7 @@ class ActionModule(_ActionModule):
# strip out any keys that have two leading and two trailing # strip out any keys that have two leading and two trailing
# underscore characters # underscore characters
for key in result.keys(): for key in list(result):
if PRIVATE_KEYS_RE.match(key): if PRIVATE_KEYS_RE.match(key):
del result[key] del result[key]

@ -39,7 +39,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect
@ -54,7 +54,7 @@ class ActionModule(_ActionModule):
# strip out any keys that have two leading and two trailing # strip out any keys that have two leading and two trailing
# underscore characters # underscore characters
for key in result.keys(): for key in list(result):
if PRIVATE_KEYS_RE.match(key): if PRIVATE_KEYS_RE.match(key):
del result[key] del result[key]

@ -42,7 +42,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect
@ -57,7 +57,7 @@ class ActionModule(_ActionModule):
# strip out any keys that have two leading and two trailing # strip out any keys that have two leading and two trailing
# underscore characters # underscore characters
for key in result.keys(): for key in list(result):
if PRIVATE_KEYS_RE.match(key): if PRIVATE_KEYS_RE.match(key):
del result[key] del result[key]

@ -25,7 +25,7 @@ import time
import glob import glob
from ansible.plugins.action.iosxr import ActionModule as _ActionModule from ansible.plugins.action.iosxr import ActionModule as _ActionModule
from ansible.module_utils._text import to_text, to_bytes from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves.urllib.parse import urlsplit from ansible.module_utils.six.moves.urllib.parse import urlsplit
from ansible.utils.vars import merge_hash from ansible.utils.vars import merge_hash

@ -40,7 +40,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect
@ -55,7 +55,7 @@ class ActionModule(_ActionModule):
# strip out any keys that have two leading and two trailing # strip out any keys that have two leading and two trailing
# underscore characters # underscore characters
for key in result.keys(): for key in list(result):
if PRIVATE_KEYS_RE.match(key): if PRIVATE_KEYS_RE.match(key):
del result[key] del result[key]

@ -25,9 +25,8 @@ import time
import glob import glob
from ansible.plugins.action.junos import ActionModule as _ActionModule from ansible.plugins.action.junos import ActionModule as _ActionModule
from ansible.module_utils._text import to_text from ansible.module_utils._text import to_text, to_bytes
from ansible.module_utils.six.moves.urllib.parse import urlsplit from ansible.module_utils.six.moves.urllib.parse import urlsplit
from ansible.module_utils._text import to_bytes
from ansible.utils.vars import merge_hash from ansible.utils.vars import merge_hash
PRIVATE_KEYS_RE = re.compile('__.+__') PRIVATE_KEYS_RE = re.compile('__.+__')
@ -41,7 +40,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect

@ -29,7 +29,6 @@ from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves.urllib.parse import urlsplit from ansible.module_utils.six.moves.urllib.parse import urlsplit
from ansible.utils.vars import merge_hash from ansible.utils.vars import merge_hash
PRIVATE_KEYS_RE = re.compile('__.+__') PRIVATE_KEYS_RE = re.compile('__.+__')
@ -41,7 +40,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect
@ -56,7 +55,7 @@ class ActionModule(_ActionModule):
# strip out any keys that have two leading and two trailing # strip out any keys that have two leading and two trailing
# underscore characters # underscore characters
for key in result.keys(): for key in list(result):
if PRIVATE_KEYS_RE.match(key): if PRIVATE_KEYS_RE.match(key):
del result[key] del result[key]

@ -29,7 +29,6 @@ from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves.urllib.parse import urlsplit from ansible.module_utils.six.moves.urllib.parse import urlsplit
from ansible.utils.vars import merge_hash from ansible.utils.vars import merge_hash
PRIVATE_KEYS_RE = re.compile('__.+__') PRIVATE_KEYS_RE = re.compile('__.+__')
@ -41,7 +40,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=str(exc)) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect

@ -39,7 +39,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect

@ -19,14 +19,14 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import glob
import os import os
import re import re
import time import time
import glob
from ansible.module_utils.six.moves.urllib.parse import urlsplit
from ansible.module_utils._text import to_text
from ansible.plugins.action.sros import ActionModule as _ActionModule from ansible.plugins.action.sros import ActionModule as _ActionModule
from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves.urllib.parse import urlsplit
from ansible.utils.vars import merge_hash from ansible.utils.vars import merge_hash
PRIVATE_KEYS_RE = re.compile('__.+__') PRIVATE_KEYS_RE = re.compile('__.+__')
@ -40,7 +40,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect del tmp # tmp no longer has any effect
@ -55,7 +55,7 @@ class ActionModule(_ActionModule):
# strip out any keys that have two leading and two trailing # strip out any keys that have two leading and two trailing
# underscore characters # underscore characters
for key in result.keys(): for key in list(result):
if PRIVATE_KEYS_RE.match(key): if PRIVATE_KEYS_RE.match(key):
del result[key] del result[key]

Loading…
Cancel
Save