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
from ganeti import build
from ganeti import pathutils
-# _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
+from ganeti.tools import burnin
#: Regular expression describing desired format of option names. Long names can
#: contain lowercase characters, numbers and dashes only.
sw.IncIndent()
try:
# FIXME: this is really going into the internals of the job queue
- sw.Write(("local jlist=$( shopt -s nullglob &&"
- " cd %s 2>/dev/null && echo job-* || : )"),
+ sw.Write(("local jlist=($( shopt -s nullglob &&"
+ " cd %s 2>/dev/null && echo job-* || : ))"),
utils.ShellQuote(pathutils.QUEUE_DIR))
- sw.Write('echo "${jlist//job-/}"')
+ sw.Write('echo "${jlist[@]/job-/}"')
finally:
sw.DecIndent()
sw.Write("}")
WriteCompReply(sw, "-W \"$(_ganeti_instances)\"", cur=cur)
elif suggest == cli.OPT_COMPL_ONE_OS:
WriteCompReply(sw, "-W \"$(_ganeti_os)\"", cur=cur)
+ elif suggest == cli.OPT_COMPL_ONE_EXTSTORAGE:
+ WriteCompReply(sw, "-W \"$(_ganeti_extstorage)\"", cur=cur)
elif suggest == cli.OPT_COMPL_ONE_IALLOCATOR:
WriteCompReply(sw, "-W \"$(_ganeti_iallocator)\"", cur=cur)
elif suggest == cli.OPT_COMPL_ONE_NODEGROUP:
choices = "$(_ganeti_jobs)"
elif isinstance(arg, cli.ArgOs):
choices = "$(_ganeti_os)"
+ elif isinstance(arg, cli.ArgExtStorage):
+ choices = "$(_ganeti_extstorage)"
elif isinstance(arg, cli.ArgFile):
choices = ""
compgenargs.append("-f")
"""
if htools:
- cmd = "./htools/htools"
+ cmd = "./src/htools"
env = {"HTOOLS": script}
script_name = script
func_name = "htools_%s" % script
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,
build.LoadModule(filename)))
# Burnin script
- burnin = build.LoadModule("tools/burnin")
WriteCompletion(sw, "%s/burnin" % pathutils.TOOLSDIR, "_ganeti_burnin",
debug,
opts=burnin.OPTIONS, args=burnin.ARGUMENTS)
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:
- WriteHaskellCompletion(sw, "htools/ganeti-confd", htools=False,
+ if _constants.ENABLE_CONFD:
+ WriteHaskellCompletion(sw, "src/ganeti-confd", htools=False,
debug=debug)
# mon-collector, if monitoring is enabled
- if _autoconf.ENABLE_MONITORING:
- WriteHaskellCmdCompletion(sw, "htools/mon-collector", debug=debug)
+ if _constants.ENABLE_MOND:
+ WriteHaskellCmdCompletion(sw, "src/mon-collector", debug=debug)
# Reset extglob to original value
sw.Write("[[ -n \"$gnt_shopt_extglob\" ]] && $gnt_shopt_extglob")