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>
pull/694/head
Jan Gaßner 2020-07-23 09:19:32 +02:00 committed by GitHub
parent 80cd8329e0
commit eb2369a934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View 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).

View File

@ -243,7 +243,7 @@ class Yarn(object):
return installed, missing return installed, missing
for dep in dependencies: for dep in dependencies:
name, version = dep['name'].split('@') name, version = dep['name'].rsplit('@', 1)
installed.append(name) installed.append(name)
if self.name not in installed: if self.name not in installed:
@ -274,6 +274,9 @@ class Yarn(object):
if err: if err:
self.module.fail_json(msg=err) self.module.fail_json(msg=err)
if not cmd_result:
return outdated
outdated_packages_data = cmd_result.splitlines()[1] outdated_packages_data = cmd_result.splitlines()[1]
data = json.loads(outdated_packages_data) data = json.loads(outdated_packages_data)

View File

@ -3,6 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"iconv-lite": "^0.4.21" "iconv-lite": "^0.4.21",
"@types/node": "^12.0.0"
} }
} }