Sean Dague wrote:
This patch prevents you from getting a screen full of stack trace when
trying to run commands like xm list as a normal user, and instead provides a
helpful error message.
+1, Admirable. (non-binding/non-voter/non-commiter)
Signed-off-by: Sean Dague <sean@xxxxxxxxx>
Diffstat output:
main.py | 7 +++++++
1 files changed, 7 insertions(+)
diff -r 48aed1403fe3 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Fri Jul 22 16:44:33 2005
+++ b/tools/python/xen/xm/main.py Tue Jul 26 10:31:24 2005
@@ -11,6 +11,13 @@
from xen.xend import PrettyPrint
from xen.xend import sxp
+# this is a nasty place to stick this in, but required because
+# log file access is set up via a 5 deep import chain. This
+# ensures the user sees a useful message instead of a stack trace
+if os.getuid() != 0:
+ print "xm requires root access to execute, please try again as root"
+ sys.exit(1)
+
from xen.xend.XendClient import XendError, server
from xen.xend.XendClient import main as xend_client_main
from xen.xm import create, destroy, migrate, shutdown, sysrq
Please allow me to show my possible ignorance...
Is there no better way to test for elevated privileges?
Would it be unreasonable to think xm maintenance tasks could be handed
off to members of a non-root group?
--
Andrew Thompson
http://aktzero.com/
andrewkt.vcf
Description: Vcard
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|