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
5b635b9e
Commit
5b635b9e
authored
Apr 24, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7138 from jimi-c/issue_6928_get_url_password
Add parameters to get_url for the url username/password
parents
3a202918
89fa9b73
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletions
+24
-1
CHANGELOG.md
+2
-0
lib/ansible/module_utils/urls.py
+10
-1
library/network/get_url
+12
-0
No files found.
CHANGELOG.md
View file @
5b635b9e
...
...
@@ -69,6 +69,8 @@ Other notable changes:
*
regex_replace filter plugin added
*
added an inventory script for Docker
*
added an inventory script for Abiquo
*
the get_url module now accepts url_username and url_password as parameters, so sites which require
authentication no longer need to have them embedded in the url
*
... to be filled in from changelogs ...
*
...
...
lib/ansible/module_utils/urls.py
View file @
5b635b9e
...
...
@@ -200,6 +200,8 @@ def url_argument_spec():
http_agent
=
dict
(
default
=
'ansible-httpget'
),
use_proxy
=
dict
(
default
=
'yes'
,
type
=
'bool'
),
validate_certs
=
dict
(
default
=
'yes'
,
type
=
'bool'
),
url_username
=
dict
(
required
=
False
),
url_password
=
dict
(
required
=
False
),
)
...
...
@@ -247,13 +249,20 @@ def fetch_url(module, url, data=None, headers=None, method=None,
ssl_handler
=
SSLValidationHandler
(
module
,
hostname
,
port
)
handlers
.
append
(
ssl_handler
)
if
parsed
[
0
]
!=
'ftp'
and
'@'
in
parsed
[
1
]:
if
parsed
[
0
]
!=
'ftp'
:
url_username
=
module
.
params
.
get
(
'url_username'
,
''
)
if
url_username
:
username
=
url_username
password
=
module
.
params
.
get
(
'url_password'
,
''
)
netloc
=
parsed
[
1
]
elif
'@'
in
parsed
[
1
]:
credentials
,
netloc
=
parsed
[
1
]
.
split
(
'@'
,
1
)
if
':'
in
credentials
:
username
,
password
=
credentials
.
split
(
':'
,
1
)
else
:
username
=
credentials
password
=
''
parsed
=
list
(
parsed
)
parsed
[
1
]
=
netloc
...
...
library/network/get_url
View file @
5b635b9e
...
...
@@ -90,6 +90,18 @@ options:
required: false
default: 'yes'
choices: ['yes', 'no']
url_username:
description:
- The username for use in HTTP basic authentication. This parameter can be used
without C(url_password) for sites that allow empty passwords.
required: false
version_added: '1.6'
url_password:
description:
- The password for use in HTTP basic authentication. If the C(url_username)
parameter is not specified, the C(url_password) parameter will not be used.
required: false
version_added: '1.6'
others:
description:
- all arguments accepted by the M(file) module also work here
...
...
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