Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
117952cf
Commit
117952cf
authored
Apr 24, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing a bug in the new fetch_url username/password logic
parent
b9d8b3b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
lib/ansible/module_utils/urls.py
+16
-14
No files found.
lib/ansible/module_utils/urls.py
View file @
117952cf
...
@@ -250,9 +250,8 @@ def fetch_url(module, url, data=None, headers=None, method=None,
...
@@ -250,9 +250,8 @@ def fetch_url(module, url, data=None, headers=None, method=None,
handlers
.
append
(
ssl_handler
)
handlers
.
append
(
ssl_handler
)
if
parsed
[
0
]
!=
'ftp'
:
if
parsed
[
0
]
!=
'ftp'
:
url_username
=
module
.
params
.
get
(
'url_username'
,
''
)
username
=
module
.
params
.
get
(
'url_username'
,
''
)
if
url_username
:
if
username
:
username
=
url_username
password
=
module
.
params
.
get
(
'url_password'
,
''
)
password
=
module
.
params
.
get
(
'url_password'
,
''
)
netloc
=
parsed
[
1
]
netloc
=
parsed
[
1
]
elif
'@'
in
parsed
[
1
]:
elif
'@'
in
parsed
[
1
]:
...
@@ -266,19 +265,22 @@ def fetch_url(module, url, data=None, headers=None, method=None,
...
@@ -266,19 +265,22 @@ def fetch_url(module, url, data=None, headers=None, method=None,
parsed
=
list
(
parsed
)
parsed
=
list
(
parsed
)
parsed
[
1
]
=
netloc
parsed
[
1
]
=
netloc
passman
=
urllib2
.
HTTPPasswordMgrWithDefaultRealm
()
# reconstruct url without credentials
# this creates a password manager
url
=
urlparse
.
urlunparse
(
parsed
)
passman
.
add_password
(
None
,
netloc
,
username
,
password
)
# because we have put None at the start it will always
# use this username/password combination for urls
# for which `theurl` is a super-url
authhandler
=
urllib2
.
HTTPBasicAuthHandler
(
passman
)
if
username
:
# create the AuthHandler
passman
=
urllib2
.
HTTPPasswordMgrWithDefaultRealm
()
handlers
.
append
(
authhandler
)
#reconstruct url without credentials
# this creates a password manager
url
=
urlparse
.
urlunparse
(
parsed
)
passman
.
add_password
(
None
,
netloc
,
username
,
password
)
# because we have put None at the start it will always
# use this username/password combination for urls
# for which `theurl` is a super-url
authhandler
=
urllib2
.
HTTPBasicAuthHandler
(
passman
)
# create the AuthHandler
handlers
.
append
(
authhandler
)
if
not
use_proxy
:
if
not
use_proxy
:
proxyhandler
=
urllib2
.
ProxyHandler
({})
proxyhandler
=
urllib2
.
ProxyHandler
({})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment