[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Ovirt-devel] [PATCH appliance] Handle errors for contacting host for local VM management better



Jim Meyering wrote:
Perry Myers <pmyers redhat com> wrote:
Old rc.local snipped could possibly error out and cause cobbler setup to fail.
This revised section always makes this section of code successful even if
the local host is not setup as an ovirt-node.

Signed-off-by: Perry Myers <pmyers redhat com>
---
 ovirt-appliance.ks |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks
index 3de32fb..ebaaba2 100644
--- a/ovirt-appliance.ks
+++ b/ovirt-appliance.ks
@@ -41,10 +41,8 @@ lokkit
   cat >> /etc/rc.d/rc.local << \EOF
 # Try to contact the host we are running on; if we succeed, we'll use it as
 # one of the managed nodes; if not, no big deal
-exec 3<> /dev/tcp/192.168.50.1/7777
-echo "AWAKE" 1>&3
-exec 3<> /dev/tcp/192.168.50.1/7777
-echo "IDENTIFY" 1>&3
+(exec 3<> /dev/tcp/192.168.50.1/7777 && echo "AWAKE" 1>&3 \
+      && exec 3<> /dev/tcp/192.168.50.1/7777 && echo "IDENTIFY" 1>&3) || :
 EOF

   # make sure to update the /etc/hosts with the list of all possible DHCP

That looks fine.
However, you can get the same effect, while saving a subshell
with {...;} in place of (...).

I always forget that... :)  I'll switch to {} before pushing

Perry

ACK either way.

--
|=-        Red Hat, Engineering, Emerging Technologies, Boston        -=|
|=-                     Email: pmyers redhat com                      -=|
|=-         Office: +1 412 474 3552   Mobile: +1 703 362 9622         -=|
|=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]