cloudstack: fix pep8 cs_facts

pull/25121/head
Rene Moser 7 years ago committed by René Moser
parent 439f0beca5
commit 3ef37e88fe

@ -104,16 +104,20 @@ cloudstack_user_data:
'''
import os
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url
from ansible.module_utils.facts import ansible_facts, module
try:
import yaml
has_lib_yaml = True
HAS_LIB_YAML = True
except ImportError:
has_lib_yaml = False
HAS_LIB_YAML = False
CS_METADATA_BASE_URL = "http://%s/latest/meta-data"
CS_USERDATA_BASE_URL = "http://%s/latest/user-data"
class CloudStackFacts(object):
def __init__(self):
@ -143,7 +147,6 @@ class CloudStackFacts(object):
result[filter] = self._fetch(CS_METADATA_BASE_URL + "/" + self.fact_paths[filter])
return result
def _get_user_data_json(self):
try:
# this data come form users, we try what we can to parse it...
@ -151,7 +154,6 @@ class CloudStackFacts(object):
except:
return None
def _fetch(self, path):
api_ip = self._get_api_ip()
if not api_ip:
@ -164,7 +166,6 @@ class CloudStackFacts(object):
data = None
return data
def _get_dhcp_lease_file(self):
"""Return the path of the lease file."""
default_iface = self.facts['default_ipv4']['interface']
@ -179,7 +180,6 @@ class CloudStackFacts(object):
return file_path
module.fail_json(msg="Could not find dhclient leases file.")
def _get_api_ip(self):
"""Return the IP of the DHCP server."""
if not self.api_ip:
@ -213,15 +213,13 @@ def main():
supports_check_mode=False
)
if not has_lib_yaml:
if not HAS_LIB_YAML:
module.fail_json(msg="missing python library: yaml")
cs_facts = CloudStackFacts().run()
cs_facts_result = dict(changed=False, ansible_facts=cs_facts)
module.exit_json(**cs_facts_result)
from ansible.module_utils.basic import *
from ansible.module_utils.urls import *
from ansible.module_utils.facts import *
if __name__ == '__main__':
main()

@ -165,7 +165,6 @@ lib/ansible/modules/cloud/azure/azure_rm_virtualnetwork_facts.py
lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py
lib/ansible/modules/cloud/cloudscale/cloudscale_server.py
lib/ansible/modules/cloud/cloudstack/cs_configuration.py
lib/ansible/modules/cloud/cloudstack/cs_facts.py
lib/ansible/modules/cloud/cloudstack/cs_instance.py
lib/ansible/modules/cloud/cloudstack/cs_instance_facts.py
lib/ansible/modules/cloud/cloudstack/cs_instancegroup.py

Loading…
Cancel
Save