Skip to content

Commit

Permalink
npm state: installed -> installed_pkgs, to avoid shadowing func of sa…
Browse files Browse the repository at this point in the history
…me name
  • Loading branch information
cvrebert authored and basepi committed May 17, 2013
1 parent baeea6d commit 677fadf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions salt/states/npm.py
Expand Up @@ -30,13 +30,13 @@ def installed(name,
prefix = name.split('@')[0].split('<')[0].split('>')[0].strip()

try:
installed = __salt__['npm.list'](dir=dir)
installed_pkgs = __salt__['npm.list'](dir=dir)
except (CommandNotFoundError, CommandExecutionError) as err:
ret['result'] = False
ret['comment'] = 'Error installing \'{0}\': {1}'.format(name, err)
return ret

if prefix.lower() in (p.lower() for p in installed):
if prefix.lower() in (p.lower() for p in installed_pkgs):
if force_reinstall is False:
ret['result'] = True
ret['comment'] = 'Package already installed'
Expand Down Expand Up @@ -88,13 +88,13 @@ def removed(name,
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

try:
installed = __salt__['npm.list'](dir=dir)
installed_pkgs = __salt__['npm.list'](dir=dir)
except (CommandExecutionError, CommandNotFoundError) as err:
ret['result'] = False
ret['comment'] = 'Error uninstalling \'{0}\': {1}'.format(name, err)
return ret

if name not in installed:
if name not in installed_pkgs:
ret["result"] = True
ret["comment"] = "Package is not installed."
return ret
Expand Down

0 comments on commit 677fadf

Please sign in to comment.