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

Allow agents to have subscriptions defined as a resource #1227

Merged
merged 2 commits into from
Mar 7, 2020

Conversation

treydock
Copy link
Collaborator

@treydock treydock commented Mar 2, 2020

Pull Request Checklist

Description

Allow subscriptions for agents to be defined in such a way that works like old Sensu module and plays well with defining subscriptions in profile classes for various resources.

The content of agent.yml is generated from fragments at runtime after catalog is compiled, unit tests can only test fragment data but acceptance tests are able to verify the final agent.yml content.

Related Issue

Fixes #1222 and #1183

Motivation and Context

This makes it easier to dynamically generate agent.yml based on profiles assigned to a given puppet host. Instead of having to hardcode subscriptions, subscriptions can be built based on profile classes assigned to a given host.

@treydock treydock requested a review from ghoneycutt March 2, 2020 23:39
@treydock treydock force-pushed the subscriptions branch 13 times, most recently from fb101c8 to 0b07244 Compare March 4, 2020 00:10
# Order of the datacat fragment
#
define sensu::agent::subscription (
String $subscription = $name,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be String[1] ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I made that change

#
define sensu::agent::subscription (
String $subscription = $name,
String $order = '50',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this also be String[1] or perhaps Integer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I used String[1] because doesn't need to be Integer and all docs for datacat use a string and the default in datacat is the string '50'.

@treydock
Copy link
Collaborator Author

treydock commented Mar 7, 2020

Had to add updates to Ubuntu and Debian docker builds because bootstrapping Puppet was failing due to lack of HTTPS support in apt. Normally apt module would handle this but needed these packages in order to bootstrap Puppet.

@ghoneycutt ghoneycutt merged commit 6c2ce48 into master Mar 7, 2020
@ghoneycutt ghoneycutt deleted the subscriptions branch March 7, 2020 21:42
@bodgit
Copy link
Contributor

bodgit commented Mar 9, 2020

Great, I'll check it out. Good ol' datacat module 😉

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

Successfully merging this pull request may close these issues.

Lost the ability to separately define subscriptions
3 participants