Commit a62d1901 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

qa: Use qa_utils.UploadFile to upload rapi_users file



Just using “echo” would use whatever umask is set in the shell,
in addition to potentially showing the password in the process
list.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 747c9ca9
......@@ -61,12 +61,24 @@ def TestClusterInit(rapi_user, rapi_secret):
master = qa_config.GetMasterNode()
# First create the RAPI credentials
cred_string = "%s %s write" % (rapi_user, rapi_secret)
cmd = ("echo %s > %s" %
(utils.ShellQuote(cred_string),
utils.ShellQuote(constants.RAPI_USERS_FILE)))
AssertEqual(StartSSH(master['primary'], cmd).wait(), 0)
fh = tempfile.NamedTemporaryFile()
try:
fh.write("%s %s write\n" % (rapi_user, rapi_secret))
fh.flush()
tmpru = qa_utils.UploadFile(master["primary"], fh.name)
try:
cmd = ["mv", tmpru, constants.RAPI_USERS_FILE]
AssertEqual(StartSSH(master["primary"],
utils.ShellQuoteArgs(cmd)).wait(), 0)
finally:
cmd = ["rm", "-f", tmpru]
AssertEqual(StartSSH(master["primary"],
utils.ShellQuoteArgs(cmd)).wait(), 0)
finally:
fh.close()
# Initialize cluster
cmd = ['gnt-cluster', 'init']
if master.get('secondary', None):
......
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