Merge "Respect VIRTUAL_BMC for non-default config path"

This commit is contained in:
Zuul 2019-05-18 10:52:13 +00:00 committed by Gerrit Code Review
commit 55d96e62cb
3 changed files with 13 additions and 5 deletions

View File

@ -10,6 +10,11 @@ does all the heavy-lifting (speaks IPMI, calls libvirt) while ``vbmc``
client is merely a command-line tool sending commands to the server and
rendering responses to the user.
Both tools can optionally consume optional configuration file, which
defaults to ``$HOME/.vbmc/virtualbmc.conf``,
``/etc/virtualbmc/virtualbmc.conf``, but can be overridden with the
``VIRTUALBMC_CONFIG`` environment variable.
You should set up your systemd to launch the ``vbmcd`` server on system
start up or you can just run ``vbmcd`` from command line if you do not need
the tool running persistently on the system. Once the server is up and

View File

@ -0,0 +1,5 @@
features:
- |
Adds the ability to override default configuration file location by
exporting the ``$VIRTUALBMC_CONFIG`` variable, pointing to the desired
config file, into ``vbmcd`` and ``vbmc`` processes environment.

View File

@ -19,15 +19,13 @@ from virtualbmc import utils
__all__ = ['get_config']
_CONFIG_FILE_PATHS = (
os.environ.get('VIRTUALBMC_CONFIG', ''),
os.path.join(os.path.expanduser('~'), '.vbmc', 'virtualbmc.conf'),
'/etc/virtualbmc/virtualbmc.conf')
CONFIG_FILE = next((x for x in _CONFIG_FILE_PATHS if os.path.exists(x)), '')
CONFIG = None
CONFIG_FILE = ''
for config in _CONFIG_FILE_PATHS:
if os.path.exists(config):
CONFIG_FILE = config
break
class VirtualBMCConfig(object):