Fixing new ignore scripts option logic and name for the npm module

reviewable/pr18780/r1
James Cammarata 10 years ago
parent cf320adb43
commit 72b92a4b0e

@ -50,12 +50,13 @@ options:
- The executable location for npm. - The executable location for npm.
- This is useful if you are using a version manager, such as nvm - This is useful if you are using a version manager, such as nvm
required: false required: false
ignoreScripts: ignore_scripts:
description: description:
- Use the --ignore-scripts flag when installing. - Use the --ignore-scripts flag when installing.
required: false required: false
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
default: no default: no
version_added: "1.8"
production: production:
description: description:
- Install dependencies in production mode, excluding devDependencies - Install dependencies in production mode, excluding devDependencies
@ -117,7 +118,7 @@ class Npm(object):
self.path = kwargs['path'] self.path = kwargs['path']
self.registry = kwargs['registry'] self.registry = kwargs['registry']
self.production = kwargs['production'] self.production = kwargs['production']
self.ignoreScripts = kwargs['ignoreScripts'] self.ignore_scripts = kwargs['ignore_scripts']
if kwargs['executable']: if kwargs['executable']:
self.executable = kwargs['executable'].split(' ') self.executable = kwargs['executable'].split(' ')
@ -137,7 +138,7 @@ class Npm(object):
cmd.append('--global') cmd.append('--global')
if self.production: if self.production:
cmd.append('--production') cmd.append('--production')
if self.ignoreScripts: if self.ignore_scripts:
cmd.append('--ignore-scripts') cmd.append('--ignore-scripts')
if self.name: if self.name:
cmd.append(self.name_version) cmd.append(self.name_version)
@ -226,6 +227,7 @@ def main():
executable = module.params['executable'] executable = module.params['executable']
registry = module.params['registry'] registry = module.params['registry']
state = module.params['state'] state = module.params['state']
ignore_scripts = module.params['ignore_scripts']
if not path and not glbl: if not path and not glbl:
module.fail_json(msg='path must be specified when not using global') module.fail_json(msg='path must be specified when not using global')
@ -233,7 +235,7 @@ def main():
module.fail_json(msg='uninstalling a package is only available for named packages') module.fail_json(msg='uninstalling a package is only available for named packages')
npm = Npm(module, name=name, path=path, version=version, glbl=glbl, production=production, \ npm = Npm(module, name=name, path=path, version=version, glbl=glbl, production=production, \
executable=executable, registry=registry) executable=executable, registry=registry, ignore_scripts=ignore_scripts)
changed = False changed = False
if state == 'present': if state == 'present':

Loading…
Cancel
Save