raw now returns changed: true (#17112)

for consistency w/ shell/command/script "non-idempotent" modules.

Updated tests, changelog.
pull/17116/head
Matt Davis 8 years ago committed by GitHub
parent 81d7e132f9
commit e0bdb502e3

@ -7,6 +7,7 @@ Ansible Changes By Release
* Added the `listen` feature for modules. This feature allows tasks to more easily notify multiple handlers, as well as making it easier for handlers from decoupled roles to be notified.
* Added support for binary modules
* `raw` now returns `changed: true` to be consistent with shell/command/script modules. Add `changed_when: false` to `raw` tasks to restore the pre-2.2 behavior if necessary.
* The service module has been changed to use system specific modules if they exist and fallback to the old service module if they cannot be found or detected.
* Several Windows facts were modified or renamed for consistency with their Unix counterparts, and many new facts were added. If your playbooks rely on any of the following keys, please ensure they are using the correct key names and/or values:
- ansible_date_time.date (changed to use yyyy-mm-dd format instead of default system-locale format)

@ -40,4 +40,6 @@ class ActionModule(ActionBase):
executable = self._task.args.get('executable', False)
result.update(self._low_level_execute_command(self._task.args.get('_raw_params'), executable=executable))
result['changed'] = True
return result

@ -27,7 +27,7 @@
- "getmac_result.stdout"
- "not getmac_result.stderr"
- "not getmac_result|failed"
- "not getmac_result|changed"
- "getmac_result|changed"
- name: run ipconfig with /all argument
raw: ipconfig /all
@ -41,7 +41,7 @@
- "'Physical Address' in ipconfig_result.stdout"
- "not ipconfig_result.stderr"
- "not ipconfig_result|failed"
- "not ipconfig_result|changed"
- "ipconfig_result|changed"
- name: run ipconfig with invalid argument
raw: ipconfig /badswitch
@ -55,7 +55,7 @@
- "ipconfig_invalid_result.stdout" # ipconfig displays errors on stdout.
- "not ipconfig_invalid_result.stderr"
- "ipconfig_invalid_result|failed"
- "not ipconfig_invalid_result|changed"
- "ipconfig_invalid_result|changed"
- name: run an unknown command
raw: uname -a
@ -69,7 +69,7 @@
- "not unknown_result.stdout"
- "unknown_result.stderr" # An unknown command displays error on stderr.
- "unknown_result|failed"
- "not unknown_result|changed"
- "unknown_result|changed"
- name: run a command that takes longer than 60 seconds
raw: Start-Sleep -s 75
@ -82,7 +82,7 @@
- "not sleep_command.stdout"
- "not sleep_command.stderr"
- "not sleep_command|failed"
- "not sleep_command|changed"
- "sleep_command|changed"
- name: run a raw command with key=value arguments
raw: echo wwe=raw

@ -9,7 +9,10 @@
raw: echo 汉语
register: command
- name: check output of raw with unicode arg and output
assert: { that: "'汉语' in command.stdout" }
assert:
that:
- "'汉语' in command.stdout"
- command | changed # as of 2.2, raw should default to changed: true for consistency w/ shell/command/script modules
### copy local file with unicode filename and content

@ -9,7 +9,10 @@
raw: echo 汉语
register: command
- name: check output of raw with unicode arg and output
assert: { that: "'汉语' in command.stdout" }
assert:
that:
- "'汉语' in command.stdout"
- command | changed # as of 2.2, raw should default to changed: true for consistency w/ shell/command/script modules
### copy local file with unicode filename and content

Loading…
Cancel
Save