aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2020-10-06 10:55:24 -0400
committerJake Hunsaker <jhunsake@redhat.com>2020-10-07 13:56:34 -0400
commit59c5c461e36103d453cd9ef9b6cb4624a8171fbe (patch)
tree9b0d1294c01bb93b70c03f384650961b48a420fb
parent651ffe21f4d3c694bfc9354311519bcde2856808 (diff)
downloadsos-59c5c461e36103d453cd9ef9b6cb4624a8171fbe.tar.gz
[npm] Remove call to 'npm cache ls'
This removes the call and iteration of `npm cache ls`, which is no longer a valid `npm` command. The upstream for npm notes that the only way to inspect the cache now is to use the `cacache` node.js library, which is something that cannot be done via sos. Closes: #2177 Resolves: #2255 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/report/plugins/npm.py41
1 files changed, 0 insertions, 41 deletions
diff --git a/sos/report/plugins/npm.py b/sos/report/plugins/npm.py
index d4c15987..1d8cd5f2 100644
--- a/sos/report/plugins/npm.py
+++ b/sos/report/plugins/npm.py
@@ -8,7 +8,6 @@
#
# See the LICENSE file in the source distribution for further information.
import os
-import json
from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin,
UbuntuPlugin, SuSEPlugin)
@@ -36,45 +35,6 @@ class Npm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, SuSEPlugin):
runat=working_directory
)
- def _find_modules_in_npm_cache(self):
- """
- Example 'npm cache ls' output
- ~/.npm
- ~/.npm/acorn
- ~/.npm/acorn/1.2.2
- ~/.npm/acorn/1.2.2/package.tgz
- ~/.npm/acorn/1.2.2/package
- ~/.npm/acorn/1.2.2/package/package.json
- ~/.npm/acorn/4.0.3
- ~/.npm/acorn/4.0.3/package.tgz
- ~/.npm/acorn/4.0.3/package
- ~/.npm/acorn/4.0.3/package/package.json
- ~/.npm/registry.npmjs.org
- ~/.npm/registry.npmjs.org/acorn
- ~/.npm/registry.npmjs.org/acorn/.cache.json
-
- https://docs.npmjs.com/cli/cache
- """
- output = {}
- # with chroot=True (default) the command fails when run as non-root
- user_cache = self.collect_cmd_output("npm cache ls", chroot=False)
- if user_cache['status'] == 0:
- # filter out dirs with .cache.json ('registry.npmjs.org')
- for package in [line for line in user_cache['output'].splitlines()
- if line.endswith('package.tgz')]:
- five_tuple = package.split(os.path.sep)
- if len(five_tuple) != 5: # sanity check
- continue
- home, cache, name, version, package_tgz = five_tuple
- if name not in output:
- output[name] = [version]
- else:
- output[name].append(version)
- self._log_debug("modules in cache: %s" % output)
-
- outfn = self._make_command_filename("npm_cache_modules")
- self.add_string_as_file(json.dumps(output), outfn)
-
def setup(self):
if self.get_option("project_path"):
project_path = os.path.abspath(os.path.expanduser(
@@ -87,7 +47,6 @@ class Npm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, SuSEPlugin):
self._get_npm_output("npm ls -g --json", "npm_ls_global")
self._get_npm_output("npm config list -l", "npm_config_list_global")
- self._find_modules_in_npm_cache()
class NpmViaNodeJS(Npm):