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
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
......
......@@ -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")
......
......@@ -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"
......
......@@ -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
......
......@@ -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),
......
......@@ -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():
......
......@@ -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
......
......@@ -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())
......
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