Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -61,12 +61,24 @@ def TestClusterInit(rapi_user, rapi_secret): ...@@ -61,12 +61,24 @@ def TestClusterInit(rapi_user, rapi_secret):
master = qa_config.GetMasterNode() master = qa_config.GetMasterNode()
# First create the RAPI credentials # First create the RAPI credentials
cred_string = "%s %s write" % (rapi_user, rapi_secret) fh = tempfile.NamedTemporaryFile()
cmd = ("echo %s > %s" % try:
(utils.ShellQuote(cred_string), fh.write("%s %s write\n" % (rapi_user, rapi_secret))
utils.ShellQuote(constants.RAPI_USERS_FILE))) fh.flush()
AssertEqual(StartSSH(master['primary'], cmd).wait(), 0)
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'] cmd = ['gnt-cluster', 'init']
if master.get('secondary', None): if master.get('secondary', None):
......
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