Skip to content
Snippets Groups Projects
Commit 13718ded authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Migrate build-bash-completion from constants to pathutils


File system paths moved from constants to pathutils.

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 304d9f02
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ from ganeti import constants ...@@ -35,6 +35,7 @@ from ganeti import constants
from ganeti import cli from ganeti import cli
from ganeti import utils from ganeti import utils
from ganeti import build from ganeti import build
from ganeti import pathutils
# _autoconf shouldn't be imported from anywhere except constants.py, but we're # _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. # making an exception here because this script is only used at build time.
...@@ -79,7 +80,7 @@ def WritePreamble(sw): ...@@ -79,7 +80,7 @@ def WritePreamble(sw):
sw.Write("_ganeti_nodes() {") sw.Write("_ganeti_nodes() {")
sw.IncIndent() sw.IncIndent()
try: try:
node_list_path = os.path.join(constants.DATA_DIR, "ssconf_node_list") node_list_path = os.path.join(pathutils.DATA_DIR, "ssconf_node_list")
sw.Write("cat %s 2>/dev/null || :", utils.ShellQuote(node_list_path)) sw.Write("cat %s 2>/dev/null || :", utils.ShellQuote(node_list_path))
finally: finally:
sw.DecIndent() sw.DecIndent()
...@@ -88,7 +89,7 @@ def WritePreamble(sw): ...@@ -88,7 +89,7 @@ def WritePreamble(sw):
sw.Write("_ganeti_instances() {") sw.Write("_ganeti_instances() {")
sw.IncIndent() sw.IncIndent()
try: try:
instance_list_path = os.path.join(constants.DATA_DIR, instance_list_path = os.path.join(pathutils.DATA_DIR,
"ssconf_instance_list") "ssconf_instance_list")
sw.Write("cat %s 2>/dev/null || :", utils.ShellQuote(instance_list_path)) sw.Write("cat %s 2>/dev/null || :", utils.ShellQuote(instance_list_path))
finally: finally:
...@@ -101,14 +102,14 @@ def WritePreamble(sw): ...@@ -101,14 +102,14 @@ def WritePreamble(sw):
# FIXME: this is really going into the internals of the job queue # FIXME: this is really going into the internals of the job queue
sw.Write(("local jlist=$( shopt -s nullglob &&" sw.Write(("local jlist=$( shopt -s nullglob &&"
" cd %s 2>/dev/null && echo job-* || : )"), " cd %s 2>/dev/null && echo job-* || : )"),
utils.ShellQuote(constants.QUEUE_DIR)) utils.ShellQuote(pathutils.QUEUE_DIR))
sw.Write('echo "${jlist//job-/}"') sw.Write('echo "${jlist//job-/}"')
finally: finally:
sw.DecIndent() sw.DecIndent()
sw.Write("}") sw.Write("}")
for (fnname, paths) in [ for (fnname, paths) in [
("os", constants.OS_SEARCH_PATH), ("os", pathutils.OS_SEARCH_PATH),
("iallocator", constants.IALLOCATOR_SEARCH_PATH), ("iallocator", constants.IALLOCATOR_SEARCH_PATH),
]: ]:
sw.Write("_ganeti_%s() {", fnname) sw.Write("_ganeti_%s() {", fnname)
...@@ -125,7 +126,7 @@ def WritePreamble(sw): ...@@ -125,7 +126,7 @@ def WritePreamble(sw):
sw.Write("_ganeti_nodegroup() {") sw.Write("_ganeti_nodegroup() {")
sw.IncIndent() sw.IncIndent()
try: try:
nodegroups_path = os.path.join(constants.DATA_DIR, "ssconf_nodegroups") nodegroups_path = os.path.join(pathutils.DATA_DIR, "ssconf_nodegroups")
sw.Write("cat %s 2>/dev/null || :", utils.ShellQuote(nodegroups_path)) sw.Write("cat %s 2>/dev/null || :", utils.ShellQuote(nodegroups_path))
finally: finally:
sw.DecIndent() sw.DecIndent()
...@@ -635,7 +636,7 @@ def main(): ...@@ -635,7 +636,7 @@ def main():
# Burnin script # Burnin script
burnin = build.LoadModule("tools/burnin") burnin = build.LoadModule("tools/burnin")
WriteCompletion(sw, "%s/burnin" % constants.TOOLSDIR, "_ganeti_burnin", WriteCompletion(sw, "%s/burnin" % pathutils.TOOLSDIR, "_ganeti_burnin",
opts=burnin.OPTIONS, args=burnin.ARGUMENTS) opts=burnin.OPTIONS, args=burnin.ARGUMENTS)
print buf.getvalue() print buf.getvalue()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment