Skip to content

Commit

Permalink
Make the run wrappers a bit nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
mgax committed Jan 28, 2024
1 parent 62ed245 commit 1594874
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion opslib/places.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ def run(self, *args, **kwargs):
if not args:
shell = os.environ.get("SHELL", "sh")
args = [shell]

if self.with_sudo:
args = ["sudo", *args]

return run(*args, **kwargs)


Expand Down Expand Up @@ -183,7 +187,7 @@ def __init__(self, **kwargs):
def hostname(self):
return self.props.hostname

def run(self, *args, **kwargs):
def run(self, *args, ssh_tty=False, **kwargs):
"""
Run a command on the remote host.
Expand All @@ -205,6 +209,9 @@ def run(self, *args, **kwargs):
if self.props.config_file:
ssh_args += ["-F", str(self.props.config_file)]

if ssh_tty:
ssh_args += ["-t"]

ssh_args.append("--")

cwd = kwargs.pop("cwd", None)
Expand Down

0 comments on commit 1594874

Please sign in to comment.