From 725d4d4bc8639f1e351bdbb9149690f27fb1f398 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 24 Aug 2017 08:43:19 -0400 Subject: [PATCH] added diff as new keyword (#28581) added diff to fake options in ec2_vpc_nat_gateway test --- lib/ansible/playbook/base.py | 1 + lib/ansible/playbook/play_context.py | 6 ++++-- test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/ansible/playbook/base.py b/lib/ansible/playbook/base.py index 4b553c536e7..572c30f30c3 100644 --- a/lib/ansible/playbook/base.py +++ b/lib/ansible/playbook/base.py @@ -164,6 +164,7 @@ class Base(with_metaclass(BaseMeta, object)): _run_once = FieldAttribute(isa='bool') _ignore_errors = FieldAttribute(isa='bool') _check_mode = FieldAttribute(isa='bool') + _diff = FieldAttribute(isa='bool') _any_errors_fatal = FieldAttribute(isa='bool', default=C.ANY_ERRORS_FATAL, always_post_validate=True) # param names which have been deprecated/removed diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index 1f654bd6172..305a1258b4f 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -242,11 +242,9 @@ class PlayContext(Base): _verbosity = FieldAttribute(isa='int', default=0) _only_tags = FieldAttribute(isa='set', default=set()) _skip_tags = FieldAttribute(isa='set', default=set()) - _check_mode = FieldAttribute(isa='bool', default=False) _force_handlers = FieldAttribute(isa='bool', default=False) _start_at_task = FieldAttribute(isa='string') _step = FieldAttribute(isa='bool', default=False) - _diff = FieldAttribute(isa='bool') # Fact gathering settings _gather_subset = FieldAttribute(isa='string', default=C.DEFAULT_GATHER_SUBSET) @@ -336,6 +334,7 @@ class PlayContext(Base): self.become_user = options.become_user self.check_mode = boolean(options.check, strict=False) + self.diff = boolean(options.diff, strict=False) # general flags (should we move out?) # for flag in ('connection', 'remote_user', 'private_key_file', 'verbosity', 'force_handlers', 'step', 'start_at_task', 'diff'): @@ -511,6 +510,9 @@ class PlayContext(Base): if task.check_mode is not None: new_info.check_mode = task.check_mode + if task.diff is not None: + new_info.diff = task.diff + return new_info def make_become_cmd(self, cmd, executable=None): diff --git a/test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py b/test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py index 7b97c359f83..9a5af4c386b 100644 --- a/test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py +++ b/test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py @@ -20,7 +20,7 @@ Options = ( 'connection', 'module_path', 'forks', 'become', 'become_method', 'become_user', 'remote_user', 'private_key_file', 'ssh_common_args', 'sftp_extra_args', 'scp_extra_args', 'ssh_extra_args', 'verbosity', - 'check' + 'check', 'diff' ] ) ) @@ -34,7 +34,7 @@ options = ( forks=1, become=None, become_method=None, become_user=None, check=True, remote_user=None, private_key_file=None, ssh_common_args=None, sftp_extra_args=None, scp_extra_args=None, ssh_extra_args=None, - verbosity=3 + verbosity=3, diff=False ) ) passwords = dict(vault_pass='')