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

Windows default path format causes errors with inspec check #672

Closed
grdnrio opened this issue Apr 20, 2016 · 7 comments
Closed

Windows default path format causes errors with inspec check #672

grdnrio opened this issue Apr 20, 2016 · 7 comments
Assignees
Labels
Type: Bug Feature not working as expected
Milestone

Comments

@grdnrio
Copy link

grdnrio commented Apr 20, 2016

Description

Inspec check using autocomplete for paths in Powershell causes an error. Deleting the .\ dot and slashes works.

InSpec and Platform Version

Inspec version: 0.19.1
Windows 10 x64 1511

Replication Case

chef exec inspec check .\cis-ubuntu14.04-level1\
C:/Users/jgardiner/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.19.1/lib/inspec/profile.rb:27:in `resolve_target': Don't understand inspec profile in ".\\cis-ubuntu14.04-level1\\", it doesn't look like a supported profile structure. (RuntimeError)
        from C:/Users/jgardiner/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.19.1/lib/inspec/profile.rb:34:in `for_target'
        from C:/Users/jgardiner/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.19.1/lib/inspec/cli.rb:55:in `check'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
        from C:/Users/jgardiner/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.19.1/bin/inspec:9:in `<top (required)>'
        from C:/Users/jgardiner/AppData/Local/chefdk/gem/ruby/2.1.0/bin/inspec:22:in `load'
        from C:/Users/jgardiner/AppData/Local/chefdk/gem/ruby/2.1.0/bin/inspec:22:in `<main>'

Possible Solutions

Workaround is to manually remove the backslahes and dot.

@grdnrio grdnrio added the Type: Bug Feature not working as expected label Apr 20, 2016
@chris-rock
Copy link
Contributor

Huh. That is a bumper. We need to fix this. Thanks for reporting @grdnrio

@mhedgpeth
Copy link

@chris-rock something I could take, perhaps? If so at what level would you change it?

@chris-rock
Copy link
Contributor

@mhedgpeth for sure. I try to write down the call history to help identifying the issue:

We need to find out, why the fetcher local.rb does not identify the path as a profile.

@mhedgpeth
Copy link

As I looked at it I thought that adding this line to fetchers_test.rb would test it:

    # deal with powershell default path created when pressing tab
    %w{.\path\to\b}                => %w{path/to/b}

And in local, I would either just explicitly get rid of a "." at the start of the target or I would find a ruby-friendly way to understand that path.

Is that the right approach?

@chris-rock
Copy link
Contributor

Yeah, that is the right approach. Looks like ruby does not resolve the relative paths properly. Once we know how to tackle it properly we should add that feature to the local fetcher.

@ksubrama
Copy link

Oh yes. Ruby and expand_path and it's platform specific behavior is... hard. I'll try to poke at it this week.

@chris-rock chris-rock modified the milestones: 0.31.0, 0.32.0 Aug 19, 2016
@chris-rock chris-rock assigned chris-rock and unassigned ksubrama and vjeffrey Aug 23, 2016
@chris-rock
Copy link
Contributor

should be fixed by #963, please reopen if this continues to be an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

No branches or pull requests

5 participants