From 7a01081e73665858429ff57e1a1cebe6b142a93f Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Mon, 30 Jan 2017 15:48:23 +0100 Subject: [PATCH] NovaCompute: Use variable to avoid calling crudini a second time We don't need to run crudini twice to get the same config item; instead, just remember the result of the first time. Change-Id: I7591f5c7d1474447e29861e499d04b4b5bdb2a27 --- ocf/NovaCompute | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ocf/NovaCompute b/ocf/NovaCompute index f183cae..a90d6f4 100644 --- a/ocf/NovaCompute +++ b/ocf/NovaCompute @@ -323,6 +323,7 @@ nova_validate() { # we take a chance here and hope that host is either not configured # or configured in nova.conf + local validate_host=1 NOVA_HOST=$(crudini --get /etc/nova/nova.conf DEFAULT host 2>/dev/null) if [ $? = 1 ]; then if [ "x${OCF_RESKEY_domain}" != x ]; then @@ -330,11 +331,11 @@ nova_validate() { else NOVA_HOST=$(uname -n) fi + validate_host=0 fi # We only need to check a configured value, calculated ones are fine - crudini --get /etc/nova/nova.conf DEFAULT host 2>/dev/null - if [ $? = 0 ]; then + if [ $validate_host -eq 1 ]; then if [ "x${OCF_RESKEY_domain}" != x ]; then short_host=$(uname -n | awk -F. '{print $1}') if [ "x$NOVA_HOST" != "x${short_host}" ]; then