-
Notifications
You must be signed in to change notification settings - Fork 184
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
Added no_proxy autoconfiguration from rhsm conf and tests #3507
Conversation
saved_base_url = config.base_url | ||
if ca_cert is not None: | ||
saved_cert_verify = config.cert_verify | ||
config.cert_verify = ca_cert | ||
if proxy is not None: | ||
saved_proxy = config.proxy | ||
config.proxy = proxy | ||
rhsm_no_proxy = None | ||
if rhsm_no_proxy is not None or not '': | ||
config.no_proxy = rhsm_no_proxy |
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 default value of rhsm_no_proxy
is None
in the function parameters. So why resetting it to None
again here? And it looks like we will always pass in the conditional here.
I guess the condition should be this one:
if rhsm_no_proxy and rhsm_no_proxy != '':
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 right
insights/client/auto_config.py
Outdated
@@ -128,6 +132,9 @@ def _try_satellite6_configuration(config): | |||
rhsm_proxy_port = rhsm_config.get('server', 'proxy_port').strip() | |||
rhsm_proxy_user = rhsm_config.get('server', 'proxy_user').strip() | |||
rhsm_proxy_pass = rhsm_config.get('server', 'proxy_password').strip() | |||
rhsm_no_proxy = rhsm_config.get('server', 'no_proxy').strip() | |||
if rhsm_no_proxy.lower() == 'None' or rhsm_no_proxy == '': |
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.
str.lower()
is supposed to return a copy of the string converted to lowercase and you compare it to None
.
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.
oh my mistake, it needs to be compare with 'none'
Resolves: rhbz#2065233 Signed-off-by: ahitacat <[email protected]>
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.
Tested and it works, LGTM.
@@ -128,6 +131,9 @@ def _try_satellite6_configuration(config): | |||
rhsm_proxy_port = rhsm_config.get('server', 'proxy_port').strip() | |||
rhsm_proxy_user = rhsm_config.get('server', 'proxy_user').strip() | |||
rhsm_proxy_pass = rhsm_config.get('server', 'proxy_password').strip() | |||
rhsm_no_proxy = rhsm_config.get('server', 'no_proxy').strip() | |||
if rhsm_no_proxy.lower() == 'none' or rhsm_no_proxy == '': |
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.
May be simplified as:
if rhsm_no_proxy.lower() in ['none', '']:
But it is just nitpicking here.
test me |
Resolves: rhbz#2065233 Signed-off-by: ahitacat <[email protected]> (cherry picked from commit 894484a)
Resolves: rhbz#2065233 Signed-off-by: ahitacat <[email protected]>
Signed-off-by: ahitacat [email protected]
All Pull Requests:
Check all that apply:
Complete Description of Additions/Changes:
Insights-client wasn't honoring the no_proxy configuration of
/etc/rhsm/rhsm.conf
file.This PR adds the no_proxy value to the auto-configuration module, to retrieve the value of the rhsm configuration file. It provides some tests related to this.
This fix is related to: [rhbz#2065233]((https://bugzilla.redhat.com/show_bug.cgi?id=2065233)