From: Sean Dague Subject: [PATCH] provide real error message when trying to run xm as non root Date: Tue, 26 Jul 2005 10:41:56 -0400 Message-ID: <20050726144156.GA22926@underhill.no-ip.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0005366710==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0005366710== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J2SCkAp4GZ/dPZZf" Content-Disposition: inline --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. Signed-off-by: Sean Dague 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 @@ =20 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() !=3D 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 -Sean --=20 __________________________________________________________________ Sean Dague Mid-Hudson Valley sean at dague dot net Linux Users Group http://dague.net http://mhvlug.org There is no silver bullet. Plus, werewolves make better neighbors than zombies, and they tend to keep the vampire population down. __________________________________________________________________ --J2SCkAp4GZ/dPZZf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFC5ku0SamXem9TdyYRAkJ/AJ9/ZnAj+gKTbsGOnBIzXTZ/SApe2QCfYsCD VWjygyrtKuEe4SQTIEk1xcE= =+zHj -----END PGP SIGNATURE----- --J2SCkAp4GZ/dPZZf-- --===============0005366710== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0005366710==--