SVN 3080: NIC Registration
-
I like it
-
Uncle Frank, cspence’s means no loops either!
-
[quote=“Tom Elliott, post: 43634, member: 7271”]Uncle Frank, cspence’s means no loops either![/quote]
Moments like these are why I love collaborating with others on code. Just a few suggestions and the code collapses to nothing.
-
[quote=“Uncle Frank, post: 43632, member: 28116”]
[CODE]… cat /sys/class/net/[^l][^o]*/address …[/CODE]
[/quote]What does that even mean?
I know DOS and VB, some Oracle… That stuff is so foreign I feel like it’s terrorist related lol -
lol
it means to cat all directories EXCEPT those with l, then o (or in this case lo) -
[quote=“Tom Elliott, post: 43634, member: 7271”]Uncle Frank, cspence’s means no loops either![/quote]
Ohhhhh yes, now I see! Shouldn’t work till very late as I seem to overlook things too often then…I’d vote for bash string manipulation…
[CODE]# Get All Active MAC Addresses
getMACAddresses()
{
macs=$(cat /sys/class/net/[^l][^o]*/address | tr ‘\n’ ‘|’)
echo -n ${macs%$‘|’}
}[/CODE]
Just make sure we use BASH (not SH) because the terrorist style (lol) shell glob does not work with SH… -
[quote=“Uncle Frank, post: 43632, member: 28116”]sed, grep, tr and all the rest are very nice but we don’t really need them here, do we?
[CODE]… cat /sys/class/net/[^l][^o]*/address …[/CODE]And still wondering about if ‘IFS’ is needed here. Sorry goto go now.[/quote]
Very usefull, I’ll use in my script !
-
I just gave SVN 3102 a shot. The new code does what it should, but only the first MAC is registered (no additional MACs are registered). I lucked out and had it register eth1 instead of eth0. That’s good for me, but maybe not for someone else.
I don’t fully understand the inventory.php execution yet, but it must be only grabbing the first MAC and discards the rest.
-
inventory.php doesn’t do the registering, only auto.register.php handles this. 3102 should work, but I don’t have multiple macs to test against either.
-
[quote=“Tom Elliott, post: 43684, member: 7271”]inventory.php doesn’t do the registering, only auto.register.php handles this. 3102 should work, but I don’t have multiple macs to test against either.[/quote]
Still figuring out where everything is going.
I was looking at fog.register, not fog.auto.reg. That would make sense! I’ll see if I can figure out what it is doing for you.