Bug #3570
closedError during delete an Host
Description
NoMethodError
undefined method `[]' for nil:NilClass
app/controllers/hosts_controller.rb:120:in `destroy'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
Thank in advance
Olivier
Files
Updated by Dominic Cleal about 11 years ago
- Status changed from New to Need more information
Can you provide any more details?
Which version of Foreman is it exactly? (RPM or deb version)
Is this all hosts, or only certain ones?
Can you run Foreman in debug mode and gather logs of the entire request? http://projects.theforeman.org/projects/foreman/wiki/Troubleshooting#How-do-I-enable-debugging
Updated by Olivier Cruilles about 11 years ago
Foreman version 1.3.0-1.el6
Centos 6.4
I have no more than 2 hosts configured + the smart-proxy itself.
So for the 2 hosts, same problem.
Log resulting after deleting the both hosts:
D, [2013-11-04T14:24:31.712633 #24057] DEBUG -- : Found puppetca at /usr/sbin/puppetca
D, [2013-11-04T14:24:31.712862 #24057] DEBUG -- : Found sudo at /usr/bin/sudo
D, [2013-11-04T14:24:31.712969 #24057] DEBUG -- : Executing /usr/bin/sudo S /usr/sbin/puppetca --ssldir /var/lib/puppet/ssl --clean 7f93d42a-ab40-405e-9f7b-da8c58c1e362 : Attempt to remove nonexistant client certificate for 7f93d42a-ab40-405e-9f7b-da8c58c1e362
I, [2013-11-04T14:24:32.769862 #24057] INFO -
E, [2013-11-04T14:24:32.770331 #24057] ERROR -- : Attempt to remove nonexistant client certificate for 7f93d42a-ab40-405e-9f7b-da8c58c1e362
I, [2013-11-04T14:24:32.922866 #24057] INFO -- : Attempt to remove nonexistant client autosign for 7f93d42a-ab40-405e-9f7b-da8c58c1e362
E, [2013-11-04T14:24:32.923026 #24057] ERROR -- : Attempt to remove nonexistant client autosign for 7f93d42a-ab40-405e-9f7b-da8c58c1e362
Updated by Olivier Cruilles about 11 years ago
After some tries, I can create new Hosts but not delete them.
Say to me if it's the log is suffisient to troubleshoot this problem.
Updated by Dominic Cleal about 11 years ago
I'm not sure those errors in the logs are the failure reason or not. Can you follow the debug enabling instructions I linked and then supply the request logs from /var/log/foreman/production.log?
Updated by Olivier Cruilles about 11 years ago
Hi,
This is the full log, sorry for the delais.
Olivier
Updated by Dominic Cleal about 11 years ago
The error in the logs indicates a problem with tokens and database keys, which is bug #3468. Could you try clicking the Cancel Build button on the host page (which deletes the token) and then try deleting the host?
Updated by Olivier Cruilles about 11 years ago
Off course,
This is is
Updated by Dominic Cleal about 11 years ago
The error's coming from the puppetdb_foreman plugin, I think because its configuration is missing. Our RPM does contain an example config in /usr/share/foreman/config/settings.plugins.d/, so I think if you just move that into place and restart Foreman it will work.
Maybe the RPM should deploy a config that's disabled by default and provide the example as well.
Updated by Olivier Cruilles about 11 years ago
Can you tell me exactly where I need to move this file ?
I assume that I must rename this file like this: puppetdb_foreman.yaml
I tried to rename this example file in the same directory then restarted httpd service (httpd+passenger) and restarted foreman service.
Updated by Olivier Cruilles about 11 years ago
After restarted services, nothing change, same error deleting host.
Updated by Olivier Cruilles about 11 years ago
Ok, now after this modification, a different error message appair:
RuntimeError
Could not deactivate host: getaddrinfo: Name or service not known
app/controllers/hosts_controller.rb:120:in `destroy'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
So, why can not destroy this host if this host does not exist in DNS server.
I assume that is a king of protection (may be) but I trying Foreman for the moment and I do some test.
Is there a way to destroy it without declare it in the DNS or not ?
Thank you in advance
Updated by Dominic Cleal about 11 years ago
I can't tell if that's the problem or not from that short log snippet, could you provide debug logs again? If you still have the puppetdb_foreman plugin installed and enabled then you would need to ensure that config file is correct or it might generate this error trying to contact a non-existent PuppetDB server. Perhaps you want to uninstall the RPM if you're not using it.
Updated by Olivier Cruilles about 11 years ago
Log file
Updated by Dominic Cleal about 11 years ago
So yes, it's the puppetdb_foreman plugin trying to contact a non-existent server, see my previous reply. I'd suggest uninstalling or disabling it if you're not intending to use or configure it.
Updated by Olivier Cruilles about 11 years ago
Ok, after disabled puppetdb_plugin in Foreman, I been able to delete this host.
So, in fact it was not a bug but an mistake from me about best practice configuring Foreman+puppet.
Thank you for all
You can close this ticket.
Updated by Dominic Cleal about 11 years ago
- Tracker changed from Bug to Support
- Assignee set to Dominic Cleal
No problem, glad it's sorted.
Updated by Dominic Cleal about 11 years ago
- Tracker changed from Support to Bug
- Status changed from Need more information to Rejected
Updated by Dominic Cleal about 11 years ago
I've added a default "disabled" config now into the plugin package, hopefully it'll stop any more people tripping over the same issue.