Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow empty cmd in usersetup.py #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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)