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
e3f5af37
Commit
e3f5af37
authored
Jun 16, 2014
by
Ruggero Marchei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move get_distribution_version() to basic.py
parent
c53c6a50
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
lib/ansible/module_utils/basic.py
+12
-0
library/system/hostname
+5
-16
No files found.
lib/ansible/module_utils/basic.py
View file @
e3f5af37
...
...
@@ -142,6 +142,18 @@ def get_distribution():
distribution
=
None
return
distribution
def
get_distribution_version
():
''' return the distribution version '''
if
platform
.
system
()
==
'Linux'
:
try
:
distribution_version
=
platform
.
linux_distribution
()[
1
]
except
:
# FIXME: MethodMissing, I assume?
distribution_version
=
platform
.
dist
()[
1
]
else
:
distribution_version
=
None
return
distribution_version
def
load_platform_subclass
(
cls
,
*
args
,
**
kwargs
):
'''
used by modules like User to have different implementations based on detected platform. See User
...
...
library/system/hostname
100644 → 100755
View file @
e3f5af37
...
...
@@ -39,20 +39,8 @@ EXAMPLES = '''
- hostname: name=web01
'''
import
platform
def
get_distribution_version
():
''' return the distribution version '''
if
platform
.
system
()
==
'Linux'
:
try
:
distribution_version
=
platform
.
linux_distribution
()[
1
]
except
:
# FIXME: MethodMissing, I assume?
distribution_version
=
platform
.
dist
()[
1
]
else
:
distribution_version
=
None
return
distribution_version
# import module snippets
from
ansible.module_utils.basic
import
*
class
UnimplementedStrategy
(
object
):
...
...
@@ -283,6 +271,9 @@ class FedoraStrategy(GenericStrategy):
self
.
module
.
fail_json
(
msg
=
"Command failed rc=
%
d, out=
%
s, err=
%
s"
%
(
rc
,
out
,
err
))
# ===========================================
class
FedoraHostname
(
Hostname
):
platform
=
'Linux'
distribution
=
'Fedora'
...
...
@@ -380,6 +371,4 @@ def main():
module
.
exit_json
(
changed
=
changed
,
name
=
name
)
# import module snippets
from
ansible.module_utils.basic
import
*
main
()
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