Port cs_facts to the ansible 2.4 facts API (#27257)

* Port cs_facts to the ansible 2.4 facts API

Fixes #27256
References #27254
pull/27235/merge
Toshio Kuratomi 7 years ago committed by GitHub
parent 197a360977
commit 0d290bddda

@ -106,7 +106,7 @@ cloudstack_user_data:
import os import os
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url from ansible.module_utils.urls import fetch_url
from ansible.module_utils.facts import ansible_facts, module from ansible.module_utils.facts import ansible_collector, default_collectors
try: try:
import yaml import yaml
@ -121,7 +121,12 @@ CS_USERDATA_BASE_URL = "http://%s/latest/user-data"
class CloudStackFacts(object): class CloudStackFacts(object):
def __init__(self): def __init__(self):
self.facts = ansible_facts(module) collector = ansible_collector.get_ansible_collector(all_collector_classes=default_collectors.collectors,
filter_spec='default_ipv4',
gather_subset=['!all', 'network'],
gather_timeout=10)
self.facts = collector.collect(module)
self.api_ip = None self.api_ip = None
self.fact_paths = { self.fact_paths = {
'cloudstack_service_offering': 'service-offering', 'cloudstack_service_offering': 'service-offering',

Loading…
Cancel
Save