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
6f88f79d
Commit
6f88f79d
authored
Oct 05, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed dupe install code, now trap errors forom role.install
parent
f7332940
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
62 deletions
+22
-62
lib/ansible/cli/galaxy.py
+22
-62
No files found.
lib/ansible/cli/galaxy.py
View file @
6f88f79d
...
...
@@ -340,69 +340,29 @@ class GalaxyCLI(CLI):
self
.
display
.
display
(
'-
%
s is already installed, skipping.'
%
role
.
name
)
continue
tmp_file
=
None
installed
=
False
if
role
.
src
and
os
.
path
.
isfile
(
role
.
src
):
# installing a local tar.gz
tmp_file
=
role
.
src
else
:
if
role
.
scm
:
# create tar file from scm url
tmp_file
=
RoleRequirement
.
scm_archive_role
(
role
.
scm
,
role
.
src
,
role
.
version
,
role
.
name
)
if
role
.
src
:
if
'://'
not
in
role
.
src
:
role_data
=
self
.
api
.
lookup_role_by_name
(
role
.
src
)
if
not
role_data
:
self
.
display
.
warning
(
"- sorry,
%
s was not found on
%
s."
%
(
role
.
src
,
self
.
options
.
api_server
))
self
.
exit_without_ignore
()
continue
role_versions
=
self
.
api
.
fetch_role_related
(
'versions'
,
role_data
[
'id'
])
if
not
role
.
version
:
# convert the version names to LooseVersion objects
# and sort them to get the latest version. If there
# are no versions in the list, we'll grab the head
# of the master branch
if
len
(
role_versions
)
>
0
:
loose_versions
=
[
LooseVersion
(
a
.
get
(
'name'
,
None
))
for
a
in
role_versions
]
loose_versions
.
sort
()
role
.
version
=
str
(
loose_versions
[
-
1
])
else
:
role
.
version
=
'master'
elif
role
.
version
!=
'master'
:
if
role_versions
and
role
.
version
not
in
[
a
.
get
(
'name'
,
None
)
for
a
in
role_versions
]:
self
.
display
.
warning
(
'role is
%
s'
%
role
)
self
.
display
.
warning
(
"- the specified version (
%
s) was not found in the list of available versions (
%
s)."
%
(
role
.
version
,
role_versions
))
self
.
exit_without_ignore
()
continue
# download the role. if --no-deps was specified, we stop here,
# otherwise we recursively grab roles and all of their deps.
tmp_file
=
role
.
fetch
(
role_data
)
if
tmp_file
:
self
.
display
.
debug
(
'using
%
s'
%
tmp_file
)
installed
=
role
.
install
(
tmp_file
)
# we're done with the temp file, clean it up if we created it
if
tmp_file
!=
role
.
src
:
os
.
unlink
(
tmp_file
)
# install dependencies, if we want them
if
not
no_deps
and
installed
:
role_dependencies
=
role
.
metadata
.
get
(
'dependencies'
,
[])
for
dep
in
role_dependencies
:
self
.
display
.
debug
(
'Installing dep
%
s'
%
dep
)
dep_req
=
RoleRequirement
()
__
,
dep_name
,
__
=
dep_req
.
parse
(
dep
)
dep_role
=
GalaxyRole
(
self
.
galaxy
,
name
=
dep_name
)
if
dep_role
.
install_info
is
None
or
force
:
if
dep_role
not
in
roles_left
:
self
.
display
.
display
(
'- adding dependency:
%
s'
%
dep_name
)
roles_left
.
append
(
GalaxyRole
(
self
.
galaxy
,
name
=
dep_name
))
else
:
self
.
display
.
display
(
'- dependency
%
s already pending installation.'
%
dep_name
)
try
:
installed
=
role
.
install
()
except
AnsibleError
as
e
:
self
.
display
.
warning
(
"-
%
s was NOT installed successfully:
%
s "
%
(
role
.
name
,
str
(
e
)))
self
.
exit_without_ignore
()
continue
# install dependencies, if we want them
if
not
no_deps
and
installed
:
role_dependencies
=
role
.
metadata
.
get
(
'dependencies'
,
[])
for
dep
in
role_dependencies
:
self
.
display
.
debug
(
'Installing dep
%
s'
%
dep
)
dep_req
=
RoleRequirement
()
__
,
dep_name
,
__
=
dep_req
.
parse
(
dep
)
dep_role
=
GalaxyRole
(
self
.
galaxy
,
name
=
dep_name
)
if
dep_role
.
install_info
is
None
or
force
:
if
dep_role
not
in
roles_left
:
self
.
display
.
display
(
'- adding dependency:
%
s'
%
dep_name
)
roles_left
.
append
(
GalaxyRole
(
self
.
galaxy
,
name
=
dep_name
))
else
:
self
.
display
.
display
(
'- dependency
%
s is already installed, skipping.'
%
dep_name
)
self
.
display
.
display
(
'- dependency
%
s already pending installation.'
%
dep_name
)
else
:
self
.
display
.
display
(
'- dependency
%
s is already installed, skipping.'
%
dep_name
)
if
not
installed
:
self
.
display
.
warning
(
"-
%
s was NOT installed successfully."
%
role
.
name
)
...
...
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