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
Fixes #23306 - pass database connection configs to cpdb command #196
Fixes #23306 - pass database connection configs to cpdb command #196
Conversation
Issues: #23306 |
parent_cmd = '/usr/share/candlepin/cpdb' if parent_cmd.empty? | ||
help_cmd = "#{parent_cmd} --help | grep -c '\\-\\-#{option_name} '" | ||
option_name += ' ' if followed_by_whitespace |
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.
What is the reason for this? Wouldn't matching for whole word via grep -c '\\-\\-#{option_name}\b'"
solve it or it's something else?
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.
@iNecas,
It is matching whole word.
I did mistake while testing command on CLI so this space was added by me in previous code. Extra-space not needed so removed.
49ccfa3
to
12e25b3
Compare
@alda519 mind giving this a try, as you've filed the original BZ? |
No other comments code-wise. |
sure, it works, but not over SSL ssl=true would fix
sslfactory=org.postgresql.ssl.NonValidatingFactory would fix
candlepin.conf (after satellite-installer --katello-candlepin-db-ssl-verify false --katello-candlepin-db-ssl true)
|
@alda519, For now, I will add changes and skip this check when there is |
it can be appended to db name |
@alda519 could you give us an example on how this was supposed to work? |
I meant something like |
if the |
12e25b3
to
aacb65e
Compare
@@ -48,7 +49,7 @@ def env_content_ids_with_null_content | |||
def load_configuration | |||
raw_config = File.read(CANDLEPIN_DB_CONFIG) | |||
full_config = Hash[raw_config.scan(/(^[^#\n][^=]*)=(.*)/)] | |||
uri_regexp = %r{://(([^/:]*):?([^/]*))/([^?]*)\??(ssl=([^&]*))?} | |||
uri_regexp = %r{://(([^/:]*):?([^/]*))/([^?]*)\??(ssl=([^&]*))?\&?(sslfactory=([^&]*))?} |
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 depens on the ordering of the params (the ssl
and sslfactory
). It would be probably better not trying to extract them both in the same regexp, but having separate regexps for those two.
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.
Done!
aacb65e
to
80a4b30
Compare
query_string = url.split('?')[1] | ||
return nil unless query_string | ||
output = /#{key_name}=([^&]*)?/.match(query_string) | ||
return nil unless output |
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 last two lines can be simplified by this, unless there is a reason I can't think of for checking on output[0].include(key_name)
:
output[1] if output
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.
Thank you @iNecas!
Yeah, no reason.
I think, I need to take a cup of coffee :-).
On nitpick, but ready for testing in production @alda519 |
80a4b30
to
ab5227d
Compare
Well, now ssl and sslfactory works!
Perfect! |
No description provided.