Determine the job file path with qa_utils.MakeNodePath, so that we
get the correct path, even for vcluster.

Signed-off-by: Lisa Velden <[email protected]>
---
 qa/qa_instance.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/qa/qa_instance.py b/qa/qa_instance.py
index f0928c5..5773987 100644
--- a/qa/qa_instance.py
+++ b/qa/qa_instance.py
@@ -1517,7 +1517,7 @@ def TestInstanceCommunication(instance, master):
   print result_output
 
 
-def _TestRedactionOfSecretOsParams(cmd, secret_keys):
+def _TestRedactionOfSecretOsParams(node, cmd, secret_keys):
   """Tests redaction of secret os parameters
 
   """
@@ -1525,7 +1525,8 @@ def _TestRedactionOfSecretOsParams(cmd, secret_keys):
   debug_delay_id = int(stdout_of(["gnt-debug", "delay", "--print-jobid",
                        "--submit", "300"]))
   cmd_jid = int(stdout_of(cmd))
-  job_file = "/var/lib/ganeti/queue/job-%s" % cmd_jid
+  job_file_abspath = "%s/job-%s" % (pathutils.QUEUE_DIR, cmd_jid)
+  job_file = qa_utils.MakeNodePath(node, job_file_abspath)
 
   for k in secret_keys:
     grep_cmd = ["grep", "\"%s\":\"<redacted>\"" % k, job_file]
@@ -1558,7 +1559,7 @@ def TestInstanceAddOsParams():
   cmd.append("--print-jobid")
   cmd.append(instance.name)
 
-  _TestRedactionOfSecretOsParams(cmd, secret_keys)
+  _TestRedactionOfSecretOsParams(pnode.primary, cmd, secret_keys)
 
   TestInstanceRemove(instance)
   instance.Release()
@@ -1568,16 +1569,18 @@ def TestInstanceAddOsParams():
 def TestSecretOsParams():
   """Tests secret os parameter transmission"""
 
+  pnode = qa_config.AcquireNode()
   secret_keys = ["param1", "param2"]
   cmd = (["gnt-debug", "test-osparams", "--os-parameters-secret",
          "param1=secret1,param2=secret2", "--submit", "--print-jobid"])
-  _TestRedactionOfSecretOsParams(cmd, secret_keys)
+  _TestRedactionOfSecretOsParams(pnode.primary, cmd, secret_keys)
 
   cmd_output = stdout_of(["gnt-debug", "test-osparams",
                          "--os-parameters-secret",
                          "param1=secret1,param2=secret2"])
   AssertIn("\'param1\': \'secret1\'", cmd_output)
   AssertIn("\'param2\': \'secret2\'", cmd_output)
+  pnode.Release()
 
 
 available_instance_tests = [
-- 
2.4.3.573.g4eafbef

Reply via email to