Unrecognised option '--organization-id' at host creation in hammer_cli_foreman 0.2.0

I'm unable to use the Organization/Location flags when creating hosts, they
are documented in my Gem install
(/Library/Ruby/Gems/2.0.0/gems/hammer_cli_foreman-0.2.0//doc/host_create.md)

Client is OSX, Foreman is 1.6.1
I see this ticket Bug #6236: Host create and update is missing documentation for setting organization and location. - Foreman and some
related ones but they seem to centered around documentation or the API
provided by Foreman, is there anything that I'm missing here?

This is the debug output:

hammer -d host create --name qa-rb-auto2 --compute-profile ovirt_2C_4G_50G
–compute-resource-id 31 --domain something.com --environment qa
–hostgroup RB_GW --operatingsystem-id 16 --partition-table 'Kickstart
default' --provision-method build --subnet IL_new_subnet --interface
primary=true,provision=true --organization-id 6
[ INFO 2015-05-04 15:14:45 Init] Initialization of Hammer CLI (0.2.0) has
started…
[DEBUG 2015-05-04 15:14:45 Init] Running at ruby 2.0.0-p481
[ INFO 2015-05-04 15:14:45 Init] Configuration from the file
/Users/oded/.hammer/cli_config.yml has been loaded
[ INFO 2015-05-04 15:14:45 Init] Configuration from the file
/Users/oded/.hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2015-05-04 15:14:45 Connection] Registered: foreman
[DEBUG 2015-05-04 15:14:45 API] Global headers: {
:content_type => "application/json",
:accept => "application/json;version=2",
"Accept-Language" => "en"
}
[ INFO 2015-05-04 15:14:45 Modules] Extension module hammer_cli_foreman
(0.2.0) loaded
[DEBUG 2015-05-04 15:14:45 Init] Using locale 'en'
[DEBUG 2015-05-04 15:14:45 Init] 'mo' files for locale domain 'hammer-cli'
loaded from '/Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/locale'
[DEBUG 2015-05-04 15:14:45 Init] 'mo' files for locale domain
'hammer-cli-foreman' loaded from
'/Library/Ruby/Gems/2.0.0/gems/hammer_cli_foreman-0.2.0/locale'
[ INFO 2015-05-04 15:14:45 HammerCLI::MainCommand] Called with options:
{"option_debug"=>true}
[ INFO 2015-05-04 15:14:45 HammerCLIForeman::Host] Called with options: {}
[ERROR 2015-05-04 15:14:45 Exception] Error: Unrecognised option
'–organization-id'

See: 'hammer host create --help'
Could not create the host:
Error: Unrecognised option '–organization-id'

See: 'hammer host create --help'
[ERROR 2015-05-04 15:14:45 Exception]

Clamp::UsageError (Unrecognised option '–organization-id'):
/Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/option/parsing.rb:62:in
find_option' /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/option/parsing.rb:28:inparse_options'
/Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:52:in parse' /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:31:inparse'
/Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:66:in run' /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:23:inrun'
/Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/subcommand/execution.rb:11:in
execute' /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:67:inrun'
/Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:23:in
run' /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/subcommand/execution.rb:11:inexecute'
/Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:67:in run' /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:23:inrun'
/Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:132:in run&#39; /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/bin/hammer:108:in<top
(required)>'
/usr/bin/hammer:23:in load&#39; /usr/bin/hammer:23:in<main>'

Hello,
there could be more reasons why the client doesn't accept the parameters.

Firstly, please check if the parameter organization_id is present in the
api documentation for hosts at YOUR_FOREMAN_URL/apidoc/v2/hosts/create.html

If it's missing there, please run following command on the server:

foreman-rake apipie:cache

Since you're using the latest CLI and older version of the Foreman
there's also a chance the CLI didn't recognize the need for refreshing
the api cache on it's side. This should be fixed by running hammer with
-r on the client machine:

hammer -r

Regards
Tomas

··· On 05/04/2015 02:31 PM, Oded Ben Ozer wrote: > > I'm unable to use the Organization/Location flags when creating hosts, > they are documented in my Gem install > (/Library/Ruby/Gems/2.0.0/gems/hammer_cli_foreman-0.2.0//doc/host_create.md) > > Client is OSX, Foreman is 1.6.1 > I see this ticket http://projects.theforeman.org/issues/6236 and some > related ones but they seem to centered around documentation or the API > provided by Foreman, is there anything that I'm missing here? > > This is the debug output: > > hammer -d host create --name qa-rb-auto2 --compute-profile > ovirt_2C_4G_50G --compute-resource-id 31 --domain something.com > --environment qa --hostgroup RB_GW --operatingsystem-id 16 > --partition-table 'Kickstart default' --provision-method build --subnet > IL_new_subnet --interface primary=true,provision=true --organization-id 6 > [ INFO 2015-05-04 15:14:45 Init] Initialization of Hammer CLI (0.2.0) > has started... > [DEBUG 2015-05-04 15:14:45 Init] Running at ruby 2.0.0-p481 > [ INFO 2015-05-04 15:14:45 Init] Configuration from the file > /Users/oded/.hammer/cli_config.yml has been loaded > [ INFO 2015-05-04 15:14:45 Init] Configuration from the file > /Users/oded/.hammer/cli.modules.d/foreman.yml has been loaded > [DEBUG 2015-05-04 15:14:45 Connection] Registered: foreman > [DEBUG 2015-05-04 15:14:45 API] Global headers: { > :content_type => "application/json", > :accept => "application/json;version=2", > "Accept-Language" => "en" > } > [ INFO 2015-05-04 15:14:45 Modules] Extension module hammer_cli_foreman > (0.2.0) loaded > [DEBUG 2015-05-04 15:14:45 Init] Using locale 'en' > [DEBUG 2015-05-04 15:14:45 Init] 'mo' files for locale domain > 'hammer-cli' loaded from > '/Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/locale' > [DEBUG 2015-05-04 15:14:45 Init] 'mo' files for locale domain > 'hammer-cli-foreman' loaded from > '/Library/Ruby/Gems/2.0.0/gems/hammer_cli_foreman-0.2.0/locale' > [ INFO 2015-05-04 15:14:45 HammerCLI::MainCommand] Called with options: > {"option_debug"=>true} > [ INFO 2015-05-04 15:14:45 HammerCLIForeman::Host] Called with options: {} > [ERROR 2015-05-04 15:14:45 Exception] Error: Unrecognised option > '--organization-id' > > > See: 'hammer host create --help' > Could not create the host: > Error: Unrecognised option '--organization-id' > > > See: 'hammer host create --help' > [ERROR 2015-05-04 15:14:45 Exception] > > > Clamp::UsageError (Unrecognised option '--organization-id'): > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/option/parsing.rb:62:in > `find_option' > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/option/parsing.rb:28:in > `parse_options' > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:52:in `parse' > /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:31:in > `parse' > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:66:in `run' > /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:23:in > `run' > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/subcommand/execution.rb:11:in > `execute' > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:67:in `run' > /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:23:in > `run' > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/subcommand/execution.rb:11:in > `execute' > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:67:in `run' > /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:23:in > `run' > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:132:in `run' > /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/bin/hammer:108:in ` (required)>' > /usr/bin/hammer:23:in `load' > /usr/bin/hammer:23:in `' > > -- > You received this message because you are subscribed to the Google > Groups "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to foreman-users+unsubscribe@googlegroups.com > . > To post to this group, send email to foreman-users@googlegroups.com > . > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout.

Thanks!
Running the rake task did add organization_id to the api doc, then using
hammer with the "r" flag solved the problem.

··· On Tuesday, May 5, 2015 at 4:49:48 PM UTC+3, Tomas Strachota wrote: > > Hello, > there could be more reasons why the client doesn't accept the parameters. > > Firstly, please check if the parameter organization_id is present in the > api documentation for hosts at > YOUR_FOREMAN_URL/apidoc/v2/hosts/create.html > > If it's missing there, please run following command on the server: > > foreman-rake apipie:cache > > Since you're using the latest CLI and older version of the Foreman > there's also a chance the CLI didn't recognize the need for refreshing > the api cache on it's side. This should be fixed by running hammer with > -r on the client machine: > > hammer -r > > Regards > Tomas > > On 05/04/2015 02:31 PM, Oded Ben Ozer wrote: > > > > I'm unable to use the Organization/Location flags when creating hosts, > > they are documented in my Gem install > > (/Library/Ruby/Gems/2.0.0/gems/hammer_cli_foreman-0.2.0//doc/ > host_create.md) > > > > Client is OSX, Foreman is 1.6.1 > > I see this ticket http://projects.theforeman.org/issues/6236 and some > > related ones but they seem to centered around documentation or the API > > provided by Foreman, is there anything that I'm missing here? > > > > This is the debug output: > > > > hammer -d host create --name qa-rb-auto2 --compute-profile > > ovirt_2C_4G_50G --compute-resource-id 31 --domain something.com > > --environment qa --hostgroup RB_GW --operatingsystem-id 16 > > --partition-table 'Kickstart default' --provision-method build --subnet > > IL_new_subnet --interface primary=true,provision=true --organization-id > 6 > > [ INFO 2015-05-04 15:14:45 Init] Initialization of Hammer CLI (0.2.0) > > has started... > > [DEBUG 2015-05-04 15:14:45 Init] Running at ruby 2.0.0-p481 > > [ INFO 2015-05-04 15:14:45 Init] Configuration from the file > > /Users/oded/.hammer/cli_config.yml has been loaded > > [ INFO 2015-05-04 15:14:45 Init] Configuration from the file > > /Users/oded/.hammer/cli.modules.d/foreman.yml has been loaded > > [DEBUG 2015-05-04 15:14:45 Connection] Registered: foreman > > [DEBUG 2015-05-04 15:14:45 API] Global headers: { > > :content_type => "application/json", > > :accept => "application/json;version=2", > > "Accept-Language" => "en" > > } > > [ INFO 2015-05-04 15:14:45 Modules] Extension module hammer_cli_foreman > > (0.2.0) loaded > > [DEBUG 2015-05-04 15:14:45 Init] Using locale 'en' > > [DEBUG 2015-05-04 15:14:45 Init] 'mo' files for locale domain > > 'hammer-cli' loaded from > > '/Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/locale' > > [DEBUG 2015-05-04 15:14:45 Init] 'mo' files for locale domain > > 'hammer-cli-foreman' loaded from > > '/Library/Ruby/Gems/2.0.0/gems/hammer_cli_foreman-0.2.0/locale' > > [ INFO 2015-05-04 15:14:45 HammerCLI::MainCommand] Called with options: > > {"option_debug"=>true} > > [ INFO 2015-05-04 15:14:45 HammerCLIForeman::Host] Called with options: > {} > > [ERROR 2015-05-04 15:14:45 Exception] Error: Unrecognised option > > '--organization-id' > > > > > > See: 'hammer host create --help' > > Could not create the host: > > Error: Unrecognised option '--organization-id' > > > > > > See: 'hammer host create --help' > > [ERROR 2015-05-04 15:14:45 Exception] > > > > > > Clamp::UsageError (Unrecognised option '--organization-id'): > > > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/option/parsing.rb:62:in > > `find_option' > > > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/option/parsing.rb:28:in > > `parse_options' > > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:52:in > `parse' > > > /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:31:in > > > `parse' > > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:66:in > `run' > > > /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:23:in > > > `run' > > > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/subcommand/execution.rb:11:in > > > `execute' > > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:67:in > `run' > > > /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:23:in > > > `run' > > > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/subcommand/execution.rb:11:in > > > `execute' > > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:67:in > `run' > > > /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/lib/hammer_cli/abstract.rb:23:in > > > `run' > > /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.4/lib/clamp/command.rb:132:in > `run' > > /Library/Ruby/Gems/2.0.0/gems/hammer_cli-0.2.0/bin/hammer:108:in ` > (required)>' > > /usr/bin/hammer:23:in `load' > > /usr/bin/hammer:23:in `' > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Foreman users" group. > > To unsubscribe from this group and stop receiving emails from it, send > > an email to foreman-user...@googlegroups.com > > <mailto:foreman-users+unsubscribe@googlegroups.com >. > > To post to this group, send email to forema...@googlegroups.com > > > <mailto:forema...@googlegroups.com >. > > Visit this group at http://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/d/optout. > >