Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch deps based on urls #935

Merged
merged 6 commits into from
Aug 19, 2016
Merged

Fetch deps based on urls #935

merged 6 commits into from
Aug 19, 2016

Conversation

stevendanna
Copy link
Contributor

@stevendanna stevendanna commented Aug 18, 2016

This extends the dependency feature to include support for url-based
dependencies. It takes some deviations from the current support for
URLs that we'll likely want to make more consistent.

By default, we store downloaded archives in the cache rather than the
unpacked archive. However, to facilitate debugging, we will prefer the
unpacked archive if we find it in the cache.

This partially addresses #915 by:

  • Supporting URL based sources (since most of our sources will resolve to URL based sources, the rest of the sources should be straightforward additions)
  • Storing downloaded dependencies in the vendor cache
  • Using the cached dependencies when they exist

Still to do:

  • Integrate other source types
  • Write out a inspec.lock file based on the fully resolved dependencies
  • Read the lock file rather than inspec.yml when it exists

Signed-off-by: Steven Danna steve@chef.io

@chris-rock
Copy link
Contributor

Great work @stevendanna I really like the split up into smaller pieces. I would prefer to store all dependency related classes under lib/inspec/dependencies

require 'molinillo'
require 'inspec/errors'
require 'inspec/requirement'
require 'inspec/vendor_index'
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 on the splitup

@chris-rock
Copy link
Contributor

We need to be careful with the cwd:

inspec exec test/unit/mock/profiles/dependencies-file/inheritance 
Could not fetch inspec profile in "/Users/chartmann/Development/compliance/profile_a".

@stevendanna
Copy link
Contributor Author

@chris-rock Re the current working directory, I was going back and forth about what people expect there. Currently, as you can see, it is using the current directory, but we could get the base directory of the inspec.yml at the head of the tree if you think that is what people would expect.

@@ -10,3 +10,5 @@ depends:
path: ../profile_a
- name: profile_b
path: ../profile_b
- name: os-hardening
Copy link
Contributor

Choose a reason for hiding this comment

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

we should rename the parent directory to depndencies, since we are testing more complex content here that files. we may split that up later

@chris-rock
Copy link
Contributor

I think, users would expect that they are relative to the partent profile location. I just tried to execute it that way as I normally execute profiles

@chris-rock
Copy link
Contributor

@stevendanna Could you do me a favor and highlight, which parts of #915 are addressed in that PR?

@stevendanna
Copy link
Contributor Author

@chris-rock I've updated this with:

  • Requested renames
  • A small fix for the relative paths (your example should now work)
  • Basic comments for each new class

I am 👍 on the change you recommended for fetcher but I think we should do that in a follow up PR.

stevendanna and others added 6 commits August 19, 2016 09:47
- Move classes into their own files
- Remove classes that aren't used

Signed-off-by: Steven Danna <steve@chef.io>
This extends the dependency feature to include support for url-based
dependencies.  It takes some deviations from the current support for
URLs that we'll likely want to make more consistent.

By default, we store downloaded archives in the cache rather than the
unpacked archive. However, to facilitate debugging, we will prefer the
unpacked archive if we find it in the cache.

Signed-off-by: Steven Danna <steve@chef.io>
Signed-off-by: Steven Danna <steve@chef.io>
Signed-off-by: Steven Danna <steve@chef.io>
Signed-off-by: Steven Danna <steve@chef.io>
@chris-rock chris-rock merged commit 1e93d37 into master Aug 19, 2016
@chris-rock chris-rock deleted the ssd/dep-url-fetch-1 branch August 19, 2016 07:58
@chris-rock
Copy link
Contributor

related to #888

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.

None yet

3 participants