-
Notifications
You must be signed in to change notification settings - Fork 54
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
Fetch installed PSQL version #275
Conversation
Should we just use facter? This is lighter weight and "should" always work as long as Puppet agent has been ran once, which it always is. |
tasks/get_psql_version.rb
Outdated
require '/opt/puppetlabs/puppet/cache/lib/pe_install/pe_postgresql_info.rb' | ||
|
||
# GetPEAdmConfig task class | ||
class GetPSQLInfo |
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 doesn't use the ruby task helper, because it doesn't need param processing?
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 didn't think that through, just copied the structure of an existing similar task peadm::get_peadm_config
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.
Other thought. Using the ruby_task_helper
would also require it as a dependency while not providing any additional value
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.
@ody Understood, but in that case - isn't it overkill to create a Ruby class instead of just using 3 lines of procedural code?
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 are correct. The usage of a Ruby class is a simple side effect of my copy and pasting existing code.
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.
The class wrapper is present in the pattern in order to enable unit testing, should unit tests be written.
We should probably just adopt ruby_task_helper
instead. It's better to standardize on a standard rather than create our own inside PEAdm. If we do that, we also gain the ability to write unit tests for tasks.
Reuses library from facter that can report the major version of PSQL installed
Ues get_psql_info to dynamically set the path to files required for setting up authentication
The possible values for the clientcert setting changed between 11 and 14, use get_psql_info to determine setting based on version
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.
LGTM
d62e6c3
to
077d6ac
Compare
It was determined that original pattern did not provide any additional value over more established ones.
Actions taken on $replica_postgresql_host were previously a noop when the parameter was not provided because the tasks would be ran with an undef set of targets. Doing this when introducing get_psql_version results in an error because you can't run functions against an undef return value if the task was a noop. Wrap everything related to $replica_postgresql_host in an if statement to prevent errors when the parameter is not provided.
The add_compiler plan makes changes to PSQL for communication with PuppetDB.
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.
LGTM 2 :-)
We'll need to add |
@ do'h! yep, you did. I totally missed that. Take my reviewer approval. 😂 |
Provides task that reuses code from facter to return the currently major version of the installed PSQL server. Data is used to construct paths to specific files required for different plans.