thanks for the tip, i tried and the notify outputs correct information (i.e
the ipv6_addr_cidr variable value) even if put next to the file resource.
But still no content in my template.

I've been looking up scoping but as far as I've found there is no special
scoping in if statements, or conditionals of any kind. But i might have
missed something (clearly I have).

//Adam

On Sun, May 17, 2015 at 7:18 PM, Felix Frank <
felix.fr...@alumni.tu-berlin.de> wrote:

>  Hi,
>
> can you move the notify next to the file resource instead of the variable
> declaration?
>
> It seems most likely that there is some kind of scoping issue.
>
> HTH,
> Felix
>
>
> On 05/16/2015 07:46 PM, Adam Winberg wrote:
>
>  Hi,
>
>  trying to populate an ifcfg template (network config) with ipv6 config,
> but cant get one of my variables to show. The one I want to use is
> "$ipv6_addr_cidr", but it just doesnt work, when my template is created the
> variable is not defined. I can see the 'notify' which I put right after
> defining $ipv6_addr_cidr, so I know I havent lost myself in my if
> statements. I have other variables in my network.pp (not shown below bc of
> snippet) which works.
>
>  What am i doing wrong? Suspect it's something trivial, but I just cant
> see it. Help would be really appreciated.
>
>
> ---------------------------------------
>  network.pp (snippet)
>
>    ################
>   # IPv6 stuff
>   ################
>   if str2bool($ipv6_enabled) {
>
>     # Get the fourth octet from the node’s IPv4 address:
>     $i4 = regsubst($ip,'^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)$','\4')
>
>     # Set ipv6 address space
>     case $::network_eth0 {
>       "172.31.28.0":  { $ipv6_space = "2001:67c:274:XXXX" }
>       "172.31.24.0":  { $ipv6_space = "2001:67c:274:XXYY" }
>       default:        { $ipv6_space = "undef" }
>     }
>
>     if $ipv6_space != "undef" {
>       # Construct ipv6 address
>       $ipv6_addr = "${ipv6_space}::${i4}"
>
>        # Add network to address string, used in ifcfg template later
>         $ipv6_addr_cidr = "${ipv6_addr}/64"
>         notify { "ipv6 addr: $ipv6_addr_cidr":}
>     }
>
>   }
>   ################
>   # END IPv6 stuff
>   ################
>
>     file { "ifcfg-$device":
>       path    => "$cfgdir/ifcfg-$device",
>       owner   => root,
>       group   => root,
>       mode    => 644,
>       ensure  => present,
>       content => $ifcfg_template,
>     }
>
> ---------------------------------------
>
>  ifcfg.erb
> <% if @ipv6_addr_cidr -%>
> #IPV6ADDR <%= @ipv6_addr_cidr %>
> <% end -%>
>
>  ---------------------------------------
>
>  The results of above code is just:
> #IPV6ADDR
>
>  but no variable value.
>
>  Regards,
>  Adam
>
>  --
> 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 puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/5558CD5B.2090600%40Alumni.TU-Berlin.de
> <https://groups.google.com/d/msgid/puppet-users/5558CD5B.2090600%40Alumni.TU-Berlin.de?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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAFCL3HtUUu9R3gajjsEWJaP4m_kHGft8ZrWv_4URk%2Be1tos%3Dvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to