mirror of https://github.com/openspug/spug
improve compatibility
parent
9998ae47ad
commit
ee3e6430ed
|
@ -194,6 +194,8 @@ def fetch_host_extend(ssh):
|
||||||
response['cpu'] = int(out.strip())
|
response['cpu'] = int(out.strip())
|
||||||
|
|
||||||
code, out = ssh.exec_command_raw("cat /etc/os-release | grep PRETTY_NAME | awk -F \\\" '{print $2}'")
|
code, out = ssh.exec_command_raw("cat /etc/os-release | grep PRETTY_NAME | awk -F \\\" '{print $2}'")
|
||||||
|
if '/etc/os-release' in out:
|
||||||
|
code, out = ssh.exec_command_raw("cat /etc/issue | head -1 | awk '{print $1,$2,$3}'")
|
||||||
if code == 0:
|
if code == 0:
|
||||||
response['os_name'] = out.strip()
|
response['os_name'] = out.strip()
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ class SSH:
|
||||||
b64_command = base64.standard_b64encode(new_command.encode())
|
b64_command = base64.standard_b64encode(new_command.encode())
|
||||||
|
|
||||||
commands = 'export SPUG_EXEC_FILE=$(mktemp)\n'
|
commands = 'export SPUG_EXEC_FILE=$(mktemp)\n'
|
||||||
commands += f'echo {b64_command.decode()} | base64 -d > $SPUG_EXEC_FILE\n'
|
commands += f'echo {b64_command.decode()} | base64 -di > $SPUG_EXEC_FILE\n'
|
||||||
commands += 'bash $SPUG_EXEC_FILE\n'
|
commands += 'bash $SPUG_EXEC_FILE\n'
|
||||||
return commands
|
return commands
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue