[PATCH] ctdb-scripts: Strip out virtual NIC information from iface name.

José A. Rivera jarrpa at samba.org
Sat Sep 26 06:16:27 UTC 2015


Well, I believe I've figured it out: The code in question wasn't working
because it was not present on the system I was testing on.

The @.* fix was indeed already a fix by you (Martin) in commit 87c5c96, 
but
that commit has only made it into 4.3 and 4.2.4, but is not present in 
my
currently installed version (4.2.3).

I'll see about getting things a bit more up to date. :)

Thanks!
--Jose

On 2015-09-25 00:04, Martin Schwenke wrote:
> Try adding "set -x" and "set +x" around the relevant code in the
> functions file. You can then extract the relevant "code" from the log
> and run it by hand to figure out what is happening...
> 
> peace & happiness,
> martin
> 
> 
> 
> 
> On 25 September 2015 4:05:24 PM "José A. Rivera" <jarrpa at samba.org> 
> wrote:
> 
>> Hey Martin,
>> 
>> I would think that the following line would have taken care of it as
>> well...
>> but it somehow didn't. :( That's the thing, I can't figure out why it
>> wouldn't. A brief CLI test in bash shows that the logic SHOULD work in
>> awk,
>> but for some reason I wasn't getting the names trimmed properly... 
>> hence
>> why
>> I wanted a bit more scrutiny on this.
>> 
>> Thanks!
>> --Jose
>> 
>> On 2015-09-24 16:05, Martin Schwenke wrote:
>>> Hi José,
>>> 
>>> On Thu, 24 Sep 2015 15:08:02 -0700, José A. Rivera <jarrpa at samba.org>
>>> wrote:
>>> 
>>>> A tiny fix to some scripting regex. It already has a +1 from gd, and
>>>> I've
>>>> already run a private autobuild against it, but we'd both like to 
>>>> have
>>>> at
>>>> least another pair of eyes on this to make sure it doesn't explode 
>>>> the
>>>> planet. :)
>>> 
>>> Isn't this already done by the line after the one you're changing?
>>> 
>>> -	    'NR == 1 { iface = $2; sub(":$", "", iface) ; \
>>> +	    'NR == 1 { iface = $2; sub("(@.*)?:$", "", iface) ; \
>>>  		       sub("@.*", "", iface) } \
>>> 
>>> I'm guessing that you're looking at this because you've seen a 
>>> problem,
>>> so I would like to understand why the existing code isn't working.
>>> 
>>> Using a single sub() to do the overall substitution (and dropping
>>> the following line) would be more compact (though not really
>>> necessary!) but I would want to check the portability of the regexp
>>> "(foo)?" syntax, since we've been bitten by awk portability issues
>>> before.  I think that it is part of the Extended Regular Expression
>>> syntax, which POSIX says is used by awk, so I think it is fine.
>>> 
>>> ... and, yeah, the ip command is hardly portable, so this requires
>>> Linux, but I want to make sure it is portable across awk versions
>>> (Debian tends to install mawk by default).  :-)
>>> 
>>> We have unit testcases
>>> (ctdb/tests/eventscripts/10.interface.monitor.01[78].sh) for this but
>>> they only use the stub ip implementation to try and test the VLAN
>>> case.  I'm not sure if the "ip add show to ..." output looks a bit
>>> different under lxc.
>>> 
>>> Thanks for any more info...  :-)
>>> 
>>> peace & happiness,
>>> martin



More information about the samba-technical mailing list