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
b1785a03
Commit
b1785a03
authored
Aug 25, 2015
by
objectified
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace compare_versions() with distutils.version
parent
c39fb43a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
lib/ansible/plugins/connections/docker.py
+3
-7
No files found.
lib/ansible/plugins/connections/docker.py
View file @
b1785a03
...
...
@@ -26,6 +26,8 @@ import subprocess
import
time
import
re
from
distutils.version
import
LooseVersion
import
ansible.constants
as
C
from
ansible
import
errors
...
...
@@ -46,7 +48,7 @@ class Connection(ConnectionBase):
self
.
can_copy_bothways
=
False
docker_version
=
self
.
_get_docker_version
()
if
self
.
compare_versions
(
docker_version
,
'1.8.0'
)
>=
0
:
if
LooseVersion
(
docker_version
)
>=
LooseVersion
(
'1.8.0'
)
:
self
.
can_copy_bothways
=
True
def
_get_docker_version
(
self
):
...
...
@@ -76,12 +78,6 @@ class Connection(ConnectionBase):
def
transport
(
self
):
return
'docker'
def
compare_versions
(
self
,
version1
,
version2
):
# Source: https://stackoverflow.com/questions/1714027/version-number-comparison
def
normalize
(
v
):
return
[
int
(
x
)
for
x
in
re
.
sub
(
r'(\.0+)*$'
,
''
,
v
)
.
split
(
"."
)]
return
cmp
(
normalize
(
version1
),
normalize
(
version2
))
def
_connect
(
self
,
port
=
None
):
""" Connect to the container. Nothing to do """
if
not
self
.
_connected
:
...
...
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