Update network common code to support new states (#65534)
* Update the network common code to support the new resource modules state - parsed, rendered and gathered. * For states parsed and rendered active connection to remote host is not required.
This commit is contained in:
parent
96df2bdcf3
commit
4352e39989
2 changed files with 10 additions and 2 deletions
|
@ -13,6 +13,12 @@ from ansible.module_utils.network.common.network import get_resource_connection
|
|||
class ConfigBase(object):
|
||||
""" The base class for all resource modules
|
||||
"""
|
||||
ACTION_STATES = ['merged', 'replaced', 'overridden', 'deleted']
|
||||
|
||||
def __init__(self, module):
|
||||
self._module = module
|
||||
self._connection = get_resource_connection(module)
|
||||
self.state = module.params['state']
|
||||
self._connection = None
|
||||
|
||||
if self.state not in ['rendered', 'parsed']:
|
||||
self._connection = get_resource_connection(module)
|
||||
|
|
|
@ -20,7 +20,9 @@ class FactsBase(object):
|
|||
self._warnings = []
|
||||
self._gather_subset = module.params.get('gather_subset')
|
||||
self._gather_network_resources = module.params.get('gather_network_resources')
|
||||
self._connection = get_resource_connection(module)
|
||||
self._connection = None
|
||||
if module.params.get('state') not in ['rendered', 'parsed']:
|
||||
self._connection = get_resource_connection(module)
|
||||
|
||||
self.ansible_facts = {'ansible_network_resources': {}}
|
||||
self.ansible_facts['ansible_net_gather_network_resources'] = list()
|
||||
|
|
Loading…
Reference in a new issue