Project

General

Profile

Bug #17936

Fetching default org/loc from server fails

Added by Tomáš Strachota over 3 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

An attempt to get user's default organization or location from server ends up with no method exception.
Credentials were removed with the api sessions re-work.

Steps to reproduce:

> hammer defaults add --param-name organization_id --provider foreman
Added organization_id default-option with value that will be generated from the server.
> hammer defaults list
----------------|---------------------
PARAMETER       | VALUE               
----------------|---------------------
organization_id | Provided by: Foreman
> hammer user list
Error: undefined method `credentials' for HammerCLIForeman:Module

NoMethodError (undefined method `credentials' for HammerCLIForeman:Module):
    /root/hammer/hammer-cli-foreman/lib/hammer_cli_foreman/defaults.rb:24:in `get_user'
    /root/hammer/hammer-cli-foreman/lib/hammer_cli_foreman/defaults.rb:13:in `get_defaults'
    /root/hammer/hammer-cli/lib/hammer_cli/defaults.rb:54:in `get_defaults'
    /root/hammer/hammer-cli/lib/hammer_cli/abstract.rb:243:in `add_custom_defaults'
    /root/hammer/hammer-cli/lib/hammer_cli/abstract.rb:229:in `block in all_options'
    /root/hammer/hammer-cli/lib/hammer_cli/abstract.rb:227:in `each'
    /root/hammer/hammer-cli/lib/hammer_cli/abstract.rb:227:in `inject'
    /root/hammer/hammer-cli/lib/hammer_cli/abstract.rb:227:in `all_options'
    /root/hammer/hammer-cli/lib/hammer_cli/abstract.rb:236:in `options'
    /root/hammer/hammer-cli/lib/hammer_cli/abstract.rb:34:in `parse'
    /usr/local/rvm/gems/ruby-2.3.0/gems/clamp-1.1.1/lib/clamp/command.rb:62:in `run'
    /root/hammer/hammer-cli/lib/hammer_cli/abstract.rb:24:in `run'
    /usr/local/rvm/gems/ruby-2.3.0/gems/clamp-1.1.1/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/local/rvm/gems/ruby-2.3.0/gems/clamp-1.1.1/lib/clamp/command.rb:63:in `run'
    /root/hammer/hammer-cli/lib/hammer_cli/abstract.rb:24:in `run'
    /usr/local/rvm/gems/ruby-2.3.0/gems/clamp-1.1.1/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/local/rvm/gems/ruby-2.3.0/gems/clamp-1.1.1/lib/clamp/command.rb:63:in `run'
    /root/hammer/hammer-cli/lib/hammer_cli/abstract.rb:24:in `run'
    /usr/local/rvm/gems/ruby-2.3.0/gems/clamp-1.1.1/lib/clamp/command.rb:132:in `run'
    ./bin/hammer:125:in `<main>'

Associated revisions

Revision 7de6c5b6 (diff)
Added by Tomas Strachota over 3 years ago

Refs #17936 - Better support for api expectations

- new APIExpectationsDecorator that enables setting expectations on api
instances
- helper method for creating api instances
- parameter expectations with better error reporting

Revision f04e5b15 (diff)
Added by Tomas Strachota over 3 years ago

Fixes #17936 - default org/loc work with authenticators

Method HammerCLIForeman.credentials was removed with session
authenticators re-work.

Defaults provider refactored for easier testing.

History

#1 Updated by The Foreman Bot over 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/275 added

#2 Updated by Marek Hulán over 3 years ago

  • Target version changed from 1.10.2 to 1.11.2

#3 Updated by Marek Hulán over 3 years ago

  • Target version changed from 1.11.2 to 1.11.4

#4 Updated by Marek Hulán over 3 years ago

  • Target version changed from 1.11.4 to 1.12.1

#5 Updated by Anonymous over 3 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#6 Updated by Tomáš Strachota over 3 years ago

  • Legacy Backlogs Release (now unused) set to 234

Also available in: Atom PDF