From 49ceab21a2ac16eb6f4b8dedde5d94d1779d51b8 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 29 Nov 2010 19:25:54 +0100
Subject: [PATCH] QA: Fix upload of RAPI users file

After moving the users file to a directory, we must ensure the
directory exists.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 qa/qa_cluster.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py
index 596c5734d..dc5c79b38 100644
--- a/qa/qa_cluster.py
+++ b/qa/qa_cluster.py
@@ -24,6 +24,7 @@
 """
 
 import tempfile
+import os.path
 
 from ganeti import constants
 from ganeti import utils
@@ -56,6 +57,8 @@ def TestClusterInit(rapi_user, rapi_secret):
   """gnt-cluster init"""
   master = qa_config.GetMasterNode()
 
+  rapi_dir = os.path.dirname(constants.RAPI_USERS_FILE)
+
   # First create the RAPI credentials
   fh = tempfile.NamedTemporaryFile()
   try:
@@ -64,6 +67,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])
     finally:
       AssertCommand(["rm", "-f", tmpru])
-- 
GitLab