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

Gunicorn via Hiera #499

Closed
linuxmail opened this issue Jun 27, 2019 · 1 comment
Closed

Gunicorn via Hiera #499

linuxmail opened this issue Jun 27, 2019 · 1 comment

Comments

@linuxmail
Copy link

hi,

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5
  • Distribution: Debian Stretch
  • Module version: 3.0.1

I try to configure Gunicorn via Hiera and tried to use create_resources, which isn't working

  • profile.pp
class profile::webserver::gunicorn {
  contain python

  $python_gunicorn =  hiera('python::gunicorn', {})
  create_resources('python::gunicorn', $python_gunicorn)
}

backend.yaml

python::gunicorn:
  'vhost':
    ensure: 'present'
    virtualenv: "/opt/backoffice-backend/django"
    mode: 'wsgi'
    dir: '/opt/backoffice-backend/django/current'
    bind: 'unix:/var/tmp/gunicorn.socket'
    owner: 'www-data'
    group: 'www-data'
    workers: '30'
    manage_config_dir: 'true'
    environment: 'prod'
    osenv:
      'DBHOST': 'dc.example'
    timeout: 30

But I get always:

 Error while evaluating a Function Call, Class[Python]: parameter 'gunicorn' expects a match for Enum['absent', 'latest', 'present']
, got Struct

So, can someone tell me, what I'm doing wrong ?

cu denny

@b4ldr
Copy link
Member

b4ldr commented Jun 27, 2019

the python class has the parameter gunicorn so automatic paramer lookup when calling the python module is hitting that. rewriting your code as follows should help

class profile::webserver::gunicorn (
  $python_gunicorn = {}
){
  contain python
  create_resources('python::gunicorn', $python_gunicorn)
}

config.yaml

profile::webserver::gunicorn::python_gunicorn:
  'vhost':
    ensure: 'present'
    virtualenv: "/opt/backoffice-backend/django"
    mode: 'wsgi'
    dir: '/opt/backoffice-backend/django/current'
    bind: 'unix:/var/tmp/gunicorn.socket'
    owner: 'www-data'
    group: 'www-data'
    workers: '30'
    manage_config_dir: 'true'
    environment: 'prod'
    osenv:
      'DBHOST': 'dc.example'
    timeout: 30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants