Hammer host update issue

I currently have foreman 1.3.2 installed with the latest-released hammer
rubygems (rubygem-hammer_cli-0.0.14 and rubygem-hammer_cli_foreman-0.0.15)
and I'm running in to a strange bug.

When I execute the command

> hammer host update --name test-host.example.com --hostgroup-id 3
>

I get an error

> Could not update the host:
>
Error: 500 Internal Server Error
>

A look at the hammer logs shows a large ruby stack trace, but I do see a
log entry that could be the issue

> unknown attribute: compute_attributes (ActiveRecord: UnknownAttributeError)

I am using foreman in the :unattended: false mode, so that it is simply a
reporting and node classifier tool, with no provisioning details defined.

The last piece to note is that this command does work

> curl -u admin:password -k --fail --silent -X PUT -d "host[hostgroup_id]=3"
> "https://foreman/api/hosts/test-host.example.com"

which leads me to believe there is an issue with hammer itself, rather than
the API call.

Thanks

> I currently have foreman 1.3.2 installed with the latest-released hammer
> rubygems (rubygem-hammer_cli-0.0.14 and
> rubygem-hammer_cli_foreman-0.0.15) and I'm running in to a strange bug.
>
> When I execute the command
>
> hammer host update --name test-host.example.com --hostgroup-id 3
>
>
> I get an error
>
> Could not update the host:
>
> Error: 500 Internal Server Error
>
>
> A look at the hammer logs shows a large ruby stack trace, but I do see a
> log entry that could be the issue
>
> unknown attribute: compute_attributes (ActiveRecord:
> UnknownAttributeError)
>
>
> I am using foreman in the :unattended: false mode, so that it is simply
> a reporting and node classifier tool, with no provisioning details defined.
>
> The last piece to note is that this command does work
>
> curl -u admin:password -k --fail --silent -X PUT -d
> "host[hostgroup_id]=3" "https://foreman/api/hosts/test-host.example.com"
>
>
> which leads me to believe there is an issue with hammer itself, rather
> than the API call.
>
> Thanks

Hello Michael,
thank you for reporting it! Unfortunately I didn't manage to reproduce
the problem. Would you mind sending us full foreman log of the failure
plus verbose output of hammer -v host update ...? Or perhaps you could
use foreman-debug script.

Thanks
Tomas

··· On 01/08/2014 07:38 PM, Michael Griffin wrote:


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/groups/opt_out.

Yep that is exactly the issue. I will watch the bug, since our we have
another provisioning engine that creates the hosts, and we just use foreman
for reporting and node classifying.

Thanks

··· On Wednesday, January 8, 2014 1:38:42 PM UTC-5, Michael Griffin wrote: > > I currently have foreman 1.3.2 installed with the latest-released hammer > rubygems (rubygem-hammer_cli-0.0.14 and rubygem-hammer_cli_foreman-0.0.15) > and I'm running in to a strange bug. > > When I execute the command > >> hammer host update --name test-host.example.com --hostgroup-id 3 >> > > I get an error > >> Could not update the host: >> > Error: 500 Internal Server Error >> > > A look at the hammer logs shows a large ruby stack trace, but I do see a > log entry that could be the issue > >> unknown attribute: compute_attributes (ActiveRecord: >> UnknownAttributeError) > > > I am using foreman in the :unattended: false mode, so that it is simply a > reporting and node classifier tool, with no provisioning details defined. > > The last piece to note is that this command does work > >> curl -u admin:password -k --fail --silent -X PUT -d >> "host[hostgroup_id]=3" "https://foreman/api/hosts/test-host.example.com" > > > which leads me to believe there is an issue with hammer itself, rather > than the API call. > > Thanks >

Thanks for the response, but unfortunately, I can't upload log files.

I was able to stand up a second foreman instance and things work there,
which tells me the issue is with the installation of foreman.

Is there a way to validate that the foreman database is configured
properly? I've checked and hammer in both instances is sending the same set
of parameters, it's just the broken instance is rejecting the request due
to an unknown parameter (compute_attributes).

Thanks

··· On Friday, January 10, 2014 4:57:21 AM UTC-5, Tomas Strachota wrote: > > On 01/08/2014 07:38 PM, Michael Griffin wrote: > > I currently have foreman 1.3.2 installed with the latest-released hammer > > rubygems (rubygem-hammer_cli-0.0.14 and > > rubygem-hammer_cli_foreman-0.0.15) and I'm running in to a strange bug. > > > > When I execute the command > > > > hammer host update --name test-host.example.com --hostgroup-id 3 > > > > > > I get an error > > > > Could not update the host: > > > > Error: 500 Internal Server Error > > > > > > A look at the hammer logs shows a large ruby stack trace, but I do see a > > log entry that could be the issue > > > > unknown attribute: compute_attributes (ActiveRecord: > > UnknownAttributeError) > > > > > > I am using foreman in the :unattended: false mode, so that it is simply > > a reporting and node classifier tool, with no provisioning details > defined. > > > > The last piece to note is that this command does work > > > > curl -u admin:password -k --fail --silent -X PUT -d > > "host[hostgroup_id]=3" " > https://foreman/api/hosts/test-host.example.com" > > > > > > which leads me to believe there is an issue with hammer itself, rather > > than the API call. > > > > Thanks > > Hello Michael, > thank you for reporting it! Unfortunately I didn't manage to reproduce > the problem. Would you mind sending us full foreman log of the failure > plus verbose output of `hammer -v host update ...`? Or perhaps you could > use foreman-debug script. > > Thanks > Tomas > > > > > > -- > > 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. > >

> Thanks for the response, but unfortunately, I can't upload log files.
>
> I was able to stand up a second foreman instance and things work there,
> which tells me the issue is with the installation of foreman.
>
> Is there a way to validate that the foreman database is configured
> properly? I've checked and hammer in both instances is sending the same
> set of parameters, it's just the broken instance is rejecting the
> request due to an unknown parameter (compute_attributes).

I think I got it. Isn't your first instance installed with unattended
set to false? Check your foreman config.
I managed to reproduce the problem with such configuration. Reported
here: Bug #4018: API host creation fails with 500 error when unattended == false - Foreman

Regards
Tomas

··· On 01/10/2014 10:25 PM, Michael Griffin wrote:

Thanks

On Friday, January 10, 2014 4:57:21 AM UTC-5, Tomas Strachota wrote:

On 01/08/2014 07:38 PM, Michael Griffin wrote:
 > I currently have foreman 1.3.2 installed with the latest-released
hammer
 > rubygems (rubygem-hammer_cli-0.0.14 and
 > rubygem-hammer_cli_foreman-0.0.15) and I'm running in to a
strange bug.
 >
 > When I execute the command
 >
 >     hammer host update --name test-host.example.com
<http://test-host.example.com> --hostgroup-id 3
 >
 >
 > I get an error
 >
 >     Could not update the host:
 >
 >        Error: 500 Internal Server Error
 >
 >
 > A look at the hammer logs shows a large ruby stack trace, but I
do see a
 > log entry that could be the issue
 >
 >     unknown attribute: compute_attributes (ActiveRecord:
 >     UnknownAttributeError)
 >
 >
 > I am using foreman in the :unattended: false mode, so that it is
simply
 > a reporting and node classifier tool, with no provisioning
details defined.
 >
 > The last piece to note is that this command does work
 >
 >     curl -u admin:password -k --fail --silent -X PUT -d
 >     "host[hostgroup_id]=3"
"https://foreman/api/hosts/test-host.example.com
<https://foreman/api/hosts/test-host.example.com>"
 >
 >
 > which leads me to believe there is an issue with hammer itself,
rather
 > than the API call.
 >
 > Thanks

Hello Michael,
thank you for reporting it! Unfortunately I didn't manage to reproduce
the problem. Would you mind sending us full foreman log of the failure
plus verbose output of `hammer -v host update ...`? Or perhaps you
could
use foreman-debug script.

Thanks
Tomas


 >
 > --
 > 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 <javascript:>.
 > To post to this group, send email to forema...@googlegroups.com
<javascript:>.
 > Visit this group at http://groups.google.com/group/foreman-users
<http://groups.google.com/group/foreman-users>.
 > For more options, visit https://groups.google.com/groups/opt_out
<https://groups.google.com/groups/opt_out>.


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/groups/opt_out.