Perry Myers
2008-Sep-21 06:50 UTC
[Ovirt-devel] [PATCH appliance] Handle errors for contacting host for local VM management better
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 at 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 -- 1.5.5.1
Jim Meyering
2008-Sep-21 11:35 UTC
[Ovirt-devel] [PATCH appliance] Handle errors for contacting host for local VM management better
Perry Myers <pmyers at 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 at 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 DHCPThat looks fine. However, you can get the same effect, while saving a subshell with {...;} in place of (...). ACK either way.
Chris Lalancette
2008-Sep-22 06:12 UTC
[Ovirt-devel] [PATCH appliance] Handle errors for contacting host for local VM management better
Perry Myers 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.I'm totally fine with doing the additional error checking, so ACK to that. I'm just curious as to how this causes cobbler setup to fail? I didn't think that an error earlier in rc.local caused later rc.local commands to fail? -- Chris Lalancette