From 6f764d91194472e31c95b6768d6fe148fec46d69 Mon Sep 17 00:00:00 2001
From: Dan Prince <dprince@redhat.com>
Date: Thu, 27 Mar 2014 10:47:55 -0400
Subject: [PATCH] dhcp-all-interfaces: correct ifquery return stmt

Corrects an issue in the config_exists function that could
cause duplicate interfaces to be configured on Ubuntu.

Previously we used 'return ifquery' directly which caused
a silent 'numberic argument required' error to go unnoticed.
This would also return 1 meaning a new interface would get
configured.

The new logic should handle things properly.

Change-Id: I625225e15113d7e184e3bcb5054df1616dec008a
Closes-bug: #1298430
---
 .../dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh     | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh b/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh
index dcfc4e745..f2b7184bd 100755
--- a/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh
+++ b/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh
@@ -58,12 +58,11 @@ function config_exists() {
     if [ "$CONF_TYPE" == "netscripts" ]; then
         if [ -f "/etc/sysconfig/network-scripts/ifcfg-$interface" ]; then
             return 0
-        else
-            return 1
         fi
     else
-        return ifquery $interface >/dev/null 2>&1
+        ifquery $interface >/dev/null 2>&1 && return 0
     fi
+    return 1
 }
 
 function inspect_interface() {