[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Allow the xm configuration file location to be overridden with an



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1173995060 0
# Node ID 1c94d9fcb7efcf2899363f9486aa2657123fc85d
# Parent  b926f66f29ab514cc85c16d40a7d212082c7c2f4
Allow the xm configuration file location to be overridden with an
environment variable.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xm/main.py |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff -r b926f66f29ab -r 1c94d9fcb7ef tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Thu Mar 15 16:54:00 2007 +0000
+++ b/tools/python/xen/xm/main.py       Thu Mar 15 21:44:20 2007 +0000
@@ -60,7 +60,8 @@ if not hasattr(getopt, 'gnu_getopt'):
 if not hasattr(getopt, 'gnu_getopt'):
     getopt.gnu_getopt = getopt.getopt
 
-XM_CONFIG_FILE = '/etc/xen/xm-config.xml'
+XM_CONFIG_FILE_ENVVAR = 'XM_CONFIG_FILE'
+XM_CONFIG_FILE_DEFAULT = '/etc/xen/xm-config.xml'
 
 # Supported types of server
 SERVER_LEGACY_XMLRPC = 'LegacyXMLRPC'
@@ -351,13 +352,14 @@ all_commands = (domain_commands + host_c
 # Configuration File Parsing
 ##
 
+xmConfigFile = os.getenv(XM_CONFIG_FILE_ENVVAR, XM_CONFIG_FILE_DEFAULT)
 config = None
-if os.path.isfile(XM_CONFIG_FILE):
-    try:
-        config = xml.dom.minidom.parse(XM_CONFIG_FILE)
+if os.path.isfile(xmConfigFile):
+    try:
+        config = xml.dom.minidom.parse(xmConfigFile)
     except:
         print >>sys.stderr, ('Ignoring invalid configuration file %s.' %
-                             XM_CONFIG_FILE)
+                             xmConfigFile)
 
 def parseServer():
     if config:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.