move get_distribution_version() to basic.py

reviewable/pr18780/r1
Ruggero Marchei 11 years ago
parent bd69e9f265
commit f522425415

@ -39,20 +39,8 @@ EXAMPLES = '''
- hostname: name=web01 - hostname: name=web01
''' '''
import platform # import module snippets
from ansible.module_utils.basic import *
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
class UnimplementedStrategy(object): class UnimplementedStrategy(object):
@ -283,6 +271,9 @@ class FedoraStrategy(GenericStrategy):
self.module.fail_json(msg="Command failed rc=%d, out=%s, err=%s" % self.module.fail_json(msg="Command failed rc=%d, out=%s, err=%s" %
(rc, out, err)) (rc, out, err))
# ===========================================
class FedoraHostname(Hostname): class FedoraHostname(Hostname):
platform = 'Linux' platform = 'Linux'
distribution = 'Fedora' distribution = 'Fedora'
@ -380,6 +371,4 @@ def main():
module.exit_json(changed=changed, name=name) module.exit_json(changed=changed, name=name)
# import module snippets
from ansible.module_utils.basic import *
main() main()

Loading…
Cancel
Save