Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with $worker_processes when using parser=future on Puppet 3.7.2 #806

Closed
hostingnuggets opened this issue May 18, 2016 · 3 comments
Closed
Labels
bug Something isn't working needs-feedback Further information is requested

Comments

@hostingnuggets
Copy link

This module does not work with the specific case where the parser=future parameter is enabled in [main] of puppet.conf and with Puppet 3.7.2 on Debian 8. In that specific case you get the following error message:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: $worker_processes must be an integer or have value "auto". on node puppetnode

it looks like the validation of that specific nginx parameter fails...

@hwdegroot
Copy link

hwdegroot commented May 23, 2016

I can confirm this issue. I have the same problem.

EDIT: including nginx::config resolved my issue (and upgrading to puppet 3.8.5)

class { "nginx::config":
  confd_purge   => true,
  vhost_purge   => true,
}

class { "nginx":
  manage_repo => false,
}

without the anchor

@3flex 3flex added the bug Something isn't working label Jun 23, 2016
@3flex
Copy link
Contributor

3flex commented Jun 23, 2016

Got around to investigating this...

It's going to be difficult to fix. It's not as simple as changing the validation or making worker_processes an integer - it's caused by https://tickets.puppetlabs.com/browse/PUP-3587 which was fixed in puppet 3.7.3.

In 3.7.2 with the future parser the bug mentioned means passing undef as a parameter to a resource or class that has default parameter values will have those default values overridden with undef.

The nginx class sets many parameters to undef then passes them to nginx::config among others. So it sets worker_processes => undef which overrides worker_processes => '1' in nginx::config. This causes the validation to fail because the undef is being passed in.

Changing the validation won't help much since those undef values will get passed to almost all classes anyway, breaking the module's behaviour.

I know 3.7.2 is supported on Debian 8 and will be for years, so I'm sympathetic, but there's a fair amount of work involved in changing the module to accommodate what was then an experimental Puppet feature that has this bug.

Instead, I'll propose a workaround: don't include ::nginx, instead include nginx::package, nginx::config and nginx::service in a helper class you'll have to maintain yourself. Something like:

class nginx_helper (
  $geo_mappings                   = {},
  $string_mappings                = {},
  $nginx_locations                = {},
  $nginx_mailhosts                = {},
  $nginx_upstreams                = {},
  $nginx_vhosts                   = {},
  $nginx_vhosts_defaults          = {},
) inherits ::nginx::params {

  include ::nginx::package
  include ::nginx::config
  include ::nginx::service

  Class['::nginx::package'] -> Class['::nginx::config'] ~> Class['::nginx::service']
  Class['::nginx::package'] ~> Class['::nginx::service]

  create_resources('nginx::resource::upstream', $nginx_upstreams)
  create_resources('nginx::resource::vhost', $nginx_vhosts, $nginx_vhosts_defaults)
  create_resources('nginx::resource::location', $nginx_locations)
  create_resources('nginx::resource::mailhost', $nginx_mailhosts)
  create_resources('nginx::resource::map', $string_mappings)
  create_resources('nginx::resource::geo', $geo_mappings)

  anchor{ 'nginx::begin':
    before => Class['::nginx::package'],
    notify => Class['::nginx::service'],
  }
  anchor { 'nginx::end':
    require => Class['::nginx::service'],
  }
}

This is untested but should work around your issue.

Let me know your thoughts!

@3flex 3flex added the needs-feedback Further information is requested label Jul 4, 2016
@3flex
Copy link
Contributor

3flex commented Jul 4, 2016

Going to close this in the absence of any further comments... if we get more feedback I'll reopen if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-feedback Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants