Commit 304d9f02 authored by Michael Hanselmann's avatar Michael Hanselmann

Migrate qa/*.py 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 3329f4de
......@@ -29,6 +29,7 @@ import os.path
from ganeti import constants
from ganeti import compat
from ganeti import utils
from ganeti import pathutils
import qa_config
import qa_utils
......@@ -76,7 +77,7 @@ def TestClusterInit(rapi_user, rapi_secret):
"""gnt-cluster init"""
master = qa_config.GetMasterNode()
rapi_dir = os.path.dirname(constants.RAPI_USERS_FILE)
rapi_dir = os.path.dirname(pathutils.RAPI_USERS_FILE)
# First create the RAPI credentials
fh = tempfile.NamedTemporaryFile()
......@@ -87,7 +88,7 @@ def TestClusterInit(rapi_user, rapi_secret):
tmpru = qa_utils.UploadFile(master["primary"], fh.name)
try:
AssertCommand(["mkdir", "-p", rapi_dir])
AssertCommand(["mv", tmpru, constants.RAPI_USERS_FILE])
AssertCommand(["mv", tmpru, pathutils.RAPI_USERS_FILE])
finally:
AssertCommand(["rm", "-f", tmpru])
finally:
......@@ -361,7 +362,7 @@ def TestClusterRenewCrypto():
AssertCommand(cmd, fail=True)
rapi_cert_backup = qa_utils.BackupFile(master["primary"],
constants.RAPI_CERT_FILE)
pathutils.RAPI_CERT_FILE)
try:
# Custom RAPI certificate
fh = tempfile.NamedTemporaryFile()
......@@ -475,7 +476,7 @@ def TestClusterMasterFailover():
def TestClusterMasterFailoverWithDrainedQueue():
"""gnt-cluster master-failover with drained queue"""
drain_check = ["test", "-f", constants.JOB_QUEUE_DRAIN_FILE]
drain_check = ["test", "-f", pathutils.JOB_QUEUE_DRAIN_FILE]
master = qa_config.GetMasterNode()
failovermaster = qa_config.AcquireNode(exclude=master)
......@@ -485,7 +486,7 @@ def TestClusterMasterFailoverWithDrainedQueue():
AssertCommand(drain_check, node=node, fail=True)
# Drain queue on failover master
AssertCommand(["touch", constants.JOB_QUEUE_DRAIN_FILE], node=failovermaster)
AssertCommand(["touch", pathutils.JOB_QUEUE_DRAIN_FILE], node=failovermaster)
cmd = ["gnt-cluster", "master-failover"]
try:
......
......@@ -26,7 +26,7 @@
import time
from ganeti import utils
from ganeti import constants
from ganeti import pathutils
import qa_config
import qa_utils
......@@ -67,7 +67,7 @@ def _ResetWatcherDaemon():
"""
AssertCommand([
"bash", "-c",
"rm -vf %s" % (constants.WATCHER_GROUP_STATE_FILE % "*-*-*-*")
"rm -vf %s" % (pathutils.WATCHER_GROUP_STATE_FILE % "*-*-*-*")
])
......
......@@ -29,6 +29,7 @@ import time
from ganeti import utils
from ganeti import constants
from ganeti import query
from ganeti import pathutils
import qa_config
import qa_utils
......@@ -208,7 +209,7 @@ def _ReadSsconfInstanceList():
"""
master = qa_config.GetMasterNode()
cmd = ["cat", utils.PathJoin(constants.DATA_DIR,
cmd = ["cat", utils.PathJoin(pathutils.DATA_DIR,
"ssconf_%s" % constants.SS_INSTANCE_LIST)]
return qa_utils.GetCommandOutput(master["primary"],
......@@ -542,7 +543,7 @@ def TestInstanceImport(newinst, node, expnode, name):
"--disk-template=plain",
"--no-ip-check",
"--src-node=%s" % expnode["primary"],
"--src-dir=%s/%s" % (constants.EXPORT_DIR, name),
"--src-dir=%s/%s" % (pathutils.EXPORT_DIR, name),
"--node=%s" % node["primary"]] +
_GetGenericAddParameters(newinst, force_mac=constants.VALUE_GENERATE))
cmd.append(newinst["name"])
......
......@@ -28,6 +28,7 @@ import os.path
from ganeti import utils
from ganeti import constants
from ganeti import pathutils
import qa_config
import qa_utils
......@@ -37,7 +38,7 @@ from qa_utils import AssertCommand, AssertIn, AssertNotIn
_TEMP_OS_NAME = "TEMP-Ganeti-QA-OS"
_TEMP_OS_PATH = os.path.join(constants.OS_SEARCH_PATH[0], _TEMP_OS_NAME)
_TEMP_OS_PATH = os.path.join(pathutils.OS_SEARCH_PATH[0], _TEMP_OS_NAME)
(_ALL_VALID,
_ALL_INVALID,
......
......@@ -37,6 +37,7 @@ from ganeti import objects
from ganeti import query
from ganeti import compat
from ganeti import qlang
from ganeti import pathutils
import ganeti.rapi.client # pylint: disable=W0611
import ganeti.rapi.client_utils
......@@ -72,7 +73,7 @@ def Setup(username, password):
master = qa_config.GetMasterNode()
# Load RAPI certificate from master node
cmd = ["cat", constants.RAPI_CERT_FILE]
cmd = ["cat", pathutils.RAPI_CERT_FILE]
# Write to temporary file
_rapi_ca = tempfile.NamedTemporaryFile()
......
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