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

undefined method `send_request' for Compliance::API:Class #1088

Closed
jeremymv2 opened this issue Sep 16, 2016 · 2 comments
Closed

undefined method `send_request' for Compliance::API:Class #1088

jeremymv2 opened this issue Sep 16, 2016 · 2 comments
Labels
Type: Bug Feature not working as expected

Comments

@jeremymv2
Copy link
Contributor

Description

When attempting a legacy login I get an error that there is no send_request method.
It looks like that method disappeared here: 07c3594

~/Devel/ChefProject/compliance-profiles$ inspec compliance login https://compliance-server.test --insecure --user='localadmin' --password='insecurepassword'
/Users/jmiller/.chefdk/gem/ruby/2.1.0/gems/inspec-0.35.0/lib/bundles/inspec-compliance/api.rb:21:in `legacy_login_post': undefined method `send_request' for Compliance::API:Class (NoMethodError)
    from /Users/jmiller/.chefdk/gem/ruby/2.1.0/gems/inspec-0.35.0/lib/bundles/inspec-compliance/cli.rb:217:in `login_legacy'
    from /Users/jmiller/.chefdk/gem/ruby/2.1.0/gems/inspec-0.35.0/lib/bundles/inspec-compliance/cli.rb:41:in `login'
    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/jmiller/.chefdk/gem/ruby/2.1.0/gems/inspec-0.35.0/bin/inspec:12:in `<top (required)>'
    from /opt/chefdk/embedded/bin/inspec:22:in `load'
    from /opt/chefdk/embedded/bin/inspec:22:in `<main>'
~/Devel/ChefProject/compliance-profiles$

InSpec and Platform Version

~/Devel/ChefProject/compliance-profiles$ inspec version
0.35.0
~/Devel/ChefProject/compliance-profiles$ uname -a
Darwin jm01.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64
~/Devel/ChefProject/compliance-profiles$

Replication Case

Attempt to use inspec cli to login with a user/password:
inspec compliance login https://compliance-server.test --insecure --user='user' --password='pass'

@jeremymv2
Copy link
Contributor Author

jeremymv2 commented Sep 16, 2016

I understand that this might be the "legacy" method of authenticating. However, token authentication, as I understand it, can be problematic. For example, if a Compliance UI session logout occurs, the associated refresh_token is invalidated. On the other hand the token is short lived (12 hours), so in a build cookbook scenario where the expectation is not to have to be required to have a user session logged in the Compliance Server, this legacy login option should be left in place as a last resort method of acquiring an access token. password could be stored in environment, or vault of some sort.

@alexpop
Copy link
Contributor

alexpop commented Sep 19, 2016

Thanks for the report Jeremy. I bumped into this as well and my workaround has been to copy tokens from the UI into the shell.

I'll open a PR to replace the legacy login implementation.

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

3 participants