Hello Martin.
Thanks for quick response. Here are my versions:
foreman ~/.foreman/log # rpm -qa | grep hammer
rubygem-hammer_cli_foreman-0.0.10-1.el6.noarch
rubygem-hammer_cli-0.0.9-1.el6.noarch
foreman ~/.foreman/log # rpm -qa | grep foreman
rubygem-foreman_api-0.1.8-1.el6.noarch
foreman-compute-1.3.1-1.el6.noarch
rubygem-hammer_cli_foreman-0.0.10-1.el6.noarch
foreman-1.3.1-1.el6.noarch
foreman-ovirt-1.3.1-1.el6.noarch
foreman-installer-1.3.1-1.el6.noarch
foreman-proxy-1.3.0-1.el6.noarch
foreman-release-1.3.1-1.el6.noarch
foreman-mysql-1.3.1-1.el6.noarch
foreman-selinux-1.3.0-1.el6.noarch
foreman-mysql2-1.3.1-1.el6.noarch
Here is the debug log in my ~/.foreman/log directory:
foreman ~/.foreman/log # cat hammer.log
[ INFO 2013-12-14 08:19:35 Init] Configuration from the file
/etc/foreman/cli_config.yml has been loaded
[ INFO 2013-12-14 08:19:36 Init] Extension module hammer_cli_foreman loaded
[ INFO 2013-12-14 08:19:36 HammerCLI::MainCommand] Called with options: {}
[ INFO 2013-12-14 08:19:36 HammerCLIForeman::Template] Called with options:
{}
[ INFO 2013-12-14 08:19:36
HammerCLIForeman::AssociatingCommands::OperatingSystem::AddOSCommand]
Called with options: {"associated_id"=>"1", "id"=>"1"}
[ERROR 2013-12-14 08:19:36 Exception] Error: undefined method `[]' for
nil:NilClass
[ERROR 2013-12-14 08:19:36 Exception]
NoMethodError (undefined method `[]' for nil:NilClass):
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.10/lib/hammer_cli_foreman/commands.rb:158:in
`get_current_ids'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.10/lib/hammer_cli_foreman/commands.rb:186:in
`get_new_ids'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.10/lib/hammer_cli_foreman/commands.rb:168:in
`request_params'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.9/lib/hammer_cli/./apipie/write_command.rb:23:in
`send_request'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.9/lib/hammer_cli/./apipie/write_command.rb:10:in
execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:67:in
run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.9/lib/hammer_cli/abstract.rb:24:in
`run'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/subcommand/execution.rb:11:in
execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:67:in
run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.9/lib/hammer_cli/abstract.rb:24:in
`run'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/subcommand/execution.rb:11:in
execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:67:in
run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.9/lib/hammer_cli/abstract.rb:24:in
`run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.9/lib/hammer_cli/main.rb:43:in
run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.1/lib/clamp/command.rb:125:in
run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.9/bin/hammer:62
/usr/bin/hammer:19:in `load'
/usr/bin/hammer:19
I hope setting the debug log using this command is sufficient: sed -i
's/error/debug/' /etc/foreman/cli_config.yml
Thank you
PetrR
···
On Wednesday, 11 December 2013 16:01:45 UTC+1, Martin Bačovský wrote:
>
> On 12/11/2013 11:31 AM, Petr Ruzicka wrote:
> > Hello guys.
> >
> > I'm not sure if I'm doing something wrong, but I'm trying to add
> > template to particular operating system:
> >
> > foreman ~ # hammer template list | grep 'Kickstart default PXElinux'
> > 1 | Kickstart default PXElinux | PXELinux
> >
> > foreman ~ # hammer os list
> > ---------------------------------------------------------------------
> > FAMILY | NAME | ID | RELEASE NAME
> > ---------------------------------------------------------------------
> > Redhat | CentOS 6.5 | 1 |
> > ---------------------------------------------------------------------
> >
> > foreman ~ # hammer template info --id 1
> > Id: 1
> > Name: Kickstart default PXElinux
> > Type: PXELinux
> > OS ids:
> >
> > foreman ~ # hammer template add_operatingsystem --operatingsystem-id 1
> > --id 1
> > Could not associate the operating system:
> > Error: undefined method `[]' for nil:NilClass
> >
> >
> > If I do it using the web interface - it's working fine and I can see
> > it "marked" there.
> >
> > Please let me know if you know where is the problem.
> >
> > Thanks.
> >
> > PetrR
> >
> > --
> > 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 .
> > To post to this group, send email to forema...@googlegroups.com.
>
> > Visit this group at http://groups.google.com/group/foreman-users.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
> Could you send us your version of foreman, hammer_cli and
> hammer_cli_foreman?
>
> Your problem is probably related to
> http://projects.theforeman.org/issues/3583 which is fixed in hammer
> 0.0.12
> If updating hammer does not help, could you attach output of your
> command with verbose flag on?
> # hammer -v template add_operatingsystem --operatingsystem-id 1 --id 1
> It may help to set log_level to debug in your config.
>
> Regards,
> Martin
>
>