diff options
author | John Estabrook <jestabro@vyos.io> | 2020-04-10 09:34:31 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2020-04-10 10:24:11 -0500 |
commit | 162ead0105f3dce3d6ede02d486b3616f84e69f7 (patch) | |
tree | 0c3d6b4f4df892a0a3fb866774ab32c16295607d | |
parent | a32cb241eaf8971bd27713e32f3804d77a9d39ee (diff) | |
download | vyos-1x-162ead0105f3dce3d6ede02d486b3616f84e69f7.tar.gz vyos-1x-162ead0105f3dce3d6ede02d486b3616f84e69f7.zip |
util: T2253: fix translation of subprocess.check_output to cmd
-rw-r--r-- | python/vyos/remote.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/python/vyos/remote.py b/python/vyos/remote.py index f0bf41cd4..f918461d1 100644 --- a/python/vyos/remote.py +++ b/python/vyos/remote.py @@ -34,7 +34,7 @@ def check_and_add_host_key(host_name): keyscan_cmd = 'ssh-keyscan -t rsa {} 2>/dev/null'.format(host_name) try: - host_key = cmd(keyscan_cmd, stderr=DEVNULL, universal_newlines=True) + host_key = cmd(keyscan_cmd, shell=True, stderr=DEVNULL) except OSError: sys.exit("Can not get RSA host key") @@ -63,7 +63,7 @@ def check_and_add_host_key(host_name): fingerprint_cmd = 'ssh-keygen -lf /dev/stdin <<< "{}"'.format(host_key) try: - fingerprint = cmd(fingerprint_cmd, stderr=DEVNULL, universal_newlines=True) + fingerprint = cmd(fingerprint_cmd, shell=True, stderr=DEVNULL) except OSError: sys.exit("Can not get RSA host key fingerprint.") @@ -125,7 +125,7 @@ def get_remote_config(remote_file): # Try header first, and look for 'OK' or 'Moved' codes: curl_cmd = 'curl {0} -q -I {1}'.format(redirect_opt, remote_file) try: - curl_output = cmd(curl_cmd, shell=True, universal_newlines=True) + curl_output = cmd(curl_cmd, shell=True) except OSError: sys.exit(1) @@ -142,6 +142,6 @@ def get_remote_config(remote_file): curl_cmd = 'curl {0} -# {1}'.format(redirect_opt, remote_file) try: - return cmd(curl_cmd, universal_newlines=True) + return cmd(curl_cmd, shell=True, stderr=None) except OSError: return None |