mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
yarn: Fix handling of empty outdated & scoped packages (#474)
* Fixed index out of range in yarn module when no packages are outdated * Fixed handling of yarn dependencies when scoped modules are installed * Added changelog fragment for yarn module fixes * Adhere changelogs/fragments/474-yarn_fix-outdated-fix-list.yml to current standards Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> * Added scoped package to yarn integration test Co-authored-by: Jan Gaßner <jan.gassner@plusserver.com> Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
This commit is contained in:
parent
80cd8329e0
commit
eb2369a934
3 changed files with 9 additions and 2 deletions
3
changelogs/fragments/474-yarn_fix-outdated-fix-list.yml
Normal file
3
changelogs/fragments/474-yarn_fix-outdated-fix-list.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
bugfixes:
|
||||
- yarn - fixed an index out of range error when no outdated packages where returned by yarn executable (see https://github.com/ansible-collections/community.general/pull/474).
|
||||
- yarn - fixed an too many values to unpack error when scoped packages are installed (see https://github.com/ansible-collections/community.general/pull/474).
|
|
@ -243,7 +243,7 @@ class Yarn(object):
|
|||
return installed, missing
|
||||
|
||||
for dep in dependencies:
|
||||
name, version = dep['name'].split('@')
|
||||
name, version = dep['name'].rsplit('@', 1)
|
||||
installed.append(name)
|
||||
|
||||
if self.name not in installed:
|
||||
|
@ -274,6 +274,9 @@ class Yarn(object):
|
|||
if err:
|
||||
self.module.fail_json(msg=err)
|
||||
|
||||
if not cmd_result:
|
||||
return outdated
|
||||
|
||||
outdated_packages_data = cmd_result.splitlines()[1]
|
||||
|
||||
data = json.loads(outdated_packages_data)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"iconv-lite": "^0.4.21"
|
||||
"iconv-lite": "^0.4.21",
|
||||
"@types/node": "^12.0.0"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue