mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
new parameter: 'registry' for NPM module
This commit is contained in:
parent
0fe1cd5c61
commit
74d5591af7
@ -43,7 +43,8 @@ def _valid_version():
|
||||
|
||||
def install(pkg=None,
|
||||
dir=None,
|
||||
runas=None):
|
||||
runas=None,
|
||||
registry=None):
|
||||
'''
|
||||
Install an NPM package.
|
||||
|
||||
@ -62,6 +63,9 @@ def install(pkg=None,
|
||||
runas
|
||||
The user to run NPM with
|
||||
|
||||
registry
|
||||
The NPM registry to install the package from.
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
@ -79,6 +83,9 @@ def install(pkg=None,
|
||||
if dir is None:
|
||||
cmd += ' --global'
|
||||
|
||||
if registry:
|
||||
cmd += ' --registry="{0}"'.format(registry)
|
||||
|
||||
if pkg:
|
||||
cmd += ' "{0}"'.format(pkg)
|
||||
|
||||
|
@ -35,7 +35,8 @@ def installed(name,
|
||||
dir=None,
|
||||
runas=None,
|
||||
user=None,
|
||||
force_reinstall=False):
|
||||
force_reinstall=False,
|
||||
registry=None):
|
||||
'''
|
||||
Verify that the given package is installed and is at the correct version
|
||||
(if specified).
|
||||
@ -63,6 +64,9 @@ def installed(name,
|
||||
user
|
||||
The user to run NPM with
|
||||
|
||||
registry
|
||||
The NPM registry to install the package from.
|
||||
|
||||
.. versionadded:: 0.17.0
|
||||
|
||||
force_reinstall
|
||||
@ -97,7 +101,9 @@ def installed(name,
|
||||
prefix = name.split('@')[0].strip()
|
||||
|
||||
try:
|
||||
installed_pkgs = __salt__['npm.list'](pkg=name, dir=dir)
|
||||
installed_pkgs = __salt__['npm.list'](pkg=name,
|
||||
dir=dir,
|
||||
registry=registry)
|
||||
except (CommandNotFoundError, CommandExecutionError) as err:
|
||||
ret['result'] = False
|
||||
ret['comment'] = 'Error installing \'{0}\': {1}'.format(name, err)
|
||||
|
Loading…
Reference in New Issue
Block a user