[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 656: Requires being run as root

Message ID 20130822171125.22718.25063.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Antonio Terceiro Aug. 22, 2013, 5:11 p.m.
------------------------------------------------------------
revno: 656
fixes bug: https://launchpad.net/bugs/1070309
committer: Antonio Terceiro <antonio.terceiro@linaro.org>
branch nick: requires-root
timestamp: Thu 2013-08-22 13:01:35 -0300
message:
  Requires being run as root
  
  Save time from everyone since down the road root permissions will be needed. Just fail right away if no running as root.
modified:
  lava/dispatcher/commands.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription

Patch

=== modified file 'lava/dispatcher/commands.py'
--- lava/dispatcher/commands.py	2013-07-16 15:58:16 +0000
+++ lava/dispatcher/commands.py	2013-08-22 16:01:35 +0000
@@ -73,6 +73,11 @@ 
         )
 
     def invoke(self):
+
+        if os.getuid() != 0:
+            logging.error("lava dispatch has to be run as root")
+            exit(1)
+
         if self.args.oob_fd:
             oob_file = os.fdopen(self.args.oob_fd, 'w')
         else: