Skip to content

Ignore non-json files when listing all package configs#981

Merged
chriskrycho merged 1 commit intovolta-cli:mainfrom
charlespierce:parse_json_only
Apr 30, 2021
Merged

Ignore non-json files when listing all package configs#981
chriskrycho merged 1 commit intovolta-cli:mainfrom
charlespierce:parse_json_only

Conversation

@charlespierce
Copy link
Copy Markdown
Contributor

Closes #980

Info

  • Currently, the inventory::package_configs function reads all of the files in the package config directory and attempts to parse them as package configs.
  • However, sometimes the OS will automatically generate hidden files in a directory (e.g. .DS_Store on macOS).
  • Those auto-generated files will not be valid package configs, but they shouldn't cause volta list to fail, instead they should be ignored.

Changes

  • Updated the directory walk within package_configs to ignore both directories and any file that doesn't have a .json extension.

Tested

  • Locally tested to confirm that adding an empty dotfile into the package config directory does not cause volta list to fail.

Copy link
Copy Markdown
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 ⚡

@chriskrycho chriskrycho merged commit ab1b36d into volta-cli:main Apr 30, 2021
@charlespierce charlespierce deleted the parse_json_only branch April 30, 2021 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

volta list - Limit parsing package config files to those that have a json extension

2 participants