Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kolla Ansible
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Very Demiurge Very Mindful
Kolla Ansible
Commits
e355132b
Commit
e355132b
authored
9 years ago
by
Jenkins
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Fix the docker may return a empty dict when pull images"
parents
63f07948
7fe22629
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ansible/library/kolla_docker.py
+21
-17
21 additions, 17 deletions
ansible/library/kolla_docker.py
with
21 additions
and
17 deletions
ansible/library/kolla_docker.py
+
21
−
17
View file @
e355132b
...
@@ -211,28 +211,32 @@ class DockerWorker(object):
...
@@ -211,28 +211,32 @@ class DockerWorker(object):
image
,
tag
=
self
.
parse_image
()
image
,
tag
=
self
.
parse_image
()
status
=
[
status
es
=
[
json
.
loads
(
line
.
strip
())
for
line
in
self
.
dc
.
pull
(
json
.
loads
(
line
.
strip
())
for
line
in
self
.
dc
.
pull
(
repository
=
image
,
tag
=
tag
,
stream
=
True
repository
=
image
,
tag
=
tag
,
stream
=
True
)
)
]
]
# NOTE(SamYaple): This allows us to use v1 and v2 docker registries.
for
status
in
reversed
(
statuses
):
# Eventually docker will stop supporting v1 registries and when
# NOTE(jeffrey4l): Get the last not empty status with status
# that happens we can remove this.
# property
search
=
-
2
if
'
legacy registry
'
in
status
[
-
1
].
get
(
'
status
'
)
else
-
1
if
status
and
status
.
get
(
'
status
'
):
# NOTE(SamYaple): This allows us to use v1 and v2 docker
if
"
Downloaded newer image for
"
in
status
[
search
].
get
(
'
status
'
):
# registries. Eventually docker will stop supporting v1
self
.
changed
=
True
# registries and when that happens we can remove this.
elif
"
Image is up to date for
"
in
status
[
search
].
get
(
'
status
'
):
if
'
legacy registry
'
in
status
.
get
(
'
status
'
):
# No new layer was pulled, no change
continue
pass
elif
"
Downloaded newer image for
"
in
status
.
get
(
'
status
'
):
else
:
self
.
changed
=
True
self
.
module
.
fail_json
(
return
msg
=
"
Invalid status returned from pull
"
,
elif
"
Image is up to date for
"
in
status
.
get
(
'
status
'
):
changed
=
True
,
return
failed
=
True
else
:
)
self
.
module
.
fail_json
(
msg
=
"
Invalid status returned from pull
"
,
changed
=
True
,
failed
=
True
)
def
remove_container
(
self
):
def
remove_container
(
self
):
if
self
.
check_container
():
if
self
.
check_container
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment