Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1218293 - Entering Discovered Host - Provision edit form deletes attributes immediately
Summary: Entering Discovered Host - Provision edit form deletes attributes immediately
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Discovery Plugin
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Lukas Zapletal
QA Contact: Sachin Ghai
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks: 1193977
TreeView+ depends on / blocked
 
Reported: 2015-05-04 14:10 UTC by Sachin Ghai
Modified: 2017-02-23 20:05 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-12 14:02:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
two discovered hosts with mem/disk zero (52.85 KB, image/png)
2015-05-05 06:15 UTC, Sachin Ghai
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 10375 0 None None None 2016-04-22 15:37:30 UTC

Description Sachin Ghai 2015-05-04 14:10:23 UTC
Description of problem:

[root@dhcp201-172 yum.repos.d]# hammer -d --username admin --password changeme discovery list



[DEBUG 2015-05-04 19:41:23 API] 500 Internal Server Error
{
    "error" => {
        "message" => "Host::Discovered#memory delegated to discovery_attribute_set.memory, but discovery_attribute_set is nil: #<Host::Discovered id: 2, name: \"mac52540058ef64\", ip: \"192.168.100.11\", last_compile: nil, last_freshcheck: nil, last_report: \"2015-05-04 11:12:07\", updated_at: \"2015-05-04 11:12:07\", source_file_id: nil, created_at: \"2015-05-04 11:12:07\", mac: \"52:54:00:58:ef:64\", root_pass: nil, serial: nil, puppet_status: 0, domain_id: nil, architecture_id: nil, operatingsystem_id: nil, environment_id: nil, subnet_id: 1, ptable_id: nil, medium_id: nil, build: false, comment: nil, disk: nil, installed_at: nil, model_id: 2, hostgroup_id: nil, owner_id: nil, owner_type: nil, enabled: true, puppet_ca_proxy_id: nil, managed: false, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: nil, certname: nil, image_id: nil, organization_id: 1, location_id: 2, type: \"Host::Discovered\", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, content_source_id: nil, primary_interface: \"eth0\", grub_pass: \"\", discovery_rule_id: nil, content_view_id: nil, lifecycle_environment_id: nil>"
    }
}
[ERROR 2015-05-04 19:41:23 Exception] Error: 500 Internal Server Error
Error: 500 Internal Server Error
[ERROR 2015-05-04 19:41:23 Exception] 

RestClient::InternalServerError (500 Internal Server Error):
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit'
    /usr/share/ruby/net/http.rb:852:in `start'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/resource.rb:51:in `get'
    /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:279:in `call_client'
    /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:210:in `http_call'
    /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:160:in `call'
    /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/resource.rb:14:in `call'
    /usr/share/gems/gems/hammer_cli-0.1.4.9/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.10/lib/hammer_cli_foreman/commands.rb:185:in `send_request'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.10/lib/hammer_cli_foreman/commands.rb:270:in `send_request'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.10/lib/hammer_cli_foreman/commands.rb:316:in `retrieve_and_print'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.10/lib/hammer_cli_foreman/commands.rb:303:in `browse_collection'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.10/lib/hammer_cli_foreman/commands.rb:288:in `execute'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.9/lib/hammer_cli/abstract.rb:23:in `run'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.9/lib/hammer_cli/abstract.rb:23:in `run'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.9/lib/hammer_cli/abstract.rb:23:in `run'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.9/bin/hammer:108:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'




Version-Release number of selected component (if applicable):
sat6.1 GA snap2 (Satellite-6.1.0-RHEL-7-20150429.2)


How reproducible:
always

Steps to Reproduce:
1. list the discovered host via hammer
2.
3.

Actual results:
(NoMethodError) undefined method `memory' for nil:NilClass


Expected results:
shouldn't raise any error.

Additional info:

production.log:

Comment 4 Sachin Ghai 2015-05-05 06:15:39 UTC
Created attachment 1022067 [details]
two discovered hosts with mem/disk zero

Comment 5 Bryan Kearney 2015-05-05 13:44:08 UTC
Created redmine issue http://projects.theforeman.org/issues/10375 from this bug

Comment 6 orabin 2015-05-05 20:14:27 UTC
discovery_attribute_set should have been created when the hosts were discovered.
I reproduced only when trying to use hosts discovered before discovery_attribute_set was added or removing the record from the DB.
If you find steps to recreate a discovered hosts with no memory please send them to me.

There is a workaround so I don't think it should be a blocker.
You can see in the logs that the host id is 2 so refresh it's facts by:

hammer discovery refresh-facts --id 2 

and then try listing the discovered hosts again.
If this happens with more hosts refresh their facts too.
Refreshing the facts will recreate the discovery_attribute_set.

Comment 8 Lukas Zapletal 2015-05-06 07:56:10 UTC
REPRODUCER:

1) Discover a host
2) Host::Discovered.all.first.memory -> OK
3) Click on Provision button to get to the form (do not yet submit or anything)
4) Host::Discovered.all.first.memory

2015-05-06 09:54:38 [D]   Host::Discovered Load (0.5ms)  SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Discovered')
2015-05-06 09:54:38 [D]   DiscoveryAttributeSet Load (0.2ms)  SELECT "discovery_attribute_sets".* FROM "discovery_attribute_sets" WHERE "discovery_attribute_sets"."host_id" = 80 LIMIT 1
RuntimeError: Host::Discovered#memory delegated to discovery_attribute_set.memory, but discovery_attribute_set is nil: #<Host::Discovered id: 80, name: "mac525400302472", last_compile: nil, last_freshcheck: nil, last_report: "2015-05-06 07:54:20", updated_at: "2015-05-06 07:54:20", source_file_id: nil, created_at: "2015-05-06 07:54:00", root_pass: nil, serial: nil, puppet_status: 0, architecture_id: nil, operatingsystem_id: nil, environment_id: nil, ptable_id: nil, medium_id: nil, build: false, comment: nil, disk: nil, installed_at: nil, model_id: 2, hostgroup_id: nil, owner_id: nil, owner_type: nil, enabled: true, puppet_ca_proxy_id: nil, managed: false, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: nil, certname: nil, image_id: nil, organization_id: 4, location_id: 7, type: "Host::Discovered", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, grub_pass: "", discovery_rule_id: nil>
from /home/lzap/work/foreman_discovery/app/models/host/discovered.rb:15:in `rescue in memory'

Comment 9 Bryan Kearney 2015-05-06 10:06:06 UTC
Upstream bug assigned to lzap

Comment 13 Sachin Ghai 2015-05-22 13:39:08 UTC
Verified with Sat6.1 GA snap5. 

Looks like the reported issue is no longer reproducible. Now If I close the discovered host form without updating or submitting. UI shows all facts correctly. Earlier all facts were being set to '0'.

Since this issue is no longer reproducible. Moving this verified..

Comment 14 Bryan Kearney 2015-08-11 13:36:44 UTC
This bug is slated to be released with Satellite 6.1.

Comment 15 Bryan Kearney 2015-08-12 14:02:03 UTC
This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015.


Note You need to log in before you can comment on or make changes to this bug.