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

inspec compliance version fails with stacktrace if no compliance URL is configured #894

Closed
stevendanna opened this issue Aug 9, 2016 · 1 comment · Fixed by #926
Closed
Labels
Component: CLI: compliance Type: Bug Feature not working as expected
Milestone

Comments

@stevendanna
Copy link
Contributor

Description

The help output lists inspec compliance version as a possible command:

> inspec help compliance
Commands:
  inspec compliance exec PROFILE    # executes a Chef Compliance profile
  inspec compliance help [COMMAND]  # Describe subcommands or one specific subcommand
  inspec compliance login SERVER    # Log in to a Chef Compliance SERVER
  inspec compliance logout          # user logout from Chef Compliance
  inspec compliance profiles        # list all available profiles in Chef Compliance
  inspec compliance upload PATH     # uploads a local profile to Chef Compliance
  inspec compliance version         # displays the version of the Chef Compliance server

However, by default it will yield a stracktrace:

> inspec compliance version
/Users/sdanna/.chefdk/gem/ruby/2.1.0/gems/inspec-0.29.0/lib/bundles/inspec-compliance/api.rb:47:in `version': undefined method `+' for nil:NilClass (NoMethodError)
        from /Users/sdanna/.chefdk/gem/ruby/2.1.0/gems/inspec-0.29.0/lib/bundles/inspec-compliance/cli.rb:169:in `version'
        from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
        from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke'
        from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:235:in `block in subcommand'
        from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
        from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
        from /Users/sdanna/.chefdk/gem/ruby/2.1.0/gems/inspec-0.29.0/bin/inspec:9:in `<top (required)>'
        from /Users/sdanna/.chefdk/gem/ruby/2.1.0/bin/inspec:22:in `load'
        from /Users/sdanna/.chefdk/gem/ruby/2.1.0/bin/inspec:22:in `<main>'

Based on the code it looks like this is likely a result of not having a compliance server in my configuration.

InSpec and Platform Version

0.29.0

Replication Case

inspec compliance version without any compliance server configuration.

Possible Solutions

inspec should exit with a non-zero exit status while printing an informative error.

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

Thanks for highlighting that @stevendanna

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

Successfully merging a pull request may close this issue.

4 participants