On Tue, Sep 24, 2013 at 2:23 PM, Jose A. Lopes <[email protected]> wrote:
> Update references to constants that were previously in the generated > 'lib/_autoconf.py' and since the previous patch have been included in > the Hs2Py constant generation. > > Signed-off-by: Jose A. Lopes <[email protected]> > --- > autotools/build-bash-completion | 18 +++++++++--------- > autotools/convert-constants | 2 -- > lib/build/sphinx_ext.py | 4 ++-- > lib/pathutils.py | 27 +++++++++++++-------------- > qa/qa_cluster.py | 4 ++-- > qa/qa_monitoring.py | 4 ++-- > test/py/daemon-util_unittest.bash | 8 ++++---- > test/py/docs_unittest.py | 4 ++-- > 8 files changed, 34 insertions(+), 37 deletions(-) > > diff --git a/autotools/build-bash-completion > b/autotools/build-bash-completion > index 63def12..731e93d 100755 > --- a/autotools/build-bash-completion > +++ b/autotools/build-bash-completion > @@ -33,6 +33,10 @@ import itertools > import optparse > from cStringIO import StringIO > > +# _constants shouldn't be imported from anywhere except constants.py, but > we're > +# making an exception here because this script is only used at build time. > +from ganeti import _constants > + > from ganeti import constants > from ganeti import cli > from ganeti import utils > @@ -41,10 +45,6 @@ from ganeti import pathutils > > from ganeti.tools import burnin > > -# _autoconf shouldn't be imported from anywhere except constants.py, but > we're > -# making an exception here because this script is only used at build time. > -from ganeti import _autoconf > - > #: Regular expression describing desired format of option names. Long > names can > #: contain lowercase characters, numbers and dashes only. > _OPT_NAME_RE = re.compile(r"^-[a-zA-Z0-9]|--[a-z][-a-z0-9]+$") > @@ -832,7 +832,7 @@ def main(): > WritePreamble(sw, debug) > > # gnt-* scripts > - for scriptname in _autoconf.GNT_SCRIPTS: > + for scriptname in _constants.GNT_SCRIPTS: > filename = "scripts/%s" % scriptname > > WriteCompletion(sw, scriptname, GetFunctionName(scriptname), debug, > @@ -849,17 +849,17 @@ def main(): > debug=not options.compact) > > # htools, if enabled > - if _autoconf.HTOOLS: > - for script in _autoconf.HTOOLS_PROGS: > + if _constants.HTOOLS: > + for script in _constants.HTOOLS_PROGS: > WriteHaskellCompletion(sw, script, htools=True, debug=debug) > > # ganeti-confd, if enabled > - if _autoconf.ENABLE_CONFD: > + if _constants.ENABLE_CONFD: > WriteHaskellCompletion(sw, "src/ganeti-confd", htools=False, > debug=debug) > > # mon-collector, if monitoring is enabled > - if _autoconf.ENABLE_MOND: > + if _constants.ENABLE_MOND: > WriteHaskellCmdCompletion(sw, "src/mon-collector", debug=debug) > > # Reset extglob to original value > diff --git a/autotools/convert-constants b/autotools/convert-constants > index 14109e0..421d3d4 100755 > --- a/autotools/convert-constants > +++ b/autotools/convert-constants > @@ -25,7 +25,6 @@ > import re > import types > > -from ganeti import _autoconf > from ganeti import _constants > from ganeti import compat > from ganeti import constants > @@ -306,7 +305,6 @@ def main(): > print Convert(constants, "") > print Convert(luxi, "luxi") > print Convert(qlang, "qlang") > - print Convert(_autoconf, "autoconf") > print Convert(errors, "errors") > print Convert(jstore, "jstore") > > diff --git a/lib/build/sphinx_ext.py b/lib/build/sphinx_ext.py > index 2280335..f9c71d7 100644 > --- a/lib/build/sphinx_ext.py > +++ b/lib/build/sphinx_ext.py > @@ -46,6 +46,7 @@ except (AttributeError, ValueError, KeyError), err: > # Normally the "manpage" role is registered by sphinx/roles.py > raise Exception("Can't find reST role named 'manpage': %s" % err) > > +from ganeti import _constants > from ganeti import constants > from ganeti import compat > from ganeti import errors > @@ -57,7 +58,6 @@ from ganeti import rapi > from ganeti import luxi > from ganeti import objects > from ganeti import http > -from ganeti import _autoconf > > import ganeti.rapi.rlib2 # pylint: disable=W0611 > import ganeti.rapi.connector # pylint: disable=W0611 > @@ -385,7 +385,7 @@ class _ManPageXRefRole(sphinx.roles.XRefRole): > name = m.group("name") > section = int(m.group("section")) > > - wanted_section = _autoconf.MAN_PAGES.get(name, None) > + wanted_section = _constants.MAN_PAGES.get(name, None) > > if not (wanted_section is None or wanted_section == section): > raise ReSTError("Referenced man page '%s' has section number %s, > but the" > diff --git a/lib/pathutils.py b/lib/pathutils.py > index 2e28418..0c1202f 100644 > --- a/lib/pathutils.py > +++ b/lib/pathutils.py > @@ -23,7 +23,6 @@ > > """ > > -from ganeti import _autoconf > from ganeti import _constants > from ganeti import compat > from ganeti import vcluster > @@ -35,23 +34,23 @@ DEFAULT_FILE_STORAGE_DIR = > vcluster.AddNodePrefix(DEFAULT_FILE_STORAGE_DIR) > DEFAULT_SHARED_FILE_STORAGE_DIR = "/srv/ganeti/shared-file-storage" > DEFAULT_SHARED_FILE_STORAGE_DIR = \ > vcluster.AddNodePrefix(DEFAULT_SHARED_FILE_STORAGE_DIR) > -EXPORT_DIR = vcluster.AddNodePrefix(_autoconf.EXPORT_DIR) > +EXPORT_DIR = vcluster.AddNodePrefix(_constants.EXPORT_DIR) > OS_SEARCH_PATH = _constants.OS_SEARCH_PATH > ES_SEARCH_PATH = _constants.ES_SEARCH_PATH > -SSH_CONFIG_DIR = _autoconf.SSH_CONFIG_DIR > -XEN_CONFIG_DIR = vcluster.AddNodePrefix(_autoconf.XEN_CONFIG_DIR) > -SYSCONFDIR = vcluster.AddNodePrefix(_autoconf.SYSCONFDIR) > -TOOLSDIR = _autoconf.TOOLSDIR > -LOCALSTATEDIR = vcluster.AddNodePrefix(_autoconf.LOCALSTATEDIR) > +SSH_CONFIG_DIR = _constants.SSH_CONFIG_DIR > +XEN_CONFIG_DIR = vcluster.AddNodePrefix(_constants.XEN_CONFIG_DIR) > +SYSCONFDIR = vcluster.AddNodePrefix(_constants.SYSCONFDIR) > +TOOLSDIR = _constants.TOOLSDIR > +LOCALSTATEDIR = vcluster.AddNodePrefix(_constants.LOCALSTATEDIR) > > # Paths which don't change for a virtual cluster > -DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util" > -IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export" > -KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper" > -KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup" > -PREPARE_NODE_JOIN = _autoconf.PKGLIBDIR + "/prepare-node-join" > -NODE_DAEMON_SETUP = _autoconf.PKGLIBDIR + "/node-daemon-setup" > -XEN_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xen-console-wrapper" > +DAEMON_UTIL = _constants.PKGLIBDIR + "/daemon-util" > +IMPORT_EXPORT_DAEMON = _constants.PKGLIBDIR + "/import-export" > +KVM_CONSOLE_WRAPPER = _constants.PKGLIBDIR + "/tools/kvm-console-wrapper" > +KVM_IFUP = _constants.PKGLIBDIR + "/kvm-ifup" > +PREPARE_NODE_JOIN = _constants.PKGLIBDIR + "/prepare-node-join" > +NODE_DAEMON_SETUP = _constants.PKGLIBDIR + "/node-daemon-setup" > +XEN_CONSOLE_WRAPPER = _constants.PKGLIBDIR + "/tools/xen-console-wrapper" > ETC_HOSTS = vcluster.ETC_HOSTS > > # Top-level paths > diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py > index c58abde..feac8e6 100644 > --- a/qa/qa_cluster.py > +++ b/qa/qa_cluster.py > @@ -27,7 +27,7 @@ import re > import tempfile > import os.path > > -from ganeti import _autoconf > +from ganeti import _constants > from ganeti import constants > from ganeti import compat > from ganeti import utils > @@ -1112,7 +1112,7 @@ def TestClusterBurnin(): > disks = qa_config.GetDiskOptions() > # Run burnin > cmd = ["env", > - "PYTHONPATH=%s" % _autoconf.VERSIONEDSHAREDIR, > + "PYTHONPATH=%s" % _constants.VERSIONEDSHAREDIR, > script, > "--os=%s" % qa_config.get("os"), > "--minmem-size=%s" % qa_config.get(constants.BE_MINMEM), > diff --git a/qa/qa_monitoring.py b/qa/qa_monitoring.py > index 90bc1b9..8151622 100644 > --- a/qa/qa_monitoring.py > +++ b/qa/qa_monitoring.py > @@ -23,7 +23,7 @@ > > """ > > -from ganeti import _autoconf > +from ganeti import _constants > from ganeti import constants > > import qa_config > @@ -32,7 +32,7 @@ from qa_utils import AssertCommand > from qa_instance_utils import CreateInstanceByDiskTemplate, \ > RemoveInstance > > -MON_COLLECTOR = _autoconf.PKGLIBDIR + "/mon-collector" > +MON_COLLECTOR = _constants.PKGLIBDIR + "/mon-collector" > > > def TestInstStatusCollector(): > diff --git a/test/py/daemon-util_unittest.bash > b/test/py/daemon-util_unittest.bash > index ec7b50d..13009d2 100755 > --- a/test/py/daemon-util_unittest.bash > +++ b/test/py/daemon-util_unittest.bash > @@ -28,23 +28,23 @@ err() { > exit 1 > } > > -if ! grep -q '^ENABLE_CONFD = ' lib/_autoconf.py; then > +if ! grep -q '^ENABLE_CONFD = ' lib/_constants.py; then > err "Please update $0, confd enable feature is missing" > fi > > -if ! grep -q '^ENABLE_MOND = ' lib/_autoconf.py; then > +if ! grep -q '^ENABLE_MOND = ' lib/_constants.py; then > err "Please update $0, mond enable feature is missing" > fi > > DAEMONS_LIST="noded masterd rapi" > STOPDAEMONS_LIST="rapi masterd noded" > > -if grep -q '^ENABLE_CONFD = True' lib/_autoconf.py; then > +if grep -q '^ENABLE_CONFD = True' lib/_constants.py; then > DAEMONS_LIST="$DAEMONS_LIST confd luxid" > STOPDAEMONS_LIST="luxid confd $STOPDAEMONS_LIST" > fi > > -if grep -q '^ENABLE_MOND = True' lib/_autoconf.py; then > +if grep -q '^ENABLE_MOND = True' lib/_constants.py; then > DAEMONS_LIST="$DAEMONS_LIST mond" > STOPDAEMONS_LIST="mond $STOPDAEMONS_LIST" > fi > diff --git a/test/py/docs_unittest.py b/test/py/docs_unittest.py > index 8c9d4fe..8589701 100755 > --- a/test/py/docs_unittest.py > +++ b/test/py/docs_unittest.py > @@ -26,7 +26,7 @@ import re > import itertools > import operator > > -from ganeti import _autoconf > +from ganeti import _constants > from ganeti import utils > from ganeti import cmdlib > from ganeti import build > @@ -314,7 +314,7 @@ class TestManpages(unittest.TestCase): > return build.LoadModule("scripts/%s" % name) > > def test(self): > - for script in _autoconf.GNT_SCRIPTS: > + for script in _constants.GNT_SCRIPTS: > self._CheckManpage(script, > self._ReadManFile(script), > self._LoadScript(script).commands.keys()) > -- > 1.8.4 > > LGTM, thanks. -- Thomas Thrainer | Software Engineer | [email protected] | Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
