Commit b8669a69 authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

Hs2Py constants: update Python references



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: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
parent 1c9e817d
...@@ -33,6 +33,10 @@ import itertools ...@@ -33,6 +33,10 @@ import itertools
import optparse import optparse
from cStringIO import StringIO 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 constants
from ganeti import cli from ganeti import cli
from ganeti import utils from ganeti import utils
...@@ -41,10 +45,6 @@ from ganeti import pathutils ...@@ -41,10 +45,6 @@ from ganeti import pathutils
from ganeti.tools import burnin 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 #: Regular expression describing desired format of option names. Long names can
#: contain lowercase characters, numbers and dashes only. #: contain lowercase characters, numbers and dashes only.
_OPT_NAME_RE = re.compile(r"^-[a-zA-Z0-9]|--[a-z][-a-z0-9]+$") _OPT_NAME_RE = re.compile(r"^-[a-zA-Z0-9]|--[a-z][-a-z0-9]+$")
...@@ -832,7 +832,7 @@ def main(): ...@@ -832,7 +832,7 @@ def main():
WritePreamble(sw, debug) WritePreamble(sw, debug)
# gnt-* scripts # gnt-* scripts
for scriptname in _autoconf.GNT_SCRIPTS: for scriptname in _constants.GNT_SCRIPTS:
filename = "scripts/%s" % scriptname filename = "scripts/%s" % scriptname
WriteCompletion(sw, scriptname, GetFunctionName(scriptname), debug, WriteCompletion(sw, scriptname, GetFunctionName(scriptname), debug,
...@@ -849,17 +849,17 @@ def main(): ...@@ -849,17 +849,17 @@ def main():
debug=not options.compact) debug=not options.compact)
# htools, if enabled # htools, if enabled
if _autoconf.HTOOLS: if _constants.HTOOLS:
for script in _autoconf.HTOOLS_PROGS: for script in _constants.HTOOLS_PROGS:
WriteHaskellCompletion(sw, script, htools=True, debug=debug) WriteHaskellCompletion(sw, script, htools=True, debug=debug)
# ganeti-confd, if enabled # ganeti-confd, if enabled
if _autoconf.ENABLE_CONFD: if _constants.ENABLE_CONFD:
WriteHaskellCompletion(sw, "src/ganeti-confd", htools=False, WriteHaskellCompletion(sw, "src/ganeti-confd", htools=False,
debug=debug) debug=debug)
# mon-collector, if monitoring is enabled # mon-collector, if monitoring is enabled
if _autoconf.ENABLE_MOND: if _constants.ENABLE_MOND:
WriteHaskellCmdCompletion(sw, "src/mon-collector", debug=debug) WriteHaskellCmdCompletion(sw, "src/mon-collector", debug=debug)
# Reset extglob to original value # Reset extglob to original value
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
import re import re
import types import types
from ganeti import _autoconf
from ganeti import _constants from ganeti import _constants
from ganeti import compat from ganeti import compat
from ganeti import constants from ganeti import constants
...@@ -306,7 +305,6 @@ def main(): ...@@ -306,7 +305,6 @@ def main():
print Convert(constants, "") print Convert(constants, "")
print Convert(luxi, "luxi") print Convert(luxi, "luxi")
print Convert(qlang, "qlang") print Convert(qlang, "qlang")
print Convert(_autoconf, "autoconf")
print Convert(errors, "errors") print Convert(errors, "errors")
print Convert(jstore, "jstore") print Convert(jstore, "jstore")
......
...@@ -46,6 +46,7 @@ except (AttributeError, ValueError, KeyError), err: ...@@ -46,6 +46,7 @@ except (AttributeError, ValueError, KeyError), err:
# Normally the "manpage" role is registered by sphinx/roles.py # Normally the "manpage" role is registered by sphinx/roles.py
raise Exception("Can't find reST role named 'manpage': %s" % err) raise Exception("Can't find reST role named 'manpage': %s" % err)
from ganeti import _constants
from ganeti import constants from ganeti import constants
from ganeti import compat from ganeti import compat
from ganeti import errors from ganeti import errors
...@@ -57,7 +58,6 @@ from ganeti import rapi ...@@ -57,7 +58,6 @@ from ganeti import rapi
from ganeti import luxi from ganeti import luxi
from ganeti import objects from ganeti import objects
from ganeti import http from ganeti import http
from ganeti import _autoconf
import ganeti.rapi.rlib2 # pylint: disable=W0611 import ganeti.rapi.rlib2 # pylint: disable=W0611
import ganeti.rapi.connector # pylint: disable=W0611 import ganeti.rapi.connector # pylint: disable=W0611
...@@ -385,7 +385,7 @@ class _ManPageXRefRole(sphinx.roles.XRefRole): ...@@ -385,7 +385,7 @@ class _ManPageXRefRole(sphinx.roles.XRefRole):
name = m.group("name") name = m.group("name")
section = int(m.group("section")) 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): if not (wanted_section is None or wanted_section == section):
raise ReSTError("Referenced man page '%s' has section number %s, but the" raise ReSTError("Referenced man page '%s' has section number %s, but the"
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
""" """
from ganeti import _autoconf
from ganeti import _constants from ganeti import _constants
from ganeti import compat from ganeti import compat
from ganeti import vcluster from ganeti import vcluster
...@@ -35,23 +34,23 @@ DEFAULT_FILE_STORAGE_DIR = vcluster.AddNodePrefix(DEFAULT_FILE_STORAGE_DIR) ...@@ -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 = "/srv/ganeti/shared-file-storage"
DEFAULT_SHARED_FILE_STORAGE_DIR = \ DEFAULT_SHARED_FILE_STORAGE_DIR = \
vcluster.AddNodePrefix(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 OS_SEARCH_PATH = _constants.OS_SEARCH_PATH
ES_SEARCH_PATH = _constants.ES_SEARCH_PATH ES_SEARCH_PATH = _constants.ES_SEARCH_PATH
SSH_CONFIG_DIR = _autoconf.SSH_CONFIG_DIR SSH_CONFIG_DIR = _constants.SSH_CONFIG_DIR
XEN_CONFIG_DIR = vcluster.AddNodePrefix(_autoconf.XEN_CONFIG_DIR) XEN_CONFIG_DIR = vcluster.AddNodePrefix(_constants.XEN_CONFIG_DIR)
SYSCONFDIR = vcluster.AddNodePrefix(_autoconf.SYSCONFDIR) SYSCONFDIR = vcluster.AddNodePrefix(_constants.SYSCONFDIR)
TOOLSDIR = _autoconf.TOOLSDIR TOOLSDIR = _constants.TOOLSDIR
LOCALSTATEDIR = vcluster.AddNodePrefix(_autoconf.LOCALSTATEDIR) LOCALSTATEDIR = vcluster.AddNodePrefix(_constants.LOCALSTATEDIR)
# Paths which don't change for a virtual cluster # Paths which don't change for a virtual cluster
DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util" DAEMON_UTIL = _constants.PKGLIBDIR + "/daemon-util"
IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export" IMPORT_EXPORT_DAEMON = _constants.PKGLIBDIR + "/import-export"
KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper" KVM_CONSOLE_WRAPPER = _constants.PKGLIBDIR + "/tools/kvm-console-wrapper"
KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup" KVM_IFUP = _constants.PKGLIBDIR + "/kvm-ifup"
PREPARE_NODE_JOIN = _autoconf.PKGLIBDIR + "/prepare-node-join" PREPARE_NODE_JOIN = _constants.PKGLIBDIR + "/prepare-node-join"
NODE_DAEMON_SETUP = _autoconf.PKGLIBDIR + "/node-daemon-setup" NODE_DAEMON_SETUP = _constants.PKGLIBDIR + "/node-daemon-setup"
XEN_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xen-console-wrapper" XEN_CONSOLE_WRAPPER = _constants.PKGLIBDIR + "/tools/xen-console-wrapper"
ETC_HOSTS = vcluster.ETC_HOSTS ETC_HOSTS = vcluster.ETC_HOSTS
# Top-level paths # Top-level paths
......
...@@ -27,7 +27,7 @@ import re ...@@ -27,7 +27,7 @@ import re
import tempfile import tempfile
import os.path import os.path
from ganeti import _autoconf from ganeti import _constants
from ganeti import constants from ganeti import constants
from ganeti import compat from ganeti import compat
from ganeti import utils from ganeti import utils
...@@ -1112,7 +1112,7 @@ def TestClusterBurnin(): ...@@ -1112,7 +1112,7 @@ def TestClusterBurnin():
disks = qa_config.GetDiskOptions() disks = qa_config.GetDiskOptions()
# Run burnin # Run burnin
cmd = ["env", cmd = ["env",
"PYTHONPATH=%s" % _autoconf.VERSIONEDSHAREDIR, "PYTHONPATH=%s" % _constants.VERSIONEDSHAREDIR,
script, script,
"--os=%s" % qa_config.get("os"), "--os=%s" % qa_config.get("os"),
"--minmem-size=%s" % qa_config.get(constants.BE_MINMEM), "--minmem-size=%s" % qa_config.get(constants.BE_MINMEM),
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
""" """
from ganeti import _autoconf from ganeti import _constants
from ganeti import constants from ganeti import constants
import qa_config import qa_config
...@@ -32,7 +32,7 @@ from qa_utils import AssertCommand ...@@ -32,7 +32,7 @@ from qa_utils import AssertCommand
from qa_instance_utils import CreateInstanceByDiskTemplate, \ from qa_instance_utils import CreateInstanceByDiskTemplate, \
RemoveInstance RemoveInstance
MON_COLLECTOR = _autoconf.PKGLIBDIR + "/mon-collector" MON_COLLECTOR = _constants.PKGLIBDIR + "/mon-collector"
def TestInstStatusCollector(): def TestInstStatusCollector():
......
...@@ -28,23 +28,23 @@ err() { ...@@ -28,23 +28,23 @@ err() {
exit 1 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" err "Please update $0, confd enable feature is missing"
fi 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" err "Please update $0, mond enable feature is missing"
fi fi
DAEMONS_LIST="noded masterd rapi" DAEMONS_LIST="noded masterd rapi"
STOPDAEMONS_LIST="rapi masterd noded" 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" DAEMONS_LIST="$DAEMONS_LIST confd luxid"
STOPDAEMONS_LIST="luxid confd $STOPDAEMONS_LIST" STOPDAEMONS_LIST="luxid confd $STOPDAEMONS_LIST"
fi 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" DAEMONS_LIST="$DAEMONS_LIST mond"
STOPDAEMONS_LIST="mond $STOPDAEMONS_LIST" STOPDAEMONS_LIST="mond $STOPDAEMONS_LIST"
fi fi
......
...@@ -26,7 +26,7 @@ import re ...@@ -26,7 +26,7 @@ import re
import itertools import itertools
import operator import operator
from ganeti import _autoconf from ganeti import _constants
from ganeti import utils from ganeti import utils
from ganeti import cmdlib from ganeti import cmdlib
from ganeti import build from ganeti import build
...@@ -314,7 +314,7 @@ class TestManpages(unittest.TestCase): ...@@ -314,7 +314,7 @@ class TestManpages(unittest.TestCase):
return build.LoadModule("scripts/%s" % name) return build.LoadModule("scripts/%s" % name)
def test(self): def test(self):
for script in _autoconf.GNT_SCRIPTS: for script in _constants.GNT_SCRIPTS:
self._CheckManpage(script, self._CheckManpage(script,
self._ReadManFile(script), self._ReadManFile(script),
self._LoadScript(script).commands.keys()) self._LoadScript(script).commands.keys())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment