ACI: Avoid using 'previous' with query operations (#36181)

When ACI modules are being used for querying MOs, we should not return
the previous state, as there is no previous state, there's only the
current state.

This impacts a lot of tests that were used to testing the current state
as 'previous'.
This commit is contained in:
Dag Wieers
2018-02-14 23:07:07 +01:00
committed by GitHub
parent 0cf70a8970
commit dba561efa7
22 changed files with 142 additions and 140 deletions

View File

@@ -930,8 +930,9 @@ class ACIModule(object):
def exit_json(self, **kwargs):
if self.params['output_level'] in ('debug', 'info'):
self.result['previous'] = self.existing
if self.params['state'] in ('absent', 'present'):
if self.params['output_level'] in ('debug', 'info'):
self.result['previous'] = self.existing
# Return the gory details when we need it
if self.params['output_level'] == 'debug':
@@ -945,13 +946,13 @@ class ACIModule(object):
self.original = self.existing
if self.params['state'] in ('absent', 'present'):
self.get_existing()
self.result['current'] = self.existing
# if self.module._diff and self.original != self.existing:
# self.result['diff'] = dict(
# before=json.dumps(self.original, sort_keys=True, indent=4),
# after=json.dumps(self.existing, sort_keys=True, indent=4),
# )
# if self.module._diff and self.original != self.existing:
# self.result['diff'] = dict(
# before=json.dumps(self.original, sort_keys=True, indent=4),
# after=json.dumps(self.existing, sort_keys=True, indent=4),
# )
self.result['current'] = self.existing
if self.params['output_level'] in ('debug', 'info'):
self.result['sent'] = self.config
@@ -966,8 +967,9 @@ class ACIModule(object):
if self.error['code'] is not None and self.error['text'] is not None:
self.result['error'] = self.error
if self.params['output_level'] in ('debug', 'info'):
self.result['previous'] = self.existing
if self.params['state'] in ('absent', 'present'):
if self.params['output_level'] in ('debug', 'info'):
self.result['previous'] = self.existing
# Return the gory details when we need it
if self.params['output_level'] == 'debug':