-
Notifications
You must be signed in to change notification settings - Fork 290
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
sensu::check unable to remove a check property #535
Comments
|
validating that subdue is a hash seems a sensible protection against getting into this situation, i submitted PR #536 |
|
given the somewhat vague terms from the documentation. I think it may be expected behavior for an unspecified property to go "unmanaged"
[1] https://docs.puppet.com/puppet/latest/reference/lang_data_undef.html however one might interpret that "unmanaged" in practice does allow for defaults as some custom types use |
|
in the latest sensu changes subdue is now checked more deeply and setting to an empty hash is no longer a viable workaround. we really need to be able to remove the subdue parameter via puppet. |
|
I've used an empty hash as a workaround (to cleanup subdue settings) with sensu version With sensu version With sensu version This ensures that subdue is cleaned up but it produces a confusing check configuration. |
|
I spent a few hours today taking a bash at this, and didn't really get very far. I'm not familiar enough with the provider code to figure out how to remove values with the insync settings. I wonder if @jamtur01 fancies coming in to help out? |
|
@jaxxstorm i too spent some time learning types and providers to try to help this. this is where I got: master...fessyfoo:clear-undeclared-properties basically I clear any properties from the config that weren't explicitly set on the resource or via custom just before flush. however I got stalled out on both the design being wrong and testing. design wrong: along the lines of the design i did test (through some pry hackery) that the defaultto for the property can be set to a symbol such as :absent and these things can't be set to a symbol from the resource declaration in the puppet manifets. so seems ok? We could test against that in the provider and delete any properties set this way. that should solve the puppet noticing the change problem. and was where I was headed next. though it would result in a lot more boiler plate which really made me think about further refactoring to reduce that. before getting into all that I was workign to determine how to put in place testing for the actual types and providers classes using the code in puppet source as examples. but so far I've stalled for 7 days and haven't gotten back to it. so posting this to let you know what I figured out. hope it helps. |
|
@fessyfoo @jaxxstorm Here it's applied for What do you think of this approach? |
|
@ttarczynski I like it. I'll likely merge this early next week. Thanks for the contribution! |
|
It's worth nothing I think we should expand this for all optional params |
|
I'm willing to work further on this. I just wanted to start with a small change (#565) and then iterate on this. |
|
I've submitted two more changes trying to follow how
With #573 it's more tricky because rspec tests don't cover the provider implementation and I don't know how to properly tests such changes against all edge cases. |
We (accidentally) set the property subdue (to an empty string) on a
sensu::checkresource and then later tried to remove it by setting the property toundef, however setting a property to undef seems to make the property go unmanaged. Puppet runs resulted in "no change" to that resource. I think this is because puppet is treating an unspecified property as "insync" I could be wrong there, hard to follow the puppet code.is there a way to remove a property from a previously defined check?
note: setting subdue to something other than a hash prevents sensu-client from restarting. so as a workaround we have to set subdue to an empty hash.
The text was updated successfully, but these errors were encountered: