I am trying to simplify adding some ETH_OPTS and basically what i need is some way so that when an interface has say bond0 as its bonding_master then add the following opts.
I can get that info with
#set eth0_opts = $getVar("bonding_master_eth0","") #set eth1_opts = $getVar("bonding_master_eth1","") #set eth2_opts = $getVar("bonding_master_eth2","") #set eth3_opts = $getVar("bonding_master_eth3","") #set eth4_opts = $getVar("bonding_master_eth4","") #set eth5_opts = $getVar("bonding_master_eth5","") #set eth6_opts = $getVar("bonding_master_eth6","") #if eth0_opts == "bond0" echo ETHTOOL_OPTS="speed 100 duplex full autoneg off" >> /etc/sysconfig/network-scripts/ifcfg-eth0 etc etc
however where there are multiple interfaces that have bond0 as the master this comes up short as it matches the first and then stops. How can i make the 'if' carry on through all the other interfaces, or is there a neater way to do this altogether ?
thanks
On Tue, 07 Jul 2009 12:18:01 +0100, Tom Brown tom@ng23.net wrote:
I am trying to simplify adding some ETH_OPTS and basically what i need is some way so that when an interface has say bond0 as its bonding_master then add the following opts.
I can get that info with
#set eth0_opts = $getVar("bonding_master_eth0","") #set eth1_opts = $getVar("bonding_master_eth1","") #set eth2_opts = $getVar("bonding_master_eth2","") #set eth3_opts = $getVar("bonding_master_eth3","") #set eth4_opts = $getVar("bonding_master_eth4","") #set eth5_opts = $getVar("bonding_master_eth5","") #set eth6_opts = $getVar("bonding_master_eth6","") #if eth0_opts == "bond0" echo ETHTOOL_OPTS="speed 100 duplex full autoneg off" >> /etc/sysconfig/network-scripts/ifcfg-eth0 etc etc
however where there are multiple interfaces that have bond0 as the master this comes up short as it matches the first and then stops. How can i make the 'if' carry on through all the other interfaces, or is there a neater way to do this altogether ?
thanks
You should be able to simply do this:
#if eth0_opts == "bond0" .... #end if #if eth1_opts == "bond0" .... #end if etc.
Just make every check it's own if/end if, and don't use #else.
Also, you may want to consider changing this to a for loop, as it would things less redundant.
You should be able to simply do this:
#if eth0_opts == "bond0" .... #end if #if eth1_opts == "bond0" .... #end if etc.
Just make every check it's own if/end if, and don't use #else.
Also, you may want to consider changing this to a for loop, as it would things less redundant.
thanks - making these individual if's did it, but i think its pretty messy but does the job for now!
On 07/07/2009 09:27 AM, Tom Brown wrote:
You should be able to simply do this:
#if eth0_opts == "bond0" .... #end if #if eth1_opts == "bond0" .... #end if etc.
Just make every check it's own if/end if, and don't use #else.
Also, you may want to consider changing this to a for loop, as it would things less redundant.
thanks - making these individual if's did it, but i think its pretty messy but does the job for now!
cobbler mailing list cobbler@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/cobbler
Though it's possible to do more with #for loops and getVar, is this the sign of something we don't have a flag for that we need one for?
i.e. what's the use case here?
--Michael
On Tue, 07 Jul 2009 11:11:20 -0400, Michael DeHaan mdehaan@redhat.com wrote:
On 07/07/2009 09:27 AM, Tom Brown wrote:
You should be able to simply do this:
#if eth0_opts == "bond0" .... #end if #if eth1_opts == "bond0" .... #end if etc.
Just make every check it's own if/end if, and don't use #else.
Also, you may want to consider changing this to a for loop, as it would things less redundant.
thanks - making these individual if's did it, but i think its pretty messy but does the job for now!
cobbler mailing list cobbler@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/cobbler
Though it's possible to do more with #for loops and getVar, is this the sign of something we don't have a flag for that we need one for?
i.e. what's the use case here?
--Michael
Yes, we should have an options field, since sometimes you need to set the speed/duplex manually, or set other options. For instance, at my last company the management switches were only 10/100 and didn't like the on-board gig links on the HP servers if you left it at auto detect.
I agree. I would expect there to be per interface fields to hold the speed and duplex settings.
On Tue, Jul 7, 2009 at 11:24 AM, James Cammarata jimi@sngx.net wrote:
On Tue, 07 Jul 2009 11:11:20 -0400, Michael DeHaan mdehaan@redhat.com wrote:
On 07/07/2009 09:27 AM, Tom Brown wrote:
You should be able to simply do this:
#if eth0_opts == "bond0" .... #end if #if eth1_opts == "bond0" .... #end if etc.
Just make every check it's own if/end if, and don't use #else.
Also, you may want to consider changing this to a for loop, as it would things less redundant.
thanks - making these individual if's did it, but i think its pretty messy but does the job for now!
cobbler mailing list cobbler@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/cobbler
Though it's possible to do more with #for loops and getVar, is this the sign of something we don't have a flag for that we need one for?
i.e. what's the use case here?
--Michael
Yes, we should have an options field, since sometimes you need to set the speed/duplex manually, or set other options. For instance, at my last company the management switches were only 10/100 and didn't like the on-board gig links on the HP servers if you left it at auto detect.
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
cobbler mailing list cobbler@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/cobbler
On 07/07/2009 12:03 PM, Jon Sabo wrote:
I agree. I would expect there to be per interface fields to hold the speed and duplex settings.
Can we get away with adding a generic field for options? If so we should do it.
I think this was talked about before, actually. (If so, all the more reason)
And then we tweak the network config snippets to "make it so" so folks don't need to figure out how to write the templating to make that happen.
--Michael
On Tue, Jul 7, 2009 at 11:24 AM, James Cammarata <jimi@sngx.net mailto:jimi@sngx.net> wrote:
On Tue, 07 Jul 2009 11:11:20 -0400, Michael DeHaan <mdehaan@redhat.com <mailto:mdehaan@redhat.com>> wrote: > On 07/07/2009 09:27 AM, Tom Brown wrote: >>> You should be able to simply do this: >>> >>> #if eth0_opts == "bond0" >>> .... >>> #end if >>> #if eth1_opts == "bond0" >>> .... >>> #end if >>> etc. >>> >>> Just make every check it's own if/end if, and don't use #else. >>> >>> Also, you may want to consider changing this to a for loop, as it would >>> things less redundant. >>> >>> >>> >> >> thanks - making these individual if's did it, but i think its pretty >> messy but does the job for now! >> >> _______________________________________________ >> cobbler mailing list >> cobbler@lists.fedorahosted.org <mailto:cobbler@lists.fedorahosted.org> >> https://fedorahosted.org/mailman/listinfo/cobbler >> > > Though it's possible to do more with #for loops and getVar, is this the > sign of something we don't have a flag for that we need one for? > > i.e. what's the use case here? > > --Michael Yes, we should have an options field, since sometimes you need to set the speed/duplex manually, or set other options. For instance, at my last company the management switches were only 10/100 and didn't like the on-board gig links on the HP servers if you left it at auto detect. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. _______________________________________________ cobbler mailing list cobbler@lists.fedorahosted.org <mailto:cobbler@lists.fedorahosted.org> https://fedorahosted.org/mailman/listinfo/cobbler
cobbler@lists.fedorahosted.org