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

WIP: Untested POC for #851 #852

Closed
wants to merge 7 commits into from
Closed

WIP: Untested POC for #851 #852

wants to merge 7 commits into from

Conversation

alvagante
Copy link
Collaborator

@cwjohnston @ghoneycutt this is what I have in mind, I think that seeing the sample (not tested) code give you the idea of what I mean.
A similar thing could be done for the sensu::enterprise class and /etc/default/sensu-enterprise.

Pull Request Checklist

Description

Related Issue

Fixes # .

Motivation and Context

How Has This Been Tested?

General

  • Update README.md with any necessary configuration snippets

  • New parameters are documented

  • New parameters have tests

  • Tests pass - bundle exec rake validate lint spec

<% end -%>
<% if @heap_size -%>
HEAP_SIZE="<%= @heap_size %>"
# File managed by Puppet
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may also mantain all the if conditions in the template, it would just require more maintenance, as contante would need to be changed whenever a new parameter is added

Optional[PATH] => String,
Optional[CONFD_DIR] => String,

}]
Copy link
Collaborator Author

@alvagante alvagante Nov 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each time a new environment variable has to be supported this would be the only place where to add something.

@@ -0,0 +1,14 @@
type Sensu::Env_Vars = Struct[{

Optional[EMBEDDED_RUBY] => Boolean,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, love the type validation here of the struct!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, struct is the missing link to allow usage of single hashes to manage AND validate multiple configuration settings without multiplying classes' parameters.
Only limit is that currently, afaik, it' not possible to allow any possible key value, the ones accepted, even if optional, must be defined in the struct.

'SERVICE_MAX_WAIT' => $init_stop_max_wait,
'PATH' => $path,
'CONFD_DIR' => "${conf_dir},${confd_dir}",
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't heap size be here?

if we remove it, we would need need to bump the major version, which I'm not excited about doing since we'll be doing that soon enough for the next version of Sensu.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heap_size afaik is used only on sensu enterprise, so it would be used in sensu::enterprise

@alvagante
Copy link
Collaborator Author

Closing this PR, too many fixes to do on tests which are not worth, now, the advantages of this refactoring. @ghoneycutt Use #861 instead.

@ghoneycutt
Copy link
Collaborator

@alvagante I like this approach to managing config files. Doing a similar thing with the facter module - ghoneycutt/puppet-module-facter#59

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

Successfully merging this pull request may close these issues.

2 participants