You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class role::web ($myhost_nginx_vhosts) {
create_resources('nginx::resource::vhost', $myhost_nginx_vhosts)
}
there will be failures along the lines of: Evaluation Error: Error while evaluating a Function Call, nil is not an Array. It looks to be a NilClass at /etc/puppetlabs/code/environments/vagrant/modules/nginx/manifests/resource/vhost.pp:407:3 at /etc/puppetlabs/code/environments/vagrant/modules/role/manifests/web.pp:1 on node blasrgh
This provides few hints as to the root cause of the error, which in this case is our hapless hero forgot to put: class { 'nginx': }
in the role, kicking off three days of hair-pulling debugging, swearing, and kicking things. Total PEBKAC, yes, but having unless defined('class nginx { warn('You might want to consider including the nginx class if you are getting strange evaluation errors') }
would've been MOST helpful.
What are you seeing
Red. Mainly from my own foibles.
What behaviour did you expect instead
I expected the module to compile without complaint, but I would've settled for a warning informing me the 'nginx' parent class was not included when I tried to use the vhost defined-type.
Output log
Any additional information you'd like to impart
The text was updated successfully, but these errors were encountered:
I think it should not only warn it should fail. the defined type wants to read defaults from the ::ngninx class - which it only can if it is already parsed. the only way to ensure this is to explicitly include it before defining a resource.
Because the `ngnix::resource:*` types access ::ngnix class
parameters the nginx class needs to be declared before calling
the defined type.
`include ::nginx` inside the defined type is not enough because
params are evaluated before include is parsed.
Two of the defined types only access params inside. The include
way would work there - but for consistency I also added the fail.
Closesvoxpupuli#983
Rubueno
pushed a commit
to Rubueno/puppet-nginx
that referenced
this issue
Oct 19, 2020
Because the `ngnix::resource:*` types access ::ngnix class
parameters the nginx class needs to be declared before calling
the defined type.
`include ::nginx` inside the defined type is not enough because
params are evaluated before include is parsed.
Two of the defined types only access params inside. The include
way would work there - but for consistency I also added the fail.
Closesvoxpupuli#983
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
Given Hiera data like:
and instantiating it in a far-flung role with
there will be failures along the lines of:
Evaluation Error: Error while evaluating a Function Call, nil is not an Array. It looks to be a NilClass at /etc/puppetlabs/code/environments/vagrant/modules/nginx/manifests/resource/vhost.pp:407:3 at /etc/puppetlabs/code/environments/vagrant/modules/role/manifests/web.pp:1 on node blasrgh
This provides few hints as to the root cause of the error, which in this case is our hapless hero forgot to put:
class { 'nginx': }
in the role, kicking off three days of hair-pulling debugging, swearing, and kicking things. Total PEBKAC, yes, but having
unless defined('class nginx { warn('You might want to consider including the nginx class if you are getting strange evaluation errors') }
would've been MOST helpful.
What are you seeing
Red. Mainly from my own foibles.
What behaviour did you expect instead
I expected the module to compile without complaint, but I would've settled for a warning informing me the 'nginx' parent class was not included when I tried to use the vhost defined-type.
Output log
Any additional information you'd like to impart
The text was updated successfully, but these errors were encountered: