Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions usersetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ def sanity_check_workdir(workdir):
parser.add_argument("--workdir", default="/workdir",
help="Directory to base the uid on")

parser.add_argument("cmd", help="command to exec after setting up the user")

# All positional arguments are passed to args.cmd when it is ran
parser.add_argument("args", default="", nargs=argparse.REMAINDER)
parser.add_argument("cmd", nargs=argparse.REMAINDER, help="command to exec after setting up the user")

args = parser.parse_args()

Expand Down Expand Up @@ -94,5 +91,7 @@ def sanity_check_workdir(workdir):
usercmd = [ args.cmd ] + args.args

cmd = "sudo -E -H -u {} ".format(args.username)
cmd = cmd.split() + usercmd
cmd = cmd.split()
if args.cmd:
cmd.extend(args.cmd)
os.execvp(cmd[0], cmd)