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
8153c34a
Commit
8153c34a
authored
Jul 29, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now returns false on bad role_data
parent
e81ec327
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
lib/ansible/galaxy/role.py
+21
-19
No files found.
lib/ansible/galaxy/role.py
View file @
8153c34a
...
...
@@ -182,28 +182,30 @@ class GalaxyRole(object):
"""
Downloads the archived role from github to a temp location
"""
if
role_data
:
# first grab the file and save it to a temp location
if
"github_user"
in
role_data
and
"github_repo"
in
role_data
:
archive_url
=
'https://github.com/
%
s/
%
s/archive/
%
s.tar.gz'
%
(
role_data
[
"github_user"
],
role_data
[
"github_repo"
],
self
.
version
)
else
:
archive_url
=
self
.
src
self
.
display
.
display
(
"- downloading role from
%
s"
%
archive_url
)
# first grab the file and save it to a temp location
if
"github_user"
in
role_data
and
"github_repo"
in
role_data
:
archive_url
=
'https://github.com/
%
s/
%
s/archive/
%
s.tar.gz'
%
(
role_data
[
"github_user"
],
role_data
[
"github_repo"
],
self
.
version
)
else
:
archive_url
=
self
.
src
self
.
display
.
display
(
"- downloading role from
%
s"
%
archive_url
)
try
:
url_file
=
urlopen
(
archive_url
)
temp_file
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
)
data
=
url_file
.
read
()
while
data
:
temp_file
.
write
(
data
)
try
:
url_file
=
urlopen
(
archive_url
)
temp_file
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
)
data
=
url_file
.
read
()
temp_file
.
close
()
return
temp_file
.
name
except
:
# TODO: better urllib2 error handling for error
# messages that are more exact
self
.
display
.
error
(
"failed to download the file."
)
return
False
while
data
:
temp_file
.
write
(
data
)
data
=
url_file
.
read
()
temp_file
.
close
()
return
temp_file
.
name
except
:
# TODO: better urllib2 error handling for error
# messages that are more exact
self
.
display
.
error
(
"failed to download the file."
)
return
False
def
install
(
self
,
role_filename
):
# the file is a tar, so open it that way and extract it
...
...
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