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

Add GitFetcher and rework Fetchers+SourceReaders #1034

Merged
merged 4 commits into from
Sep 9, 2016
Merged

Conversation

stevendanna
Copy link
Contributor

@stevendanna stevendanna commented Sep 8, 2016

This adds a new git fetcher. In doing so, it also refactors how the
fetchers work a bit to better support fetchers that need to resolve
user-provided sources to fully specified sources appropriate for a
lockfile.

ref: resolved_ref }
end

def repo_path
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is unused, remove

@stevendanna
Copy link
Contributor Author

Test failures look like a difference in Tempfile's api across ruby version, will update this to use a more compatible call in my next update.


# InSpec Target Helper for Chef Compliance
# reuses UrlHelper, but it knows the target server and the access token already
# similar to `inspec exec http://localhost:2134/owners/%base%/compliance/%ssh%/tar --user %token%`
module Compliance
class Fetcher < Fetchers::Url
class Fetcher < Inspec.fetcher(1)
Copy link
Contributor

@chris-rock chris-rock Sep 8, 2016

Choose a reason for hiding this comment

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

👍

@stevendanna stevendanna changed the title WIPWIP: Add GitFetch and rework Fetchers+SourceReaders WIPWIP: Add GitFetcher and rework Fetchers+SourceReaders Sep 8, 2016
@stevendanna
Copy link
Contributor Author

@chris-rock Regarding changing Fetcher.resolve to only take a single hash, I've held off on that for now. Once I started it I realized that to do that we basically have to have another parsing mechanism somewhere else to translate from string -> hash and then suddenly some fetcher specific stuff lives outside that fetcher, which feels odd since they should be pluggable. I agree that the resolve() method signature is pretty odd now, definitely in favor of refactoring it, just thinking we might do that in a follow up.

@stevendanna stevendanna changed the title WIPWIP: Add GitFetcher and rework Fetchers+SourceReaders Add GitFetcher and rework Fetchers+SourceReaders Sep 9, 2016
@chris-rock
Copy link
Contributor

fixes #959

@chris-rock chris-rock added this to the 0.34.0 milestone Sep 9, 2016
# displays a list of profiles
def self.profiles
url = "#{SUPERMARKET_URL}/api/v1/tools-search"
def self.profiles(supermarket_url)
Copy link
Contributor

Choose a reason for hiding this comment

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

This breaks our CLI:

b inspec supermarket profiles
/Users/chartmann/Development/compliance/inspec/lib/bundles/inspec-supermarket/api.rb:13:in `profiles': wrong number of arguments (0 for 1) (ArgumentError)
    from /Users/chartmann/Development/compliance/inspec/lib/bundles/inspec-supermarket/cli.rb:21:in `profiles'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:235:in `block in subcommand'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Users/chartmann/Development/compliance/inspec/bin/inspec:9:in `<top (required)>'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/bin/inspec:23:in `load'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/bin/inspec:23:in `<main>'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/chartmann/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/bin/ruby_executable_hooks:15:in `<main>'

Looks like we are missing a functional test for supermarket

Copy link
Contributor

Choose a reason for hiding this comment

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

I propose to set the default to SUPERMARKET_URL

This adds a new git fetcher. In doing so, it also refactors how the
fetchers work a bit to better support fetchers that need to resolve
user-provided sources to fully specified sources appropriate for a
lockfile.

Signed-off-by: Steven Danna <steve@chef.io>
Signed-off-by: Steven Danna <steve@chef.io>
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