On Thu, Mar 19, 2015 at 05:19:40PM +0100, 'Helga Velroyen' via ganeti-devel
wrote:
This fixes a minor problem in LURenewCrypto, where we
use the exception variable after the try/except block.
By assigning it to a previously initialized one, we make
sure that we can access this information.
Signed-off-by: Helga Velroyen <[email protected]>
---
lib/cmdlib/cluster.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/cmdlib/cluster.py b/lib/cmdlib/cluster.py
index 0f4b2eb..30e35c4 100644
--- a/lib/cmdlib/cluster.py
+++ b/lib/cmdlib/cluster.py
@@ -131,6 +131,7 @@ class LUClusterRenewCrypto(NoHooksLU):
except IOError:
logging.info("No old certificate available.")
+ last_exception = None
for _ in range(self._MAX_NUM_RETRIES):
try:
# Technically it should not be necessary to set the cert
@@ -142,10 +143,11 @@ class LUClusterRenewCrypto(NoHooksLU):
client_cert_tmp=pathutils.NODED_CLIENT_CERT_FILE_TMP)
break
except errors.OpExecError as e:
- pass
+ last_exception = e
else:
- feedback_fn("Could not renew the master's client SSL certificate."
- " Cleaning up. Error: %s." % e)
+ if last_exception:
+ feedback_fn("Could not renew the master's client SSL certificate."
+ " Cleaning up. Error: %s." % last_exception)
# Cleaning up temporary certificates
utils.RemoveNodeFromCandidateCerts("%s-SERVER" % master_uuid,
cluster.candidate_certs)
@@ -164,6 +166,7 @@ class LUClusterRenewCrypto(NoHooksLU):
feedback_fn("* Skipping offline node %s" % node_info.name)
continue
if node_uuid != master_uuid:
+ last_exception = None
for _ in range(self._MAX_NUM_RETRIES):
try:
new_digest = CreateNewClientCert(self, node_uuid)
@@ -172,8 +175,8 @@ class LUClusterRenewCrypto(NoHooksLU):
new_digest,
cluster.candidate_certs)
break
- except errors.OpExecError as last_exception:
- pass
+ except errors.OpExecError as e:
+ last_exception = e
else:
if last_exception:
node_errors[node_uuid] = last_exception
--
2.2.0.rc0.207.ga3a616c
LGTM, thanks