fix nxos_file_copy and provider getting set to None when transport is cli (#30262)

* nxos_file_copy bug fix

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* provider gets set to None in module level when transport is cli

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2017-09-13 16:36:41 +05:30 committed by GitHub
parent d8371cec91
commit 578ae3b238
2 changed files with 7 additions and 13 deletions

View file

@ -61,9 +61,8 @@ options:
EXAMPLES = '''
- nxos_file_copy:
local_file: "./test_file.txt"
username: "{{ un }}"
password: "{{ pwd }}"
host: "{{ inventory_hostname }}"
remote_file: "test_file.txt"
provider: "{{ cli }}"
'''
RETURN = '''
@ -144,9 +143,11 @@ def transfer_file(module, dest):
if not enough_space(module):
module.fail_json(msg='Could not transfer file. Not enough space on device.')
hostname = module.params['host']
username = module.params['username']
password = module.params['password']
provider = module.params['provider']
hostname = module.params.get('host') or provider.get('host')
username = module.params.get('username') or provider.get('username')
password = module.params.get('password') or provider.get('password')
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())