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

Unable to purge handlers, extensions, or mutators #328

Closed
nhinds opened this issue Mar 3, 2015 · 7 comments
Closed

Unable to purge handlers, extensions, or mutators #328

nhinds opened this issue Mar 3, 2015 · 7 comments

Comments

@nhinds
Copy link
Contributor

nhinds commented Mar 3, 2015

Since #302 was reverted in #307, #321 has been merged which supposedly re-added this functionality. However the following directories are not purged with this new implementation:
/etc/sensu/handlers, /etc/sensu/extensions, /etc/sensu/mutators, /etc/sensu/extensions/handlers

I'm willing to go and create another PR to re-add this functionality, but before I do I'd like to know your preferred approach. Would you like the new parameter purge_plugins_dir to purge these additional directories (possibly also renaming the parameter), or would you like 4 additional parameters to purge these 4 directories? Or something in between?

@nhinds
Copy link
Contributor Author

nhinds commented Jun 14, 2015

Ping: @jlambert121 do you have a preference for an approach to re-add this functionality?

In my setup all handlers/extensions/mutators are managed by puppet, and I need unmanaged handlers/extensions/mutators to be purged. I'd like to know your preference before submitting another PR.

@jlambert121
Copy link
Contributor

I was looking at this last week and I hate to have a ton of different parameters that all change slightly different things. Just as a point of discussion, what about a purge hash?

purge => { 
    'plugins'  => false, 
    'config' => true,
    'handlers' => true,
    'extensions' => false
}

Do you think that's getting too confusing for people? It would be nice to confine the parameter creep though.

@jhoblitt
Copy link
Contributor

jhoblitt commented Aug 4, 2015

I suspect most people would want to purge everything so I'm not sure how much value there is in fine grain control.

@nhinds
Copy link
Contributor Author

nhinds commented Aug 9, 2015

My original PR for this was a single "purge everything" flag, and that was reverted because in #304 somebody didn't want to purge everything.

I think that a hash would be doable, and avoid adding tons of new parameters.

Do you reckon the existing parameters should be removed, fail if they're specified, or continue to work to retain backwards compatibility? For prior art, I see that the sensu::dashboard parameter currently fails if it's specified, so we could do a similar thing. Alternatively we could ensure they continue to work, but warn if they're used (so they can be removed later) - which is more work but less surprising for callers, I guess?

@nhinds
Copy link
Contributor Author

nhinds commented Aug 9, 2015

Re: wanting to purge everything, we could make sensu::purge accept a true/false value in addition to the hash, so people who wanted to purge everything could use:

purge => true

People who wanted to purge nothing could use the default (or purge => false), and people who want to purge configuration and plugins without purging handlers could use the hash form:

purge => {
    plugins => true,
    config => true
}

nhinds added a commit to nhinds/sensu-puppet that referenced this issue Aug 9, 2015
…` and `purge_plugins`

The `purge` parameter can either be `true`/`false` (in which case it controls purging
everything), or a hash controlling each type of purge-able thing.

Fixes sensu#328
@nhinds
Copy link
Contributor Author

nhinds commented Aug 9, 2015

Raised #401 with an implementation which accepts booleans or a hash, and fails if you pass purge_config/purge_plugins_dir.

I made another branch which just warns when purge_config/purge_plugins_dir are specified, but I think it makes the logic more confusing when you have to understand how a global purge parameter and individual purge parameters interact with each other. Code is at 7b1d7a8

@jlambert121
Copy link
Contributor

Nice! I like #401. It adds a little bit of complexity, but the code is easy to read and most of it is hidden from the average user. Unless anyone has a different implementation idea in the near future I'm going to merge this one.

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

3 participants