I always calculate network addresses on clients, using the ipcalc command.
I don't know if it is possible in your case.

Regards,
El 19/05/2014 09:22, "Michael Wörz" <[email protected]> escribió:

> no, thanks split works now,
> but the boolean operator
>
> $ok1=$iparray[0] and $nmarray[0]
>
> returns true inetad of 10
>
>
> $ip="10.122.3.177"
> $nm="255.255.255.128"
> $iparray=split($ip, '[.]')
> $nmarray=split($ip, '[.]')
>
> $ok1=$iparray[0] and $nmarray[0]
> notify {"$ok1":}
>
>
>
>
> Am Montag, 19. Mai 2014 09:08:16 UTC+2 schrieb Joaquin Menchaca:
>>
>> Did you escape the meta character of dot?
>>
>> $octets = split($ip, '[.]')
>>
>>
>>
>> On Monday, May 19, 2014 12:01:48 AM UTC-7, Michael Wörz wrote:
>>>
>>> Hello folks
>>>
>>> i need a bit of help calculating the network address from ip an netmask
>>> avoiding the use of stdlib within a puppet maifest.
>>>
>>> #given IP address and netmask
>>> $ip="10.122.3.177"
>>> $nm="255.255.255.128"
>>>
>>> #splitting into octets -  split() didnt work for some reason
>>> if $ip =~ /([0-9]+)\.[0-9]+\.[0-9]+\.[0-9]+/ {$ip1 = $1} #  same for
>>> $ip2 = $2  .......
>>> if $nm =~ /([0-9]+)\.[0-9]+\.[0-9]+\.[0-9]+/ {$nm1 = $1}
>>>
>>> # apply boolean AND
>>> $oc1=$ip1 && $nm1
>>> ##### Could not parse for environment production: Could not match && at
>>> .......
>>>
>>>
>>> notify {"$oc1":}
>>>
>>> thanks for your help
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/bca3ec21-0338-4f2f-b423-eb79d2300359%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/bca3ec21-0338-4f2f-b423-eb79d2300359%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAF_B3dehTpKQtkyR88kj4dmnONORiqdpHQZ-KjdBXEzM9txrWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to