move get_distribution_version() to basic.py
This commit is contained in:
parent
bd69e9f265
commit
f522425415
1 changed files with 5 additions and 16 deletions
21
system/hostname
Normal file → Executable file
21
system/hostname
Normal file → Executable file
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue