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

Using :if in context/describe declaration causes an exception to be thrown by SpecInfra #22

Closed
patrobinson opened this issue Apr 11, 2016 · 0 comments

Comments

@patrobinson
Copy link
Contributor

If you don't set :ssh_options for ServerSpec, it throws an exception

 `sudo?': undefined method `[]' for nil:NilClass (NoMethodError)

We set the :ssh_options when calling AmiSpec::ServerSpec.run, because the values of this are unknown until runtime.

SpecInfra wants to evaluate the conditional at load time, not at run time.

Stack trace:

./vendor/bundle/ruby/1.9.1/gems/specinfra-2.45.0/lib/specinfra/backend/ssh.rb:179:in `sudo?': undefined method `[]' for nil:NilClass (NoMethodError)
    from ./vendor/bundle/ruby/1.9.1/gems/specinfra-2.45.0/lib/specinfra/backend/ssh.rb:42:in `build_command'
    from ./vendor/bundle/ruby/1.9.1/gems/specinfra-2.45.0/lib/specinfra/backend/ssh.rb:10:in `run_command'
    from ./vendor/bundle/ruby/1.9.1/gems/specinfra-2.45.0/lib/specinfra/helper/detect_os.rb:13:in `run_command'
    from ./vendor/bundle/ruby/1.9.1/gems/specinfra-2.45.0/lib/specinfra/helper/detect_os/freebsd.rb:3:in `detect'
    from ./vendor/bundle/ruby/1.9.1/gems/specinfra-2.45.0/lib/specinfra/helper/detect_os.rb:5:in `detect'
    from ./vendor/bundle/ruby/1.9.1/gems/specinfra-2.45.0/lib/specinfra/helper/os.rb:24:in `block in detect_os'
    from ./vendor/bundle/ruby/1.9.1/gems/specinfra-2.45.0/lib/specinfra/helper/os.rb:23:in `each'
    from ./vendor/bundle/ruby/1.9.1/gems/specinfra-2.45.0/lib/specinfra/helper/os.rb:23:in `detect_os'
    from ./vendor/bundle/ruby/1.9.1/gems/specinfra-2.45.0/lib/specinfra/helper/os.rb:9:in `os'
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

No branches or pull requests

1 participant