Including missing RST files in packaging
[ganeti-local] / autotools / build-bash-completion
index 26ec52b..63def12 100755 (executable)
@@ -39,6 +39,8 @@ from ganeti import utils
 from ganeti import build
 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
@@ -103,10 +105,10 @@ def WritePreamble(sw, support_debug):
   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("}")
@@ -357,6 +359,8 @@ class CompletionWriter:
           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:
@@ -467,6 +471,8 @@ class CompletionWriter:
           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")
@@ -755,7 +761,7 @@ def WriteHaskellCompletion(sw, script, htools=True, debug=True):
 
   """
   if htools:
-    cmd = "./htools/htools"
+    cmd = "./src/htools"
     env = {"HTOOLS": script}
     script_name = script
     func_name = "htools_%s" % script
@@ -834,7 +840,6 @@ def main():
                                          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)
@@ -850,9 +855,13 @@ def main():
 
   # ganeti-confd, if enabled
   if _autoconf.ENABLE_CONFD:
-    WriteHaskellCompletion(sw, "htools/ganeti-confd", htools=False,
+    WriteHaskellCompletion(sw, "src/ganeti-confd", htools=False,
                            debug=debug)
 
+  # mon-collector, if monitoring is enabled
+  if _autoconf.ENABLE_MOND:
+    WriteHaskellCmdCompletion(sw, "src/mon-collector", debug=debug)
+
   # Reset extglob to original value
   sw.Write("[[ -n \"$gnt_shopt_extglob\" ]] && $gnt_shopt_extglob")
   sw.Write("unset gnt_shopt_extglob")