Re: [cobbler] Use ip instead of ifconfig
On 17.10.2012 [17:05:47 -0500], James Cammarata wrote: > On Wed, Oct 17, 2012 at 4:57 PM, Orion Poplawski wrote: > > On 10/17/2012 03:50 PM, Nishanth Aravamudan wrote: > >> > >> On 15.10.2012 [11:22:27 -0600], Orion Poplawski wrote: > >>> > >>> Fedora 18 doesn't have ifconfig in the installer (and perhaps not in > >>> installed system), need to use ip. > >> > >> > >> Did you ensure this works as expected on older Fedora too? Is it better > >> to use ifconfig when present (as it's tested) and switch to ip only when > >> ifconfig isn't there? > > > > > > I have not tested on older Fedora, but you're using ip already to set the > > route, so it is present. And ip on RHEL5 has the -o option, so I think > > shifting to ip is the way to go. It's easier to parse. > > The ip command has been around for a while, I've used it as early RHEL > 4, so this change should work for just about any distro. Fair enough, mostly just wondered what the testing coverage was. Thanks! -Nish ___ cobbler mailing list cobbler@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/cobbler
Re: [cobbler] Use ip instead of ifconfig
On 10/17/2012 03:39 PM, James Cammarata wrote: On Mon, Oct 15, 2012 at 12:22 PM, Orion Poplawski wrote: Fedora 18 doesn't have ifconfig in the installer (and perhaps not in installed system), need to use ip. What branch did you create this against? It did not apply to master. Can you rebase this against master and resend it? How is this? -- Orion Poplawski Technical Manager 303-415-9701 x222 NWRA, Boulder Office FAX: 303-415-9702 3380 Mitchell Lane or...@nwra.com Boulder, CO 80301 http://www.nwra.com >From 2bd6f98128a06fe7f38048d579c43e81314c1b64 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 17 Oct 2012 17:12:59 -0600 Subject: [PATCH] Use ip instead of ifconfig --- snippets/post_install_network_config | 5 + snippets/pre_install_network_config | 7 ++- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/snippets/post_install_network_config b/snippets/post_install_network_config index d21d6e2..363f4f2 100644 --- a/snippets/post_install_network_config +++ b/snippets/post_install_network_config @@ -142,10 +142,7 @@ echo "ONBOOT=yes" >> $devfile #if $mac != "" and $iface_type not in ("master","bond","bridge","bonded_bridge_slave") ## virtual interfaces don't get MACs echo "HWADDR=$mac" >> $devfile -IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d ' ' -f 1) -if [ -z \$IFNAME ]; then -IFNAME=\$(ifconfig -a | grep -i -B 2 '$mac' | sed -n '/flags/s/:.*$//p') -fi +IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//') ## Rename this interface in modprobe.conf ## FIXME: if both interfaces startwith eth this is wrong if [ -f "/etc/modprobe.conf" ] && [ \$IFNAME ]; then diff --git a/snippets/pre_install_network_config b/snippets/pre_install_network_config index 5425f54..b158069 100644 --- a/snippets/pre_install_network_config +++ b/snippets/pre_install_network_config @@ -86,12 +86,9 @@ #set $netinfo = "%s --hostname=%s" % ($netinfo, $hostname) #end if # Configuring $iname ($mac) -if ifconfig -a | grep -i $mac +if ip link | grep -i $mac then - IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d " " -f 1) - if [ -z \$IFNAME ]; then -IFNAME=\$(ifconfig -a | grep -i -B 2 '$mac' | sed -n '/flags/s/:.*$//p') - fi + IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//') echo "network --device=\$IFNAME $netinfo" >> /tmp/pre_install_network_config #for $route in $static_routes #if $routepattern.match($route) -- 1.7.11.7 ___ cobbler mailing list cobbler@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/cobbler
Re: [cobbler] Use ip instead of ifconfig
On 10/17/2012 06:05 PM, James Cammarata wrote: On Wed, Oct 17, 2012 at 4:57 PM, Orion Poplawski wrote: On 10/17/2012 03:50 PM, Nishanth Aravamudan wrote: On 15.10.2012 [11:22:27 -0600], Orion Poplawski wrote: Fedora 18 doesn't have ifconfig in the installer (and perhaps not in installed system), need to use ip. Did you ensure this works as expected on older Fedora too? Is it better to use ifconfig when present (as it's tested) and switch to ip only when ifconfig isn't there? I have not tested on older Fedora, but you're using ip already to set the route, so it is present. And ip on RHEL5 has the -o option, so I think shifting to ip is the way to go. It's easier to parse. The ip command has been around for a while, I've used it as early RHEL 4, so this change should work for just about any distro. Did you use it in the installer? post_install_network_config snippet is run on installed system in chrooted environment, so it should not be a problem. However, pre_install_network_config is run inside of anaconda - we want to make sure it is available there for the versions that cobbler supports. Leon ___ cobbler mailing list cobbler@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/cobbler
Re: [cobbler] Use ip instead of ifconfig
On Wed, Oct 17, 2012 at 4:57 PM, Orion Poplawski wrote: > On 10/17/2012 03:50 PM, Nishanth Aravamudan wrote: >> >> On 15.10.2012 [11:22:27 -0600], Orion Poplawski wrote: >>> >>> Fedora 18 doesn't have ifconfig in the installer (and perhaps not in >>> installed system), need to use ip. >> >> >> Did you ensure this works as expected on older Fedora too? Is it better >> to use ifconfig when present (as it's tested) and switch to ip only when >> ifconfig isn't there? > > > I have not tested on older Fedora, but you're using ip already to set the > route, so it is present. And ip on RHEL5 has the -o option, so I think > shifting to ip is the way to go. It's easier to parse. The ip command has been around for a while, I've used it as early RHEL 4, so this change should work for just about any distro. ___ cobbler mailing list cobbler@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/cobbler
Re: [cobbler] Use ip instead of ifconfig
On 10/17/2012 03:50 PM, Nishanth Aravamudan wrote: On 15.10.2012 [11:22:27 -0600], Orion Poplawski wrote: Fedora 18 doesn't have ifconfig in the installer (and perhaps not in installed system), need to use ip. Did you ensure this works as expected on older Fedora too? Is it better to use ifconfig when present (as it's tested) and switch to ip only when ifconfig isn't there? I have not tested on older Fedora, but you're using ip already to set the route, so it is present. And ip on RHEL5 has the -o option, so I think shifting to ip is the way to go. It's easier to parse. -- Orion Poplawski Technical Manager 303-415-9701 x222 NWRA, Boulder Office FAX: 303-415-9702 3380 Mitchell Lane or...@nwra.com Boulder, CO 80301 http://www.nwra.com From a5fb8831b0370cc363d8b293c67935901ac85062 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Mon, 15 Oct 2012 11:14:54 -0600 Subject: [PATCH] Up ip instead of ifconfig --- snippets/post_install_network_config | 2 +- snippets/pre_install_network_config | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/post_install_network_config b/snippets/post_install_network_config index 6821c6f..4acd4b8 100644 --- a/snippets/post_install_network_config +++ b/snippets/post_install_network_config @@ -138,7 +138,7 @@ echo "ONBOOT=yes" >> $devfile #if $mac != "" and $iface_type not in ("master","bond","bridge") ## virtual interfaces don't get MACs echo "HWADDR=$mac" >> $devfile -IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d ' ' -f 1) +IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//') ## Rename this interface in modprobe.conf ## FIXME: if both interfaces startwith eth this is wrong if [ -f "/etc/modprobe.conf" ] && [ \$IFNAME ]; then diff --git a/snippets/pre_install_network_config b/snippets/pre_install_network_config index 8bb3495..10c5405 100644 --- a/snippets/pre_install_network_config +++ b/snippets/pre_install_network_config @@ -76,9 +76,9 @@ #set $netinfo = "%s --hostname=%s" % ($netinfo, $hostname) #end if # Configuring $iname ($mac) -if ifconfig -a | grep -i $mac +if ip link | grep -i $mac then - IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d " " -f 1) + IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//') echo "network --device=\$IFNAME $netinfo" >> /tmp/pre_install_network_config #for $route in $static_routes #if $routepattern.match($route) -- 1.7.11.7 ___ cobbler mailing list cobbler@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/cobbler -- Orion Poplawski Technical Manager 303-415-9701 x222 NWRA, Boulder Office FAX: 303-415-9702 3380 Mitchell Lane or...@nwra.com Boulder, CO 80301 http://www.nwra.com ___ cobbler mailing list cobbler@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/cobbler
Re: [cobbler] Use ip instead of ifconfig
On 10/17/2012 03:50 PM, Nishanth Aravamudan wrote: On 15.10.2012 [11:22:27 -0600], Orion Poplawski wrote: Fedora 18 doesn't have ifconfig in the installer (and perhaps not in installed system), need to use ip. Did you ensure this works as expected on older Fedora too? Is it better to use ifconfig when present (as it's tested) and switch to ip only when ifconfig isn't there? Actually, I've been installing EL6 with it, so it should work with any older Fedora as well. -- Orion Poplawski Technical Manager 303-415-9701 x222 NWRA, Boulder Office FAX: 303-415-9702 3380 Mitchell Lane or...@nwra.com Boulder, CO 80301 http://www.nwra.com ___ cobbler mailing list cobbler@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/cobbler
Re: [cobbler] Use ip instead of ifconfig
On 15.10.2012 [11:22:27 -0600], Orion Poplawski wrote: > Fedora 18 doesn't have ifconfig in the installer (and perhaps not in > installed system), need to use ip. Did you ensure this works as expected on older Fedora too? Is it better to use ifconfig when present (as it's tested) and switch to ip only when ifconfig isn't there? Thanks, Nish > > -- > Orion Poplawski > Technical Manager 303-415-9701 x222 > NWRA, Boulder Office FAX: 303-415-9702 > 3380 Mitchell Lane or...@nwra.com > Boulder, CO 80301 http://www.nwra.com > From a5fb8831b0370cc363d8b293c67935901ac85062 Mon Sep 17 00:00:00 2001 > From: Orion Poplawski > Date: Mon, 15 Oct 2012 11:14:54 -0600 > Subject: [PATCH] Up ip instead of ifconfig > > --- > snippets/post_install_network_config | 2 +- > snippets/pre_install_network_config | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/snippets/post_install_network_config > b/snippets/post_install_network_config > index 6821c6f..4acd4b8 100644 > --- a/snippets/post_install_network_config > +++ b/snippets/post_install_network_config > @@ -138,7 +138,7 @@ echo "ONBOOT=yes" >> $devfile > #if $mac != "" and $iface_type not in ("master","bond","bridge") > ## virtual interfaces don't get MACs > echo "HWADDR=$mac" >> $devfile > -IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d ' ' -f 1) > +IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//') > ## Rename this interface in modprobe.conf > ## FIXME: if both interfaces startwith eth this is wrong > if [ -f "/etc/modprobe.conf" ] && [ \$IFNAME ]; then > diff --git a/snippets/pre_install_network_config > b/snippets/pre_install_network_config > index 8bb3495..10c5405 100644 > --- a/snippets/pre_install_network_config > +++ b/snippets/pre_install_network_config > @@ -76,9 +76,9 @@ > #set $netinfo = "%s --hostname=%s" % ($netinfo, $hostname) > #end if > # Configuring $iname ($mac) > -if ifconfig -a | grep -i $mac > +if ip link | grep -i $mac > then > - IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d " " -f 1) > + IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e > 's/:.*//') >echo "network --device=\$IFNAME $netinfo" >> > /tmp/pre_install_network_config > #for $route in $static_routes > #if $routepattern.match($route) > -- > 1.7.11.7 > > ___ > cobbler mailing list > cobbler@lists.fedorahosted.org > https://lists.fedorahosted.org/mailman/listinfo/cobbler ___ cobbler mailing list cobbler@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/cobbler
Re: [cobbler] Use ip instead of ifconfig
On Mon, Oct 15, 2012 at 12:22 PM, Orion Poplawski wrote: > Fedora 18 doesn't have ifconfig in the installer (and perhaps not in > installed system), need to use ip. What branch did you create this against? It did not apply to master. Can you rebase this against master and resend it? ___ cobbler mailing list cobbler@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/cobbler