Skip to content

Commit

Permalink
add support for auto-sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Vinet committed Oct 31, 2012
1 parent 8d57e4a commit a4fcad0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions llxc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
import subprocess
import warnings

if os.getuid():
opts = os.environ.get('llxcsudo', 'allow,env').split(",")
if not "deny" in opts:
cmd = ["sudo"]
if "env" in opts:
cmd.append("-E")

sys.exit(subprocess.call(cmd + sys.argv))

# For now we need to filter the warning that python3-lxc produces
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=Warning)
Expand Down

0 comments on commit a4fcad0

Please sign in to comment.