Re: [Puppet Users] Puppet4 $facts syntax

2017-03-10 Thread Poil

@all, thanks :)

Le 10/03/2017 à 14:10, R.I.Pienaar a écrit :


On Fri, Mar 10, 2017, at 14:06, Dirk Heinrichs wrote:

Am 10.03.2017 um 14:02 schrieb R.I.Pienaar:


the first is just wrong

OTOH, I mostly use $::facts['fact_name'].

this is not needed.

The reason you use $::foo is because of the problem here:

   $foo = "top"
   class x($foo="class") {
 notice($foo)
 notice($::foo)
   }

   include x

this produce:

Notice: Scope(Class[X]): class
Notice: Scope(Class[X]): top

you need to guard against the accidental $foo which used to be much
worse with dynamic scope, so the code got littered with all this ::
rubbish.

$facts is globally reserved

   class x {
 $facts = {}
   }

   include x

Error: Evaluation Error: Error while evaluating a '=' expression,
Attempt to assign to a reserved variable name: 'facts'

You can never cause the problem that raised the need for $::facts to
exist, you can just use $facts and it's all sweet and

In general with Puppet 4 the needs for all the :: stuff is almost all
gone



--
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/d9f72063-37a3-9cbd-679d-161e8ab9e90e%40quake.fr.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Puppet4 $facts syntax

2017-03-10 Thread Dirk Heinrichs
On 10.03.2017 14:10, R.I.Pienaar wrote:

> You can never cause the problem that raised the need for $::facts to
> exist, you can just use $facts and it's all sweet and
> In general with Puppet 4 the needs for all the :: stuff is almost all gone

Ah, good to know. Thanks for clarifying.

Bye...

Dirk
-- 
*Dirk Heinrichs*
Senior Systems Engineer, Delivery Pipeline
OpenText^TM Discovery | Recommind
*Email*: dirk.heinri...@recommind.com 
*Website*: www.recommind.de 

Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach

Vertretungsberechtigte Geschäftsführer John Marshall Doolittle, Gordon
Davies, Roger Illing, Registergericht Amtsgericht Bonn, Registernummer
HRB 10646

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser Mail sind nicht gestattet.

-- 
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/5c563e06-4b4b-32b5-1c44-c6aad00980eb%40opentext.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Puppet4 $facts syntax

2017-03-10 Thread R.I.Pienaar


On Fri, Mar 10, 2017, at 14:06, Dirk Heinrichs wrote:
> Am 10.03.2017 um 14:02 schrieb R.I.Pienaar:
> 
> > the first is just wrong
> 
> OTOH, I mostly use $::facts['fact_name'].

this is not needed.

The reason you use $::foo is because of the problem here:

  $foo = "top"
  class x($foo="class") { 
notice($foo)
notice($::foo)
  }

  include x

this produce:

Notice: Scope(Class[X]): class
Notice: Scope(Class[X]): top

you need to guard against the accidental $foo which used to be much
worse with dynamic scope, so the code got littered with all this ::
rubbish.

$facts is globally reserved

  class x {
$facts = {}
  }

  include x

Error: Evaluation Error: Error while evaluating a '=' expression,
Attempt to assign to a reserved variable name: 'facts'

You can never cause the problem that raised the need for $::facts to
exist, you can just use $facts and it's all sweet and

In general with Puppet 4 the needs for all the :: stuff is almost all
gone

-- 
R.I.Pienaar / www.devco.net / @ripienaar

-- 
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/1489151425.3162917.906957512.5D8D0563%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Puppet4 $facts syntax

2017-03-10 Thread Dirk Heinrichs
Am 10.03.2017 um 14:02 schrieb R.I.Pienaar:

> the first is just wrong

OTOH, I mostly use $::facts['fact_name'].

Bye...

Dirk
-- 
*Dirk Heinrichs*
Senior Systems Engineer, Delivery Pipeline
OpenText^TM Discovery | Recommind
*Email*: dirk.heinri...@recommind.com 
*Website*: www.recommind.de 

Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach

Vertretungsberechtigte Geschäftsführer John Marshall Doolittle, Gordon
Davies, Roger Illing, Registergericht Amtsgericht Bonn, Registernummer
HRB 10646

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser Mail sind nicht gestattet.

-- 
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/e972e522-387f-bbc4-1c01-e3dc2feb0e8e%40opentext.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Puppet4 $facts syntax

2017-03-10 Thread R.I.Pienaar


On Fri, Mar 10, 2017, at 13:05, Poil wrote:
> Hi,
> 
> In the style guide we have $facts[::operatingsystem]
> 
> In all others documentation we have $facts['fact_name']
> 
> So which one is the good one ? Do we really need to scope inside 
> $facts[::scope] 

Easily answered:

  % puppet apply -e 'notice($facts[::operatingsystem])'
  Notice: Scope(Class[main]):

vs:

  % puppet apply -e 'notice($facts["operatingsystem"])'
  Notice: Scope(Class[main]): CentOS

the first is just wrong

-- 
R.I.Pienaar / www.devco.net / @ripienaar

-- 
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/1489150932.3161020.906949560.3F04C32B%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppet4 $facts syntax

2017-03-10 Thread Poil

Hi,

In the style guide we have $facts[::operatingsystem]

In all others documentation we have $facts['fact_name']

So which one is the good one ? Do we really need to scope inside 
$facts[::scope] ?


Best regards,

--
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/a36da126-c413-0487-2bd6-e978e3f70ca3%40quake.fr.
For more options, visit https://groups.google.com/d/optout.