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

(#550) Add sensu client de-registration #750

Merged
merged 1 commit into from
Jul 19, 2017

Conversation

jeffmccune
Copy link
Collaborator

Without this patch the sensu client does not support the deregister and
deregistration attributes. These attributes are documented at deregistration
attributes

This patch adds the sensu::client_deregister and
sensu::client_deregistration class parameters which flow through to the
sensu_client_config type and provider.

This patch also refactors the sensu_client_config type and provider to operate
the same way as the sensu_check type and provider. Specifically, the JSON
provider dynamically introspects the set of properties from the type and
creates getter and setter methods to output the JSON. Custom attributes are
enhanced, if client_custom = absent then all custom attributes in the client
configuration are removed. Otherwise, the custom attributes are merged on top
of any existing custom attributes.

Resolves #550

@jeffmccune jeffmccune force-pushed the 550_deregistration branch 2 times, most recently from ed4bd06 to 9d22d3a Compare July 14, 2017 16:39
@ghoneycutt
Copy link
Collaborator

We should have some more spec tests for this.

@ghoneycutt ghoneycutt self-requested a review July 14, 2017 19:54
Copy link
Collaborator

@ghoneycutt ghoneycutt left a comment

Choose a reason for hiding this comment

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

Looks great, though we need spec tests for the init class for the new parameters.

@jeffmccune
Copy link
Collaborator Author

Looks great, though we need spec tests for the init class for the new parameters.

@ghoneycutt Added some additional spec tests and exercised the change with vagrant in quite a few different ways. I'm confident and satisfied at this point.

@jeffmccune
Copy link
Collaborator Author

This should be good to go for review / merge.

@jeffmccune
Copy link
Collaborator Author

Rebased.

@jeffmccune
Copy link
Collaborator Author

Rebased.

Lots of failing tests... Making another pass at the rebase now. Should be quick.

      Puppet::PreformattedError:
         Evaluation Error: Error while evaluating a Function Call, Class[Sensu]:                                                                                                        parameter 'client_deregister' expects a Boolean value, got Undef
           parameter 'client_deregistration' expects a Hash value, got Undef at line 1:5 on node maxwell.main.jeffmccune.net

Without this patch the sensu client does not support the deregister and
deregistration attributes.  These attributes are documented at [deregistration
attributes](https://sensuapp.org/docs/latest/reference/clients#deregistration-attributes)

This patch adds the `sensu::client_deregister` and
`sensu::client_deregistration` class parameters which flow through to the
sensu_client_config type and provider.

This patch also refactors the sensu_client_config type and provider to operate
the same way as the sensu_check type and provider.  Specifically, the JSON
provider dynamically introspects the set of properties from the type and
creates getter and setter methods to output the JSON.  Custom attributes are
enhanced, if `client_custom = absent` then all custom attributes in the client
configuration are removed.  Otherwise, the custom attributes are merged on top
of any existing custom attributes.

When the client config is flushed to /etc/sensu/conf.d/client.json the top
level set of keys are sorted.  This isn't terribly useful as there is usually
just one key, `{"client":{}}`.  The value of the client attribute is also
sorted, making the output more useful and human readable.

Resolves sensu#550
@jeffmccune
Copy link
Collaborator Author

OK, rebased for real

Finished in 1 minute 20.44 seconds (files took 1.67 seconds to load)
628 examples, 0 failures

@ghoneycutt ghoneycutt merged commit b4c4de5 into sensu:master Jul 19, 2017
@ghoneycutt
Copy link
Collaborator

Released in v2.27.0

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