-
Notifications
You must be signed in to change notification settings - Fork 232
Add params and ini_settings for node/report/purge ttls #35
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been trying to put some thought into what our strategy is going to be for maintaining backward-compatibility with older versions of PuppetDB. Two of these settings are harmless on that front--though perhaps misleading. However, for the node-ttl setting we are not providing a way to define the older node-ttl-days setting here, which means we're exposing a setting that was available in 1.0 but not the means to actually set it.
I worry that the module is going to get really hairy if we try to maintain backward compatibility too far into the past, so I think my current inclination is to simply start documenting (very prominently--at the top of the main README or similar) that certain versions of the module are only compatible with certain versions of puppetdb. If you want to use an older version of puppetdb then you use an older version of the module.
Thoughts? @kbarber ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can tell what version of the module they are using, its easy enough to make this conditional. If the semantics are the same the newer node-ttl option could set node-ttl-days or node-ttl conditionally. Question is, if we expose it and don't check - and yet we claim we support 1.0 in the module and someone uses it, what happens?
@cprice-puppet I agree, we have to be clear on what version of puppetdb we support with the module. Its about being PuppetDB version focused ... not config option/feature focused.
Can we treat it like any feature and use semantic versioning and deprecation rules around this? Ie. 0.9 is now deprecated in say 2.0.5, next major release (3.0.0) its not supported any more. Keep it in line with how we support puppetdb itself would be useful, so if we are officially not releasing patches for 0.9 then the module gets deprecation messages and later unsupported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone uses the setting in the module but is running PuppetDB 1.0.x, I'm about 99% sure that it would just silently ignore the setting. I'm pretty darn sure that our config parsing does not currently check for extra/unsupported key/val pairs in the config files (though I would prefer if it did).
We could certainly use semantic versioning and deprecation rules, and that might be the best way to go... but it's going to cause a bunch of spaghetti code in here that makes me tempted to just document the compatibility constraints and not hassle with it. The former would probably be a better end user experience but I'm not 100% sure how much payoff there would be.
And yes, we'd have to add a fact or something that would detect what version of PuppetDB was installed (if any). Actually, I don't know if it could be a fact because then it wouldn't work on the first run (before they'd installed the package initially)... unless we had some if/pick statements that were smart enough to distinguish between the installed version (or lack thereof), the latest version available (if they're using 'present'), or the user-specified version (if they pass the param).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another angle on this ... @cprice @nicklewis ... So we can almost know what the version is today without a fact, by looking at the $puppetdb_version. However, if it is set to 'present' in the past, we are kind of stuck as it could be anything today. If its 'latest' we know its - well, the latest so whatever the 'latest' supported at the time of module release should work. This all seems a little dodgy though, as I'm guessing the majority will just not define a specific version and let if fall back to 'present'. So yeah, today - no good way to detect version.
Maybe we should just add the old parameter as an option. Ie. Add the old parameter node-ttl-days right ... saying in docs its only supported on 1.0.0 and is now deprecated if you are using 1.1.0. The new parameter is also provided, and we mention in docs it was introduced in 1.1.0. Effectively we are mapping the config to the class parameters 1 to 1 ... which is probably a reasonable approach, and it means that users familiar with our config docs can just use our class without having to do a mental mapping somewhere.
We don't have a super-great way of obviously doing proper validation on this without being certain of the puppetdb version, seems to me if we return a deprecation message in PuppetDB itself on node-ttl-days then at least we are warning somewhere. Do we do this today for example? If not we probably should have, or at least allow node-ttl-days to work as intended until a 2.0 release, based on semver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're totally correct that puppetdb should be logging a deprecation warning on
node-ttl-days, and it's not. D'oh.Here's another random idea to throw out there... we could tie the semver of the module to the semver of puppetdb itself... So, we could do what you said for now (add support for node-ttl-days to 1.1 of the module) but not put the purge setting in there, and then we could release version 1.2 of the module and add the purge setting with it. Then from here on out we could simply document that you need to use the same semver series of the module as the version of puppetdb you're running. It'd be a slight bending of the semver rules for the module for this release but I think it would probably end up matching up fairly well going forward, and would prevent us from having to maintain any spaghetti code in the module for trying to guess which version you're running.
Seems like this would work pretty intuitively for the 90% use-case (where the user is installing the module and adding 'ensure=>present' to their manifests at the same time). It would mean that you'd want/need to upgrade the module when you upgrade puppetdb, but that seems fairly reasonable I think...
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NLEW : any opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern about that approach is it prevents us from using semver for the module itself. If we want to add new module features (rather than support for new PuppetDB features), we have no way of conveying that in the version number in a semver-compatible way. We could just do a point release, but since the forge is pretty strict on semver, that seems bad.
There's another issue, which I discussed with @cprice-puppet in person just now, which is that we have to add a variable and ini_setting for every new param now, even though it's just key-value. Some settings, like the database-related ones, have their own logic so this makes sense. But for ordinary settings, maybe it would serve users better to add some simple define for puppetdb_setting or somesuch, which just wraps ini_setting and sets the filename. Then users don't need to wait for us to get around to releasing a new version of the module, and then upgrade, to be able to take advantage of new settings. It also reduces the duplication we face now, of having to add the parameter in three places and document it in there more. The main disadvantage of this is that users have to refer to the central PuppetDB documentation for the list of available parameters, rather than the PuppetDB module docs. Personally, I think that's not so bad.
@kbarber what are your thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach seems reasonable to me too. Pro: module is more future-proof and we can use meaningful semver on it. Con: module documentation is not sufficient on its own to provide user with the info that they need to configure things... but as long as the module docs contain a link to the puppetdb docs I don't think that's too big of a deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to raise that concern earlier, I'm not a massive fan of the direct mapping from class/define parameter to config setting. Normally I have a defined resource for each setting - and have a class take a hash and use create_resources. This means you get class-time settings and later on users can add settings outside of the class if they desire.
Whatever the implementation is, like you say @nicklewis this means you can add features to puppetdb without having to have the module always keep up. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we should close this pull, then, and open a new one that introduces a new defined resource type called puppetdb_setting, yes?