Fix exception not raised while install script failed

In kubernetes_mgmt, it will find 'Install Failed!\n' in stdout
to judge raise a exception of script install failed.

However in recent fix, we changed error message from script,
thus kubernetes_mgmt cannot catch error msg from stdout,
exception will not be raised.

This patch will fix matching error message in kuberntes_mgmt.

Closes-Bug: #1922192
Change-Id: Iffb3e045cbe121aca0fc74621cc5b3b5daf69f5b
This commit is contained in:
LiangLu committed 2021-04-08 15:26:33 +08:00
1 parent a6811d2c59
commit 206cc80e1f
3 files changed
+6 -12

No files matched your search

+2 -2
View File
@@ -765,7 +765,7 @@ fi
if [[ "$INSTALL_MODE" =~ "master" ]]; then
result=$(kubectl get nodes -o wide | grep $CURRENT_HOST_IP)
if [[ -z "$result" ]];then
echo "Install Failed! The node does not in Kubernetes cluster."
echo "Install Failed! The node does not exist in Kubernetes cluster."
exit 255
else
echo "Install Success!"
@@ -775,7 +775,7 @@ else
"This node has joined the cluster" ]]; then
echo "Install Success!"
else
echo "Install Failed! The node does not in Kubernetes cluster."
echo "Install Failed! The node does not exist in Kubernetes cluster."
exit 255
fi
fi
+2 -8
View File
@@ -97,17 +97,11 @@ class KubernetesMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
stdout = result.get_stdout()
LOG.debug(stdout)
LOG.debug(err)
elif type == 'certificate_key':
if '[upload-certs] Using certificate key:\n' not \
in result.get_stdout():
elif type == 'certificate_key' or type == 'install':
if result.get_return_code() != 0:
err = result.get_stderr()
LOG.error(err)
raise exceptions.MgmtDriverRemoteCommandError(err_info=err)
elif type == 'install':
err = result.get_stderr()
if 'Install Failed!\n' in result.get_stdout():
LOG.error(err)
raise exceptions.MgmtDriverRemoteCommandError(err_info=err)
return result.get_stdout()
def _create_vim(self, context, vnf_instance, server, bearer_token,
@@ -9,9 +9,9 @@ Content-Type: application/x-iso9066-image
Name: Scripts/install_k8s_cluster.sh
Content-Type: application/sh
Algorithm: SHA-256
Hash: 2489f6162817cce794a6f19a88c3c76ce83fa19cfcb75ad1204d76aaba4a9d1c
Hash: bc859fb8ffb9f92a19139553bdd077428a2c9572196e5844f1c912a7a822c249
Name: Scripts/kubernetes_mgmt.py
Content-Type: text/x-python
Algorithm: SHA-256
Hash: b292bc47d4c28a62b1261e6481498118e5dd93aa988c498568560f67c510003b
Hash: b8c558cad30f219634a668f84d6e04998949e941f3909b5c60374b84dff58545