Re: [Puppet Users] notify resource different between 3 and 4?

2016-09-16 Thread Christopher Wood
On Fri, Sep 16, 2016 at 06:44:36PM +0100, R.I.Pienaar wrote:
> 
> 
> - Original Message -
> > From: "Christopher Wood" 
> > To: "puppet-users" 
> > Sent: Friday, 16 September, 2016 19:39:21
> > Subject: Re: [Puppet Users] notify resource different between 3 and 4?
> 
> > On Fri, Sep 16, 2016 at 06:17:48PM +0100, R.I.Pienaar wrote:
> >> 
> >> 
> >> - Original Message -
> >> > From: "Christopher Wood" 
> >> > To: "puppet-users" 
> >> > 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
> 
> kind of expected, or just undefined, message should be a string don't give it 
> a array.
> but you can see the names got created as per the array so that seems fine to 
> me, if anything
> I think it should raise when you pass non string to message
> 
> 
> > 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
> 
> yeah you cant pass arrays to name either - this is the main change here, you 
> used to be able to.
> It *is* though creating notify[one] notify[two] etc but then fail because of 
> passing things
> into name you shouldnt :)
> 
> > 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,
> > }
> 
> it doesnt really, content isnt the namevar. you're passing a array to title 
> thats fine, content
> being an array it's probably just going to puts the array into the file as a 
> string
> 
> This stuff seems to work though errors can be a LOT better and I think it 
> should be more strict
> on the type of things passed to String properties like message

I think I see what you mean, each file just had "/tmp/three" in it anyway. I 
don't think I would have encountered this if I hadn't been slapping in a quick 
notify to see what my reduced array had in it.

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


Re: [Puppet Users] notify resource different between 3 and 4?

2016-09-16 Thread R.I.Pienaar


- Original Message -
> From: "Christopher Wood" 
> To: "puppet-users" 
> Sent: Friday, 16 September, 2016 19:39:21
> Subject: Re: [Puppet Users] notify resource different between 3 and 4?

> On Fri, Sep 16, 2016 at 06:17:48PM +0100, R.I.Pienaar wrote:
>> 
>> 
>> - Original Message -
>> > From: "Christopher Wood" 
>> > To: "puppet-users" 
>> > 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

kind of expected, or just undefined, message should be a string don't give it a 
array.
but you can see the names got created as per the array so that seems fine to 
me, if anything
I think it should raise when you pass non string to message


> 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

yeah you cant pass arrays to name either - this is the main change here, you 
used to be able to.
It *is* though creating notify[one] notify[two] etc but then fail because of 
passing things
into name you shouldnt :)

> 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,
> }

it doesnt really, content isnt the namevar. you're passing a array to title 
thats fine, content
being an array it's probably just going to puts the array into the file as a 
string

This stuff seems to work though errors can be a LOT better and I think it 
should be more strict
on the type of things passed to String properties like message

-- 
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/31059471.611617.1474047876604.JavaMail.zimbra%40devco.net.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] notify resource different between 3 and 4?

2016-09-16 Thread Christopher Wood
On Fri, Sep 16, 2016 at 06:17:48PM +0100, R.I.Pienaar wrote:
> 
> 
> - Original Message -
> > From: "Christopher Wood" 
> > To: "puppet-users" 
> > 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.


Re: [Puppet Users] notify resource different between 3 and 4?

2016-09-16 Thread R.I.Pienaar


- Original Message -
> From: "Christopher Wood" 
> To: "puppet-users" 
> 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

-- 
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/403108144.592797.1474046268142.JavaMail.zimbra%40devco.net.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] notify resource different between 3 and 4?

2016-09-16 Thread Christopher Wood
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,
}

With puppet 3 I see this:

$ puppet --version
3.8.7
$ puppet apply /tmp/xx.pp
Fact file /etc/facter/facts.d/monit_fail_count was parsed but returned an empty 
data set
Fact file /etc/facter/facts.d/monit_fail_count was parsed but returned an empty 
data set
Notice: Compiled catalog for mail82c40.carrierzone.com in environment 
production in 0.03 seconds
Notice: one
Notice: /Stage[main]/Main/Notify[notify two]/message: defined 'message' as 'one'
Notice: onetwothree
Notice: /Stage[main]/Main/Notify[notify one]/message: defined 'message' as 
'onetwothree'
Notice: Finished catalog run in 0.05 seconds

With puppet 4 I see this:

$ puppet --version
4.6.2
$ puppet apply /tmp/xx.pp
Notice: Compiled catalog for cwl.hostopia.com in environment production in 0.09 
seconds
Notice: [one, two, three]
Notice: /Stage[main]/Main/Notify[notify one]/message: defined 'message' as 
'[one, two, three]'
Notice: one
Notice: /Stage[main]/Main/Notify[notify two]/message: defined 'message' as 'one'
Notice: Applied catalog in 0.11 seconds

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