summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/settings.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-04-23 14:50:09 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-04-23 14:50:09 -0400
commit46a47b4120b3d892b8149a5e181e4d976ad87f99 (patch)
treef2697f233fc7f5ad5022864222a5ca87715a651b /src/lib/Bcfg2/settings.py
parente1f99d1d5045e0511db42debb30aa97da2018796 (diff)
parent3d06f311274d6b942ee89d8cdb13b2ecc99af1b0 (diff)
downloadbcfg2-46a47b4120b3d892b8149a5e181e4d976ad87f99.tar.gz
bcfg2-46a47b4120b3d892b8149a5e181e4d976ad87f99.tar.bz2
bcfg2-46a47b4120b3d892b8149a5e181e4d976ad87f99.zip
Merge branch '1.4.x'
Conflicts: debian/bcfg2-server.install doc/server/plugins/grouping/metadata.txt src/lib/Bcfg2/Client/Client.py src/lib/Bcfg2/Client/Tools/Portage.py src/lib/Bcfg2/Client/Tools/RcUpdate.py src/lib/Bcfg2/Client/Tools/YUM24.py src/lib/Bcfg2/Client/Tools/__init__.py src/lib/Bcfg2/Client/Tools/launchd.py src/lib/Bcfg2/Options.py src/lib/Bcfg2/Server/Core.py src/lib/Bcfg2/Server/Plugin/helpers.py src/lib/Bcfg2/Server/Plugins/Metadata.py src/lib/Bcfg2/Server/models.py src/lib/Bcfg2/Utils.py src/sbin/bcfg2-info src/sbin/bcfg2-test testsuite/Testsrc/Testlib/TestClient/TestTools/Test_init.py testsuite/Testsrc/test_code_checks.py
Diffstat (limited to 'src/lib/Bcfg2/settings.py')
-rw-r--r--src/lib/Bcfg2/settings.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/Bcfg2/settings.py b/src/lib/Bcfg2/settings.py
index de2ef5960..87f2a0df0 100644
--- a/src/lib/Bcfg2/settings.py
+++ b/src/lib/Bcfg2/settings.py
@@ -39,20 +39,20 @@ def _default_config():
""" get the default config file. returns /etc/bcfg2-web.conf,
UNLESS /etc/bcfg2.conf exists AND /etc/bcfg2-web.conf does not
exist. """
- optinfo = dict(cfile=Bcfg2.Options.CFILE,
- web_cfile=Bcfg2.Options.WEB_CFILE)
- setup = Bcfg2.Options.OptionParser(optinfo, quiet=True)
- setup.parse(sys.argv[1:], do_getopt=False)
- if (not os.path.exists(setup['web_cfile']) and
- os.path.exists(setup['cfile'])):
- return setup['cfile']
+ setup = Bcfg2.Options.get_option_parser()
+ setup.add_option("configfile", Bcfg2.Options.CFILE)
+ setup.add_option("web_configfile", Bcfg2.Options.WEB_CFILE)
+ setup.reparse(argv=sys.argv[1:], do_getopt=False)
+ if (not os.path.exists(setup['web_configfile']) and
+ os.path.exists(setup['configfile'])):
+ return setup['configfile']
else:
- return setup['web_cfile']
+ return setup['web_configfile']
DEFAULT_CONFIG = _default_config()
-def read_config(cfile=DEFAULT_CONFIG, repo=None, quiet=False):
+def read_config(cfile=DEFAULT_CONFIG, repo=None):
""" read the config file and set django settings based on it """
# pylint: disable=W0603
global DATABASE_ENGINE, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, \
@@ -65,15 +65,15 @@ def read_config(cfile=DEFAULT_CONFIG, repo=None, quiet=False):
(cfile, DEFAULT_CONFIG))
cfile = DEFAULT_CONFIG
- optinfo = Bcfg2.Options.DATABASE_COMMON_OPTIONS
- optinfo['repo'] = Bcfg2.Options.SERVER_REPOSITORY
# when setting a different config file, it has to be set in either
# sys.argv or in the OptionSet() constructor AS WELL AS the argv
# that's passed to setup.parse()
argv = [Bcfg2.Options.CFILE.cmd, cfile,
Bcfg2.Options.WEB_CFILE.cmd, cfile]
- setup = Bcfg2.Options.OptionParser(optinfo, argv=argv, quiet=quiet)
- setup.parse(argv)
+ setup = Bcfg2.Options.get_option_parser()
+ setup.add_options(Bcfg2.Options.DATABASE_COMMON_OPTIONS)
+ setup.add_option("repo", Bcfg2.Options.SERVER_REPOSITORY)
+ setup.reparse(argv=argv)
if repo is None:
repo = setup['repo']
@@ -102,7 +102,7 @@ def read_config(cfile=DEFAULT_CONFIG, repo=None, quiet=False):
# initialize settings from /etc/bcfg2-web.conf or /etc/bcfg2.conf, or
# set up basic defaults. this lets manage.py work in all cases
-read_config(quiet=True)
+read_config()
ADMINS = (('Root', 'root'))
MANAGERS = ADMINS