Re: [Puppet Users] [Error after after upgrading to 3.7] Evaluation Error: Illegal Resource Type expression, expected result to be a type name, or untitled Resource, got Type[Class]

2014-09-19 Thread Henrik Lindberg

On 2014-17-09 17:37, jcbollinger wrote:



On Tuesday, September 16, 2014 12:26:24 PM UTC-5, Juan Sierra Pons wrote:

Hi guys,

 From your comments I see that there are 2 issues here the parser and
the anchor. For clarity shake I have deleted the anchor resources and
Class defaults as I don't fully understand the purpose of if they have
meaning on my environment, even after reading the link you provided.
After this all the manifest seem to behave as before.

My puppet.conf working configuration with 3.6 was like this:

[...]
parser   = future
evaluator   = current
[...]



Please be aware that the future parser is basically a beta / technology
preview.  It is not guaranteed to be consistent even between minor
Puppet versions, and I really wouldn't recommend enabling it on
production systems.

I needed the parser and the evaluator set like this to get some piece
of code from the [1] terrarum blog to work:



If the terrarun examples you linked to earlier are characteristic of
that blog's technical quality, then I am not very impressed.  If they
are recommending using the future parser without warning you about the
implications then I am not impressed at all.

$trusted_networks = hiera_array('trusted_networks')
$trusted_networks.each |$network| {
   firewall { 003 allow all traffic from ${network}:
 proto  = 'all',
 source = $network,
 action = 'accept',
   }
}


The error in question is not coming from this part of the code afaict, 
and it looks ok to me.


below, it is shown that the error is from:
/etc/puppet/environments/production/modules/postgresql/manifests/server/database.pp:73:3

Where there must be a construct that the new more strict validator does 
not like. The error is about non productive expression which means 
that expressions without side effects that are placed in a sequence are 
no longer allowed because they are typically the result of typos or 
having written something that is believed to have a particular meaning, 
but it does not.


Suggest reporting the issue against the postgresql module.



The future parser does make things like that easier, which is a big part
of why it's being developed, but they are not impossible with Puppet 3's
default parser.  The old-school way to perform code that particular bit
of configuration would go something like this:

some.pp:

# ...
$trusted_networks = hiera_array('trusted_networks')
my_module::trusted_network_firewall { $trusted_networks: }
# ...

modules/my_module/manifests/trusted_network_firewall.pp

define my_module::trusted_network_firewall () {
   some_module::firewall { 003 allow all traffic from ${title}:
 proto  = 'all',
 source = $title,
 action = 'accept',
   }
}


On the other side I have comment out the parser and evaluator lines
because they are giving  problems with other modules too:

Error: Could not retrieve catalog from remote server: Error 400 on
SERVER: This Type-Name is not productive. A non productive construct
may only be placed last in a block/sequence at

/etc/puppet/environments/production/modules/postgresql/manifests/server/database.pp:73:3

on node server.example.com http://server.example.com

So as far as I know my systems is as it was with 3.6 but the
trusted_networks are not being applied as they need the parser =
future.



Henrik would know for sure, but if your code worked in 3.6 (with the
future parser) but broke in 3.7 (still with the future parser) then it
seems reasonable to attribute that to changes in the future parser.
Certainly the error message you first reported points that direction.
As I already said, the future parser should not be assumed stable.  (You
should be able to rely on its stability once it is released as the
standard parser in Puppet 4, however.)



One change in 3.7 is that the evaluator = current has no effect, it is 
now using both the new parser and the new evaluator when --parser future 
is used. This is done because the old evaluator will go away in 4.0 and 
we want to ensure that the new evaluator gets exposure to the real world.


- henrik



John

--
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
mailto:puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/81617cfc-5c2f-4bf0-8e86-6f116ec251d1%40googlegroups.com
https://groups.google.com/d/msgid/puppet-users/81617cfc-5c2f-4bf0-8e86-6f116ec251d1%40googlegroups..com?utm_medium=emailutm_source=footer.
For more options, visit https://groups.google.com/d/optout.



--

Visit my Blog Puppet on the Edge
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups Puppet 
Users 

Re: [Puppet Users] [Error after after upgrading to 3.7] Evaluation Error: Illegal Resource Type expression, expected result to be a type name, or untitled Resource, got Type[Class]

2014-09-17 Thread jcbollinger


On Tuesday, September 16, 2014 12:26:24 PM UTC-5, Juan Sierra Pons wrote:

 Hi guys, 

 From your comments I see that there are 2 issues here the parser and 
 the anchor. For clarity shake I have deleted the anchor resources and 
 Class defaults as I don't fully understand the purpose of if they have 
 meaning on my environment, even after reading the link you provided. 
 After this all the manifest seem to behave as before. 

 My puppet.conf working configuration with 3.6 was like this: 

 [...] 
 parser   = future 
 evaluator   = current 
 [...] 



Please be aware that the future parser is basically a beta / technology 
preview.  It is not guaranteed to be consistent even between minor Puppet 
versions, and I really wouldn't recommend enabling it on production systems.

 

 I needed the parser and the evaluator set like this to get some piece 
 of code from the [1] terrarum blog to work: 



If the terrarun examples you linked to earlier are characteristic of that 
blog's technical quality, then I am not very impressed.  If they are 
recommending using the future parser without warning you about the 
implications then I am not impressed at all.

 

 $trusted_networks = hiera_array('trusted_networks') 
 $trusted_networks.each |$network| { 
   firewall { 003 allow all traffic from ${network}: 
 proto  = 'all', 
 source = $network, 
 action = 'accept', 
   } 
 } 



The future parser does make things like that easier, which is a big part of 
why it's being developed, but they are not impossible with Puppet 3's 
default parser.  The old-school way to perform code that particular bit of 
configuration would go something like this:

some.pp:

# ...
$trusted_networks = hiera_array('trusted_networks') 
my_module::trusted_network_firewall { $trusted_networks: }
# ...

modules/my_module/manifests/trusted_network_firewall.pp

define my_module::trusted_network_firewall () {
  some_module::firewall { 003 allow all traffic from ${title}: 
proto  = 'all', 
source = $title, 
action = 'accept', 
  } 
} 


 

 On the other side I have comment out the parser and evaluator lines 
 because they are giving  problems with other modules too: 

 Error: Could not retrieve catalog from remote server: Error 400 on 
 SERVER: This Type-Name is not productive. A non productive construct 
 may only be placed last in a block/sequence at 
 /etc/puppet/environments/production/modules/postgresql/manifests/server/database.pp:73:3
  

 on node server.example.com 

 So as far as I know my systems is as it was with 3.6 but the 
 trusted_networks are not being applied as they need the parser = 
 future. 



Henrik would know for sure, but if your code worked in 3.6 (with the future 
parser) but broke in 3.7 (still with the future parser) then it seems 
reasonable to attribute that to changes in the future parser.  Certainly 
the error message you first reported points that direction.  As I already 
said, the future parser should not be assumed stable.  (You should be able 
to rely on its stability once it is released as the standard parser in 
Puppet 4, however.)


John

-- 
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/81617cfc-5c2f-4bf0-8e86-6f116ec251d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] [Error after after upgrading to 3.7] Evaluation Error: Illegal Resource Type expression, expected result to be a type name, or untitled Resource, got Type[Class]

2014-09-16 Thread Juan Sierra Pons
Hi guys,

From your comments I see that there are 2 issues here the parser and
the anchor. For clarity shake I have deleted the anchor resources and
Class defaults as I don't fully understand the purpose of if they have
meaning on my environment, even after reading the link you provided.
After this all the manifest seem to behave as before.

My puppet.conf working configuration with 3.6 was like this:

[...]
parser   = future
evaluator   = current
[...]

I needed the parser and the evaluator set like this to get some piece
of code from the [1] terrarum blog to work:

$trusted_networks = hiera_array('trusted_networks')
$trusted_networks.each |$network| {
  firewall { 003 allow all traffic from ${network}:
proto  = 'all',
source = $network,
action = 'accept',
  }
}

On the other side I have comment out the parser and evaluator lines
because they are giving  problems with other modules too:

Error: Could not retrieve catalog from remote server: Error 400 on
SERVER: This Type-Name is not productive. A non productive construct
may only be placed last in a block/sequence at
/etc/puppet/environments/production/modules/postgresql/manifests/server/database.pp:73:3
on node server.example.com

So as far as I know my systems is as it was with 3.6 but the
trusted_networks are not being applied as they need the parser =
future.

Thank your for your time

Best regards

[1] http://terrarum.net/blog/puppet-infrastructure.html
--
Juan Sierra Pons j...@elsotanillo.net
Linux User Registered: #257202
Web: http://www.elsotanillo.net Git: http://www.github.com/juasiepo
GPG key = 0xA110F4FE
Key Fingerprint = DF53 7415 0936 244E 9B00  6E66 E934 3406 A110 F4FE
--


2014-09-15 17:32 GMT+02:00 jcbollinger john.bollin...@stjude.org:


 On Monday, September 15, 2014 9:23:08 AM UTC-5, Henrik Lindberg wrote:

 On 2014-12-09 14:57, Juan Sierra Pons wrote:
  Hi,
 
  I am using a mix of the following two blog post:
 
  [1] A modern Puppet Master from scratch
 
  [2] Puppet Infrastructure
 
  After upgrading to 3.7 I am getting the following error message
 
  Error: Could not retrieve catalog from remote server: Error 400 on
  SERVER: Evaluation Error: Illegal Resource Type expression, expected
  result to be a type name, or untitled Resource, got Type[Class] at
  /etc/puppet/environments/production/site/profiles/manifests/base.pp:5:3
  on node server3.example.com
  Warning: Not using cache on failed catalog
  Error: Could not retrieve catalog; skipping run
 
  With 3.6 it worked like a charm.
 



 In the sense that catalogs were compiled without error, perhaps.  The
 example does not perform proper containment, however: to do containment with
 Anchor resources you need two per containing class, one to serve as a lower
 bound and another to serve as an upper bound (see Henrik's link).  The
 example code and the terrarun tutorial on which it is based miss the latter,
 leaving no containment whatever.  You could just delete the anchor resources
 and Class defaults without meaningfully changing the semantics of the
 manifests.

 Furthermore, using resource defaults for this purpose is tricky and prone to
 failure because the default is ignored for any class that is declared with
 its own specific require parameter.



  From the error message, I think you are using the future parser.
 Did you use the future parser on 3.6 as well?

  The base.pp is like this:
 
  class profiles::base {
  anchor { 'profiles::base': }
 Class { require = Anchor['profiles::base'] }
 users { users: }
  }
 

 It looks like your intention is to set the default for every class in
 the entire system to have a require of Anchor['profiles::base']. Is that
 true, or are you trying to achieve something else?



 Remember that resource defaults are dynamically scoped.  The code is trying
 to make every class declared by the given profile class have have the Anchor
 as a require.  The model on which it is based proposes that several of these
 classes might be declared, all chained together.  I think the idea is that
 they could thereby get away with only one anchor apiece, but that doesn't
 work.  For example, Puppet could choose to apply all the (non-class)
 resources declared directly by the profile classes first, including the
 anchors, and then all the other classes in any order.



 Read more about containment here:
 https://docs.puppetlabs.com/puppet/latest/reference/lang_containment.html



 +1


 I observe also that Puppet has suffered for years from confusion among
 users, among developers, in documentation, and even in code about whether
 (or in what sense) classes are resources.  Starting with the introduction of
 parameterized classes, there was a push -- largely originating at PL, I
 think -- to cast the class as just another resource 

Re: [Puppet Users] [Error after after upgrading to 3.7] Evaluation Error: Illegal Resource Type expression, expected result to be a type name, or untitled Resource, got Type[Class]

2014-09-15 Thread Henrik Lindberg

On 2014-12-09 14:57, Juan Sierra Pons wrote:

Hi,

I am using a mix of the following two blog post:

[1] A modern Puppet Master from scratch

[2] Puppet Infrastructure

After upgrading to 3.7 I am getting the following error message

Error: Could not retrieve catalog from remote server: Error 400 on
SERVER: Evaluation Error: Illegal Resource Type expression, expected
result to be a type name, or untitled Resource, got Type[Class] at
/etc/puppet/environments/production/site/profiles/manifests/base.pp:5:3
on node server3.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

With 3.6 it worked like a charm.


From the error message, I think you are using the future parser.
Did you use the future parser on 3.6 as well?


The base.pp is like this:

class profiles::base {
anchor { 'profiles::base': }
   Class { require = Anchor['profiles::base'] }
   users { users: }
}



It looks like your intention is to set the default for every class in 
the entire system to have a require of Anchor['profiles::base']. Is that 
true, or are you trying to achieve something else?


Read more about containment here: 
https://docs.puppetlabs.com/puppet/latest/reference/lang_containment.html


- henrik

--

Visit my Blog Puppet on the Edge
http://puppet-on-the-edge.blogspot.se/

--
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/lv6sn3%242mk%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] [Error after after upgrading to 3.7] Evaluation Error: Illegal Resource Type expression, expected result to be a type name, or untitled Resource, got Type[Class]

2014-09-15 Thread jcbollinger


On Monday, September 15, 2014 9:23:08 AM UTC-5, Henrik Lindberg wrote:

 On 2014-12-09 14:57, Juan Sierra Pons wrote: 
  Hi, 
  
  I am using a mix of the following two blog post: 
  
  [1] A modern Puppet Master from scratch 
  
  [2] Puppet Infrastructure 
  
  After upgrading to 3.7 I am getting the following error message 
  
  Error: Could not retrieve catalog from remote server: Error 400 on 
  SERVER: Evaluation Error: Illegal Resource Type expression, expected 
  result to be a type name, or untitled Resource, got Type[Class] at 
  /etc/puppet/environments/production/site/profiles/manifests/base.pp:5:3 
  on node server3.example.com 
  Warning: Not using cache on failed catalog 
  Error: Could not retrieve catalog; skipping run 
  
  With 3.6 it worked like a charm. 
  



In the sense that catalogs were compiled without error, perhaps.  The 
example does not perform proper containment, however: to do containment 
with Anchor resources you need *two* per containing class, one to serve as 
a lower bound and another to serve as an upper bound (see Henrik's link).  
The example code and the terrarun tutorial on which it is based miss the 
latter, leaving no containment whatever.  You could just delete the anchor 
resources and Class defaults without meaningfully changing the semantics of 
the manifests.

Furthermore, using resource defaults for this purpose is tricky and prone 
to failure because the default is ignored for any class that is declared 
with its own specific require parameter.

 

  From the error message, I think you are using the future parser. 
 Did you use the future parser on 3.6 as well? 

  The base.pp is like this: 
  
  class profiles::base { 
  anchor { 'profiles::base': } 
 Class { require = Anchor['profiles::base'] } 
 users { users: } 
  } 
  

 It looks like your intention is to set the default for every class in 
 the entire system to have a require of Anchor['profiles::base']. Is that 
 true, or are you trying to achieve something else? 



Remember that resource defaults are dynamically scoped.  The code is trying 
to make every class *declared by the given profile class* have have the 
Anchor as a require.  The model on which it is based proposes that several 
of these classes might be declared, all chained together.  I think the idea 
is that they could thereby get away with only one anchor apiece, but that 
doesn't work.  For example, Puppet could choose to apply all the 
(non-class) resources declared directly by the profile classes first, 
including the anchors, and then all the other classes in any order.
 
 

 Read more about containment here: 
 https://docs.puppetlabs.com/puppet/latest/reference/lang_containment.html 



+1


I observe also that Puppet has suffered for years from confusion among 
users, among developers, in documentation, and even in code about whether 
(or in what sense) classes are resources.  Starting with the introduction 
of parameterized classes, there was a push -- largely originating at PL, I 
think -- to cast the class as just another resource type.  Thankfully, that 
seems to have waned, because however much the DSL can present classes in 
the same mold as ordinary resources, they manifestly are *not* ordinary 
resources.  More than a few bugs were reported around this, some without 
any possibility of a fully satisfactory resolution.

It seems the future parser / type system may be swinging even more back the 
other way.  As a longtime critic of the conflation of classes and 
resources, I am just fine with that.  The future parser and Puppet 4 docs 
should certainly discuss the matter, though.


John

-- 
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/0f266c5b-fbbc-482a-9d1e-76ba6e5b4926%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] [Error after after upgrading to 3.7] Evaluation Error: Illegal Resource Type expression, expected result to be a type name, or untitled Resource, got Type[Class]

2014-09-12 Thread Juan Sierra Pons
Hi,

I am using a mix of the following two blog post:

[1] A modern Puppet Master from scratch

[2] Puppet Infrastructure

After upgrading to 3.7 I am getting the following error message

Error: Could not retrieve catalog from remote server: Error 400 on
SERVER: Evaluation Error: Illegal Resource Type expression, expected
result to be a type name, or untitled Resource, got Type[Class] at
/etc/puppet/environments/production/site/profiles/manifests/base.pp:5:3
on node server3.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

With 3.6 it worked like a charm.

The base.pp is like this:

class profiles::base {
   anchor { 'profiles::base': }
  Class { require = Anchor['profiles::base'] }
  users { users: }
}

Is anyone getting the similar errors?

Thanks for your time

Best regards

[1] http://stdout.no/a-modern-puppet-master-from-scratch/

[2] http://terrarum.net/blog/puppet-infrastructure.html

--
Juan Sierra Pons j...@elsotanillo.net
Linux User Registered: #257202
Web: http://www.elsotanillo.net Git: http://www.github.com/juasiepo
GPG key = 0xA110F4FE
Key Fingerprint = DF53 7415 0936 244E 9B00  6E66 E934 3406 A110 F4FE
--

-- 
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/CABS%3Dy9uMF7Y3XuAxcTGeb_XymquBwd2C4bu6kgGJ%2BT1Js2NX6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.