|
18 | 18 | along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
19 | 19 | """
|
20 | 20 | from __future__ import unicode_literals, print_function
|
21 |
| -from ansible.module_utils.basic import AnsibleModule, return_values |
| 21 | +import os.path |
| 22 | +from ansible.module_utils.basic import AnsibleModule |
| 23 | + |
| 24 | + |
| 25 | +# FIX for Ansible 2.8 moving this function and making it private |
| 26 | +# greatly simplified for napalm-ansible's use |
| 27 | +def return_values(obj): |
| 28 | + """ Return native stringified values from datastructures. |
| 29 | +
|
| 30 | + For use with removing sensitive values pre-jsonification.""" |
| 31 | + yield str(obj) |
22 | 32 |
|
23 | 33 |
|
24 | 34 | DOCUMENTATION = '''
|
|
165 | 175 | except ImportError:
|
166 | 176 | pass
|
167 | 177 |
|
168 |
| -# Legacy for pre-reunification napalm (remove in future) |
169 |
| -if not napalm_found: |
170 |
| - try: |
171 |
| - from napalm_base import get_network_driver # noqa |
172 |
| - from napalm_base import ModuleImportError # noqa |
173 |
| - napalm_found = True |
174 |
| - except ImportError: |
175 |
| - pass |
176 |
| - |
177 | 178 |
|
178 | 179 | def save_to_file(content, filename):
|
179 | 180 | with open(filename, 'w') as f:
|
@@ -236,6 +237,14 @@ def main():
|
236 | 237 | get_diffs = module.params['get_diffs']
|
237 | 238 | archive_file = module.params['archive_file']
|
238 | 239 | candidate_file = module.params['candidate_file']
|
| 240 | + if config_file: |
| 241 | + config_file = os.path.expanduser(os.path.expandvars(config_file)) |
| 242 | + if diff_file: |
| 243 | + diff_file = os.path.expanduser(os.path.expandvars(diff_file)) |
| 244 | + if archive_file: |
| 245 | + archive_file = os.path.expanduser(os.path.expandvars(archive_file)) |
| 246 | + if candidate_file: |
| 247 | + candidate_file = os.path.expanduser(os.path.expandvars(candidate_file)) |
239 | 248 |
|
240 | 249 | argument_check = {'hostname': hostname, 'username': username, 'dev_os': dev_os}
|
241 | 250 | for key, val in argument_check.items():
|
|
0 commit comments