mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Return correct values when running yarn in check mode (#153)
* Fixes Check Mode * Adds parenthesis * Adds changelog and tests
This commit is contained in:
parent
02a032aa45
commit
54014529bd
3 changed files with 22 additions and 1 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
bugfixes:
|
||||||
|
- yarn - Return correct values when running yarn in check mode (https://github.com/ansible-collections/community.general/pull/153).
|
|
@ -218,7 +218,7 @@ class Yarn(object):
|
||||||
rc, out, err = self.module.run_command(cmd, check_rc=check_rc, cwd=cwd)
|
rc, out, err = self.module.run_command(cmd, check_rc=check_rc, cwd=cwd)
|
||||||
return out, err
|
return out, err
|
||||||
|
|
||||||
return ''
|
return(None, None)
|
||||||
|
|
||||||
def list(self):
|
def list(self):
|
||||||
cmd = ['list', '--depth=0', '--json']
|
cmd = ['list', '--depth=0', '--json']
|
||||||
|
|
|
@ -69,6 +69,24 @@
|
||||||
that:
|
that:
|
||||||
- not (yarn_install is changed)
|
- not (yarn_install is changed)
|
||||||
|
|
||||||
|
- name: 'Install all packages in check mode.'
|
||||||
|
yarn:
|
||||||
|
path: '{{ output_dir }}'
|
||||||
|
executable: '{{ yarn_bin_path }}/yarn'
|
||||||
|
state: present
|
||||||
|
environment:
|
||||||
|
PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}'
|
||||||
|
check_mode: true
|
||||||
|
register: yarn_install_check
|
||||||
|
|
||||||
|
- name: verify test yarn global installation in check mode
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- yarn_install_check.err is defined
|
||||||
|
- yarn_install_check.out is defined
|
||||||
|
- yarn_install_check.err is none
|
||||||
|
- yarn_install_check.out is none
|
||||||
|
|
||||||
- name: 'Install package with explicit version (older version of package)'
|
- name: 'Install package with explicit version (older version of package)'
|
||||||
yarn:
|
yarn:
|
||||||
path: '{{ output_dir }}'
|
path: '{{ output_dir }}'
|
||||||
|
|
Loading…
Add table
Reference in a new issue