Skip to content

Conversation

@glennsarti
Copy link
Contributor

@glennsarti glennsarti commented May 15, 2018

Previously the --local-workspace option was mostly ignored in the puppetfile
validation. However this has caused problems when validating inside control
repositories which do not have a metadata.json file (instead it's Puppetfile).
This commit refactors the workspace detection out of the puppetfile validation
and moves it into the Document Store.

This commit also adds a simple timed based caching mechanism to reduce File IO
as it can be exercised vigourously when users are typing and validation is
occuring very often. An arbitrary value of 60 seconds was chosen the TTL of the
cache. This means that after 60 seconds the workspace will be re-evaluated to
make sure the user is still in a module (metadata.json) or control repo
(Puppetfile).


Now that the workspace root detection has been moved from the manifest validator
to the Document Store, the manifest validator can use the new methods. This
commit;

  • Updates the validator to use the new Document Store root path detection
  • Removes redundant method from the validator
  • Removes the workspace argument as it's no longer required
  • Updates all call-sites and tests with the removal of the workspace argument

@glennsarti glennsarti force-pushed the gh-26-puppet-lint-in-control-repos branch 2 times, most recently from d55d7dd to 5b3b3c0 Compare May 15, 2018 14:14
Previously the --local-workspace option was mostly ignored in the puppetfile
validation.  However this has caused problems when validating inside control
repositories which do not have a metadata.json file (instead it's Puppetfile).
This commit refactors the workspace detection out of the puppetfile validation
and moves it into the Document Store.

This commit also adds a simple timed based caching mechanism to reduce File IO
as it can be exercised vigourously when users are typing and validation is
occuring very often.  An arbitrary value of 60 seconds was chosen the TTL of the
cache.  This means that after 60 seconds the workspace will be re-evaluated to
make sure the user is still in a module (metadata.json) or control repo
(Puppetfile).
…rmation

This commit adds integeration tests for the caching mechanism used in the
workspace.
@glennsarti glennsarti force-pushed the gh-26-puppet-lint-in-control-repos branch from cad215a to ac714a4 Compare May 22, 2018 06:30
@glennsarti glennsarti added this to the 0.12.0 milestone May 24, 2018
@glennsarti glennsarti changed the title {WIP}(GH-26) Refactor workspace detection for control repos and modules (GH-26) Refactor workspace detection for control repos and modules May 24, 2018
@glennsarti glennsarti requested a review from jpogran May 24, 2018 08:06
@glennsarti glennsarti force-pushed the gh-26-puppet-lint-in-control-repos branch from ac714a4 to d93f66a Compare June 1, 2018 01:21
While Pathname is a great utility it is not supported cross platform

> ... however non-Unix pathnames are supported experimentally. ... [1]

This commit changes;
* The usage of Pathname back to core Dir and File classes
* Adds a helper method dir_exists? to make testing easier
* Fixes the file_exist? method to check if the thing that exists is actually
  not a directory
* Adds tests to ensure the directory traversing terminates correctly

[1] http://ruby-doc.org/stdlib-2.1.9/libdoc/pathname/rdoc/Pathname.html
…tion

Now that the workspace root detection has been moved from the manifest validator
to the Document Store, the manifest validator can use the new methods.  This
commit;
* Updates the validator to use the new Document Store root path detection
* Removes redundant method from the validator
* Removes the workspace argument as it's no longer required
* Updates all call-sites and tests with the removal of the workspace argument
@glennsarti glennsarti force-pushed the gh-26-puppet-lint-in-control-repos branch from d93f66a to d259969 Compare June 1, 2018 01:23
@michaeltlombardi michaeltlombardi merged commit a5ff75b into puppetlabs:master Jun 1, 2018
@glennsarti glennsarti deleted the gh-26-puppet-lint-in-control-repos branch October 12, 2018 05:07
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.

2 participants