On Fri, Sep 16, 2016 at 06:17:48PM +0100, R.I.Pienaar wrote:
> 
> 
> ----- Original Message -----
> > From: "Christopher Wood" <christopher_w...@pobox.com>
> > To: "puppet-users" <puppet-users@googlegroups.com>
> > Sent: Friday, 16 September, 2016 19:10:23
> > Subject: [Puppet Users] notify resource different between 3 and 4?
> 
> > While trying to figure out the reduce function with notice/notify I happened
> > across this thing. It looks like an unquoted array in the notify resource's
> > message only appears as its first array item. Not sure if it's a bug.
> > 
> > I couldn't find any documentation to say if this was intended and I couldn't
> > really tell what the type was doing with the self.should bit. I am not 
> > actually
> > a programmer.
> > 
> > $ cat /tmp/xx.pp
> > $array = ["one", "two", "three"]
> > 
> > notify { 'notify one':
> >  message => "${array}",
> > }
> > 
> > notify { 'notify two':
> >  message => $array,
> > }
> > 
> 
> yes this is across all resource types, you cant pass a array to the namevar 
> and 
> produce many resources, you have to do so to the title

I thought both messages would have some variant of [one, two, three].

Also the namevar here is the name parameter.

But then things get even weirder when I try to do things with the namevar:

$ cat /tmp/y.pp
$array = ["one", "two", "three"]

notify { $array:
  message => $array,
}

$ puppet apply /tmp/y.pp
Notice: Compiled catalog for cwl.hostopia.com in environment production in 0.04 
seconds
Notice: one
Notice: /Stage[main]/Main/Notify[one]/message: defined 'message' as 'one'
Notice: one
Notice: /Stage[main]/Main/Notify[two]/message: defined 'message' as 'one'
Notice: one
Notice: /Stage[main]/Main/Notify[three]/message: defined 'message' as 'one'
Notice: Applied catalog in 0.08 seconds


But this seems like it might be more normal, but then breaks in a manner I did 
not expect:

$ cat /tmp/z.pp
$array = ["one", "two", "three"]

notify { $array:
  name => $array,
  message => $array,
}

$ puppet apply /tmp/z.pp
Error: Evaluation Error: Error while evaluating a Resource Statement, Cannot 
alias Notify[two] to [["one", "two", "three"]] at /tmp/z.pp:3; resource 
["Notify", "one", "two", "three"] already declared at /tmp/z.pp:3 at 
/tmp/z.pp:3:1 on node cwl

The namevar thing works as expected with a file. Feeling more like this is bug 
now.

$ cat /tmp/a.pp
$array = ["/tmp/one", "/tmp/two", "/tmp/three"]

file { $array:
  content =>  $array,
}

-- 
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/20160916173921.GA14646%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to