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

redact parameter causes errors #834

Closed
ghoneycutt opened this issue Oct 26, 2017 · 3 comments
Closed

redact parameter causes errors #834

ghoneycutt opened this issue Oct 26, 2017 · 3 comments

Comments

@ghoneycutt
Copy link
Collaborator

Description of problem

  • What did you do?

Attempted to use redact by setting the redact parameter to the sensu class with the value ["password", "passwd", "pass", "api_key", "api_token", "access_key", "secret_key", "private_k ey", "secret", "ec2_access_key", "ec2_secret_key"],

  • What happened?

Catalog compilation fails.

  • What did you expect to happen?

For the catalog to compile and redact those fields.

  • How can someone reproduce the problem?

Include the sensu class with the redact parameter set to the values above.

Command used and debugging output

  • What does your puppet config look like (including any hiera config)
  • Is this a masterless or master based puppet setup?
@alvagante
Copy link
Collaborator

alvagante commented Oct 30, 2017

So @ghoneycutt I've explored a bit the issue.
It looks like it's not related only to redact parameter but also to subscribers, and I suspect, any parameter on the sensu class which is used in sensu::client where an array (but not an hash) is expected as argument, and there's no default, even empty, set.

The referenced commit sets an empty array as default value for redact, and this creates in /etc/sensu/conf.d/client.json a line like:

{
[...]
    "redact": [

    ]
  }
}

This allows this entry to be recognised and changeable by sensu_client_config type.

So the commit solves the problem when a new configuration is created from scratch, but there's a caveat: if there's an existing /etc/sensu/conf.d/client.json but without any 'redact' (or 'subscriptions') entry we bumb again in the error which traces back to:

Error: undefined method `sort' for :absent:Symbol
lib/puppet/type/sensu_client_config.rb:47:in `insync?'

Probably @jeffmccune has better understanding on how the json provider for sensu_client_config works.
I've the feeling that parameters that are arrays are not correctly managed on existing files, if they are not already present in the json file.

alvagante added a commit to alvagante/sensu-puppet that referenced this issue Oct 30, 2017
@alvagante
Copy link
Collaborator

alvagante commented Oct 30, 2017

Ok, after some digging, alvagante@9206f0f seems to fix the problem. But since is mostly a copy and paste with limited introspection, I'd ask for @jeffmccune opinion.
I laso removed byt default [] for redact parameter, as it was not solving the issue at its core.

alvagante added a commit to alvagante/sensu-puppet that referenced this issue Oct 30, 2017
ghoneycutt added a commit that referenced this issue Nov 2, 2017
Set a defauly empty array for redact #834
@ghoneycutt
Copy link
Collaborator Author

Released in v2.38.1

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

No branches or pull requests

2 participants