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

1443164: no_proxy matches the host name when *.redhat.com is used #1635

Merged
merged 1 commit into from May 26, 2017

Conversation

jirihnidek
Copy link
Contributor

  • Bug fix: https://bugzilla.redhat.com/show_bug.cgi?id=1443164
  • Method proxy_bypass_environment() from urllib does not
    support no_proxy with items containing asterisk
    (e.g.: *.redhat.com). Thus values in this environment variable
    is preprocessed and leading asterisks are stripped.
  • There will be opened PR for urllib to address this problem
    in proper way.

@jirihnidek jirihnidek requested a review from kahowell May 23, 2017 21:13
@jirihnidek jirihnidek changed the title 1443164: no_proxy match the host name when *.redhat.com is used 1443164: no_proxy matches the host name when *.redhat.com is used May 23, 2017
@jirihnidek
Copy link
Contributor Author


no_proxy = os.environ.get('no_proxy') or os.environ.get('NO_PROXY')
# Remove all leading white spaces and asterisks from items of no_proxy
no_proxy = ','.join([item.lstrip(' *') for item in no_proxy.split(',')])
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to handle the case of no_proxy=None...

@jirihnidek
Copy link
Contributor Author

I pushed these changes to prove tests will not fail at Jenkins. I plan to add more unit tests covering new code. Please don't merge it until more unit tests are added to this PR.

@jirihnidek
Copy link
Contributor Author

Bug report for Python created: http://bugs.python.org/issue30462

@jirihnidek
Copy link
Contributor Author

Created right solution: PR for Python: python/cpython#1795, but this is long term solution with uncertain outcome.

@jirihnidek
Copy link
Contributor Author

The failure of unit tests is strange. It works at my laptop:

cd python-rhsm
nosetests test/unit

With following result:

...
Ran 324 tests in 0.258s

OK

Isn't python-rhsm loaded from system at Jenkins build machine?

@kahowell
Copy link
Contributor

@jirihnidek I can reproduce the Jenkins failures on my machine. I noticed some of our tests are a little brittle. If you've modified your /etc/rhsm/rhsm.conf, it can interfere with some of the tests. Another possibility is code that didn't get checked in.

@jirihnidek
Copy link
Contributor Author

I tested it at two another VMs without any failure. I will investigate it more tomorrow.

* Bug fix: https://bugzilla.redhat.com/show_bug.cgi?id=1443164
* Method proxy_bypass_environment() from urllib does not
  support no_proxy with items containing asterisk
  (e.g.: *.redhat.com). Thus values in this environment variable
  is preprocessed and leading asterisks are stripped.
* There was opened PR for urllib to address this problem
  in proper way: python/cpython#1795
* Fixed functional tests for python-rshm
* Added two more functional tests.
* Added several functional unit tests for no_proxy environment
  value containing asterisk.
* Refactored local variables to remove possible interference
  with module rhsm.connection.
* Try to clear following environment variables before each
  unit test is performed in ConnectionTests test case:
  - no_proxy
  - NO_PROXY
  - HTTPS_PROXY
* Small tweaks of code style (too long lines).
@kahowell kahowell merged commit acbe43a into master May 26, 2017
@kahowell kahowell deleted the jhnidek/1443164 branch May 26, 2017 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants