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
49cf5831
Commit
49cf5831
authored
Jun 25, 2014
by
Stephen Paul Suarez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support old and new versions of APIError
parent
dfabf270
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
library/cloud/docker_image
+7
-2
No files found.
library/cloud/docker_image
View file @
49cf5831
...
...
@@ -113,6 +113,11 @@ except ImportError, e:
print
"failed=True msg='failed to import python module:
%
s'"
%
e
sys
.
exit
(
1
)
try
:
from
docker.errors
import
APIError
as
DockerAPIError
except
ImportError
:
from
docker.client
import
APIError
as
DockerAPIError
class
DockerImageManager
:
def
__init__
(
self
,
module
):
...
...
@@ -187,7 +192,7 @@ class DockerImageManager:
try
:
self
.
client
.
remove_image
(
i
[
'Id'
])
self
.
changed
=
True
except
docker
.
APIError
as
e
:
except
Docker
APIError
as
e
:
# image can be removed by docker if not used
pass
...
...
@@ -235,7 +240,7 @@ def main():
module
.
exit_json
(
failed
=
failed
,
changed
=
manager
.
has_changed
(),
msg
=
msg
,
image_id
=
image_id
)
except
docker
.
errors
.
APIError
as
e
:
except
Docker
APIError
as
e
:
module
.
exit_json
(
failed
=
True
,
changed
=
manager
.
has_changed
(),
msg
=
"Docker API error: "
+
e
.
explanation
)
except
RequestException
as
e
:
...
...
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