1
0
Fork 0

Set the default user

Don't reuse $USER anymore
master
LEdoian 4 years ago
parent 83c81f8783
commit 1be305efcd

@ -16,6 +16,7 @@ from typing import *
host: str host: str
directory: str = None directory: str = None
default_user = 'root'
def main(): def main():
if len(sys.argv) < 3: if len(sys.argv) < 3:
@ -178,6 +179,9 @@ def run_command(cmd: Command):
remote_command = cmd.command remote_command = cmd.command
if cmd.user is not None: if cmd.user is not None:
local_command.extend(['-l', cmd.user]) local_command.extend(['-l', cmd.user])
else:
global default_user
local_command.extend(['-l', default_user])
local_command.append(host) # SSH seems to honor the first specified parameter. This allows to have username as a part of the hostname, yet still be able to honor the sudo-s in the sinppets. local_command.append(host) # SSH seems to honor the first specified parameter. This allows to have username as a part of the hostname, yet still be able to honor the sudo-s in the sinppets.
if cmd.directory is not None: if cmd.directory is not None:
remote_command = f'cd {cmd.directory}; {remote_command}' remote_command = f'cd {cmd.directory}; {remote_command}'

Loading…
Cancel
Save