mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-02 06:23:22 -07:00
yarn: Fix state=latest not working with global=true (#5829)
* Yarn module: fix state=latest not working with global=true * fix whitespace * add changelog fragment * add integration test cases * add only tests for this PR (install+upgrade) * fix assuming default global dir * fix list() not working when global=true and name a package with no binary * remove ignores * whitespace * Update changelogs/fragments/5829-fix-yarn-global.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/5829-fix-yarn-global.yml Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --------- Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
cd0a414e9f
commit
4c4ef80ca9
8 changed files with 112 additions and 25 deletions
|
@ -39,6 +39,7 @@
|
|||
package: 'iconv-lite'
|
||||
environment:
|
||||
PATH: "{{ node_bin_path }}:{{ansible_env.PATH}}"
|
||||
YARN_IGNORE_ENGINES: true
|
||||
block:
|
||||
|
||||
# Get the version of Yarn and register to a variable
|
||||
|
@ -135,3 +136,89 @@
|
|||
assert:
|
||||
that:
|
||||
- yarn_uninstall_package is changed
|
||||
|
||||
- name: 'Global install binary with explicit version (older version of package)'
|
||||
yarn:
|
||||
global: true
|
||||
executable: '{{ yarn_bin_path }}/yarn'
|
||||
name: prettier
|
||||
version: 2.0.0
|
||||
state: present
|
||||
environment:
|
||||
PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}'
|
||||
register: yarn_global_install_old_binary
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- yarn_global_install_old_binary is changed
|
||||
|
||||
- name: 'Global upgrade old binary'
|
||||
yarn:
|
||||
global: true
|
||||
executable: '{{ yarn_bin_path }}/yarn'
|
||||
name: prettier
|
||||
state: latest
|
||||
environment:
|
||||
PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}'
|
||||
register: yarn_global_update_old_binary
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- yarn_global_update_old_binary is changed
|
||||
|
||||
- name: 'Global remove a binary'
|
||||
yarn:
|
||||
global: true
|
||||
executable: '{{ yarn_bin_path }}/yarn'
|
||||
name: prettier
|
||||
state: absent
|
||||
environment:
|
||||
PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}'
|
||||
register: yarn_global_uninstall_binary
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- yarn_global_uninstall_binary is changed
|
||||
|
||||
- name: 'Global install package with no binary with explicit version (older version of package)'
|
||||
yarn:
|
||||
global: true
|
||||
executable: '{{ yarn_bin_path }}/yarn'
|
||||
name: left-pad
|
||||
version: 1.1.0
|
||||
state: present
|
||||
environment:
|
||||
PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}'
|
||||
register: yarn_global_install_old_package
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- yarn_global_install_old_package is changed
|
||||
|
||||
- name: 'Global upgrade old package with no binary'
|
||||
yarn:
|
||||
global: true
|
||||
executable: '{{ yarn_bin_path }}/yarn'
|
||||
name: left-pad
|
||||
state: latest
|
||||
environment:
|
||||
PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}'
|
||||
register: yarn_global_update_old_package
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- yarn_global_update_old_package is changed
|
||||
|
||||
- name: 'Global remove a package with no binary'
|
||||
yarn:
|
||||
global: true
|
||||
executable: '{{ yarn_bin_path }}/yarn'
|
||||
name: left-pad
|
||||
state: absent
|
||||
environment:
|
||||
PATH: '{{ node_bin_path }}:{{ ansible_env.PATH }}'
|
||||
register: yarn_global_uninstall_package
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- yarn_global_uninstall_package is changed
|
||||
|
|
|
@ -24,6 +24,5 @@ plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice
|
|||
plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0
|
||||
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/xfconf.py validate-modules:return-syntax-error
|
||||
plugins/modules/yarn.py use-argspec-type-path
|
||||
tests/integration/targets/django_manage/files/base_test/simple_project/p1/manage.py compile-2.6 # django generated code
|
||||
tests/integration/targets/django_manage/files/base_test/simple_project/p1/manage.py compile-2.7 # django generated code
|
||||
|
|
|
@ -19,4 +19,3 @@ plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice
|
|||
plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0
|
||||
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/xfconf.py validate-modules:return-syntax-error
|
||||
plugins/modules/yarn.py use-argspec-type-path
|
||||
|
|
|
@ -19,4 +19,3 @@ plugins/modules/rax_files.py validate-modules:parameter-state-invalid-choice
|
|||
plugins/modules/rax.py use-argspec-type-path # module deprecated - removed in 9.0.0
|
||||
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/xfconf.py validate-modules:return-syntax-error
|
||||
plugins/modules/yarn.py use-argspec-type-path
|
||||
|
|
|
@ -21,4 +21,3 @@ plugins/modules/rax.py use-argspec-type-path
|
|||
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/xfconf.py validate-modules:return-syntax-error
|
||||
plugins/modules/yarn.py use-argspec-type-path
|
||||
|
|
|
@ -21,4 +21,3 @@ plugins/modules/rax.py use-argspec-type-path
|
|||
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/xfconf.py validate-modules:return-syntax-error
|
||||
plugins/modules/yarn.py use-argspec-type-path
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue