commit:     44dfdc8b645cb2d13fa0e966bfa7f7591119c980
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 25 20:32:19 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Jun 25 20:32:19 2018 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=44dfdc8b

grs/Constants.py: add CONFIGFILE for an alt to '/etc/grs/systems.conf'

 grs/Constants.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/grs/Constants.py b/grs/Constants.py
index ecbac40..bdaee25 100644
--- a/grs/Constants.py
+++ b/grs/Constants.py
@@ -57,6 +57,12 @@ class Constants():
     """
 
     def __init__(self, configfile='/etc/grs/systems.conf'):
+        # Grab an alternative config file from the env var CONFIGFILE
+        # TODO: I've designed myself into a bit of a corner here, and
+        # there is no easy way of adding a command line option to grsrun
+        # or grsup which propagates to this class.
+        if 'CONFIGFILE' in os.environ:
+            configfile = os.environ['CONFIGFILE']
         # If there's no config file, we're dead in the water.
         if not os.path.isfile(configfile):
             raise Exception('Configuration file %s not found\n' % configfile)

Reply via email to