From 502f523635c9a270c266a2434c101eb6368f19ed Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Mon, 10 May 2010 17:21:45 +0200 Subject: [PATCH] =?UTF-8?q?QA:=20Restore=20RAPI=20cert=20after=20=E2=80=9C?= =?UTF-8?q?gnt-cluster=20renew-crypto=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The RAPI tests will depend on the certificate. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- qa/qa_cluster.py | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py index 09782e5c9..7e74ff9c5 100644 --- a/qa/qa_cluster.py +++ b/qa/qa_cluster.py @@ -182,32 +182,45 @@ def TestClusterRenewCrypto(): AssertNotEqual(StartSSH(master["primary"], utils.ShellQuoteArgs(cmd)).wait(), 0) - # Custom RAPI certificate - fh = tempfile.NamedTemporaryFile() + rapi_cert_backup = qa_utils.BackupFile(master["primary"], + constants.RAPI_CERT_FILE) + try: + # Custom RAPI certificate + fh = tempfile.NamedTemporaryFile() - # Ensure certificate doesn't cause "gnt-cluster verify" to complain - validity = constants.SSL_CERT_EXPIRATION_WARN * 3 + # Ensure certificate doesn't cause "gnt-cluster verify" to complain + validity = constants.SSL_CERT_EXPIRATION_WARN * 3 - bootstrap.GenerateSelfSignedSslCert(fh.name, validity=validity) + bootstrap.GenerateSelfSignedSslCert(fh.name, validity=validity) - tmpcert = qa_utils.UploadFile(master["primary"], fh.name) - try: + tmpcert = qa_utils.UploadFile(master["primary"], fh.name) + try: + cmd = ["gnt-cluster", "renew-crypto", "--force", + "--rapi-certificate=%s" % tmpcert] + AssertEqual(StartSSH(master["primary"], + utils.ShellQuoteArgs(cmd)).wait(), 0) + finally: + cmd = ["rm", "-f", tmpcert] + AssertEqual(StartSSH(master["primary"], + utils.ShellQuoteArgs(cmd)).wait(), 0) + + # Normal case + cmd = ["gnt-cluster", "renew-crypto", "--force", + "--new-cluster-certificate", "--new-confd-hmac-key", + "--new-rapi-certificate"] + AssertEqual(StartSSH(master["primary"], + utils.ShellQuoteArgs(cmd)).wait(), 0) + + # Restore RAPI certificate cmd = ["gnt-cluster", "renew-crypto", "--force", - "--rapi-certificate=%s" % tmpcert] + "--rapi-certificate=%s" % rapi_cert_backup] AssertEqual(StartSSH(master["primary"], utils.ShellQuoteArgs(cmd)).wait(), 0) finally: - cmd = ["rm", "-f", tmpcert] + cmd = ["rm", "-f", rapi_cert_backup] AssertEqual(StartSSH(master["primary"], utils.ShellQuoteArgs(cmd)).wait(), 0) - # Normal case - cmd = ["gnt-cluster", "renew-crypto", "--force", - "--new-cluster-certificate", "--new-confd-hmac-key", - "--new-rapi-certificate"] - AssertEqual(StartSSH(master["primary"], - utils.ShellQuoteArgs(cmd)).wait(), 0) - def TestClusterBurnin(): """Burnin""" -- GitLab