mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
npm - fix installing from package.json (#2924)
correctly handle cases where a dependency does not have a `version` property because it is either missing or invalid
This commit is contained in:
parent
ffe505a798
commit
a0915036f9
3 changed files with 25 additions and 2 deletions
|
@ -216,7 +216,6 @@ class Npm(object):
|
|||
self.module.fail_json(msg="Failed to parse NPM output with error %s" % to_native(e))
|
||||
if 'dependencies' in data:
|
||||
for dep, props in data['dependencies'].items():
|
||||
dep_version = dep + '@' + str(props['version'])
|
||||
|
||||
if 'missing' in props and props['missing']:
|
||||
missing.append(dep)
|
||||
|
@ -224,7 +223,9 @@ class Npm(object):
|
|||
missing.append(dep)
|
||||
else:
|
||||
installed.append(dep)
|
||||
installed.append(dep_version)
|
||||
if 'version' in props and props['version']:
|
||||
dep_version = dep + '@' + str(props['version'])
|
||||
installed.append(dep_version)
|
||||
if self.name_version and self.name_version not in installed:
|
||||
missing.append(self.name)
|
||||
# Named dependency not installed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue