Cannot delete hosts

Problem:
When I click on the red “Delete” button in the host’s overview, the box tells me to wait until the request is finished. Then the message disappears and nothing else happens. The host is still there.

Expected outcome:
The host is removed.

Foreman and Proxy versions:
2.0.0

Foreman and Proxy plugin versions:
foreman-tasks 1.1.1
foreman_ansible 5.0.1
foreman_discovery 16.0.1
foreman_remote_execution 3.2.1

Distribution and version:
Debian 10.4

Other relevant data:
This (141.3 KB) is the output of foreman-installer --full-help
This (2.6 KB) is /var/log/foreman-proxy/proxy.log (I emptied it before trying the delete, so isolate the relevant logs)
I do not know if this is related to: Tasks is no longer working after update - #7 by Dirk although that one was about another version of tasks.

Can you also grep the 41e6354c transaction from production.log? Nothing suspicious on the proxy side, except SSH key deletion fails which should not rollback the transaction I hope.

Thank you for the quick reply!
This is the grep 41e6354c from /var/log/foreman/production.log (7.3 KB)

Surprising, @aruzicka this deletion fails because Foreman is unable to delete known_hosts entry:

 2020-05-15T10:52:15 [W|app|41e6354c] Rolling back due to a problem: [#<Orchestration::Task:0x00007f068aa7d068 @name="Remove SSH known hosts for casey-cavanesse.hitronhub.home", @id="ssh_remove_known_hosts_interface_192.168.0.9_1", @status="failed", @priority=200, @action=[#<Nic::Managed id: 7, mac: "00:0c:29:24:20:32", ip: "192.168.0.9", type: "Nic::Managed", name: "casey-cavanesse.hitronhub.home", host_id: 7, subnet_id: 1, domain_id: 1, attrs: {"netmask"=>"255.255.255.0", "mtu"=>1500, "network"=>"192.168.0.0", "speed"=>"1000", "duplex"=>"full", "port"=>"Twisted Pair", "auto_negotiation"=>"true", "wol"=>false}, created_at: "2020-05-11 20:35:08", updated_at: "2020-05-11 20:41:50", provider: nil, username: nil, password: nil, virtual: false, link: true, identifier: "ens33", tag: "", attached_to: "", managed: true, mode: "balance-rr", attached_devices: "", bond_options: "", primary: true, provision: true, compute_attributes: {}, execution: true, ip6: "2a02:8108:1480:22d0:20c:29ff:fe24:2032", subnet6_id: nil>, :drop_from_known_hosts, [1, "192.168.0.9"]], @created=1589532735.2462025, @timestamp=2020-05-15 08:52:15 UTC>]

The general practice we have for DNS, DHCP and few others is if deletion of non-fatal resource fails, Foreman ignores this. What you think?

Can you give an advice how to workaround this?

What version of ruby-smart-proxy-remote-execution-ssh do you have?

Package: ruby-smart-proxy-remote-execution-ssh
Version: 0.2.1-1

The known hosts key removal feature requires ruby-smart-proxy-remote-execution-ssh 0.3.0, which didn’t reach the repositories yet.

Packaging PR: https://github.com/theforeman/foreman-packaging/pull/5228

okay, that means I have to wait for the version to reach the repo? how long does this usually take?

And is this related to Creating discovered hosts is not working ?

It should be there now.

Wow, you are fast guys!
With ruby-smart-proxy-remote-execution-ssh 0.3.0 I can delete hosts.

Hello,

can you add this also to yum repo?

Thanks!

It is being worked on in https://github.com/theforeman/foreman-packaging/pull/5254 . However el* has older remote execution so you shouldn’t be running into this issue at all there.

I get the same error as @kiigass with difference that I get the error:
The following hosts were not deleted: localhost

debug:
2020-05-20T12:29:51 [W|app|a502bb53] Rolling back due to a problem: [#<Orchestration::Task:0x00007f4849ee43f8 @name="Remove SSH known hosts for localhost, @id=“ssh_remove_known_hosts_interface_******_1”, @status=“failed”,

Version
rpm -qa|egrep “foreman-release|foreman-proxy”
foreman-proxy-2.0.0-1.el7.noarch
foreman-release-2.0.0-1.el7.noarch
foreman-release-scl-7-2.el7.noarch

rpm -qa|grep tfm-rubygem-smart_proxy_remote_execution_ssh
tfm-rubygem-smart_proxy_remote_execution_ssh-0.2.1-4.fm2_0.el7.noarch

What version of tfm-rubygem-foreman_remote_execution do you have?

Installed from nightly yesterday:
https://yum.theforeman.org/plugins/nightly/el7/x86_64/tfm-rubygem-foreman_remote_execution-3.2.0-1.fm2_1.el7.noarch.rpm

rpm -qi tfm-rubygem-foreman_remote_execution-3.2.0-1.fm2_1.el7.noarch
Name : tfm-rubygem-foreman_remote_execution
Version : 3.2.0
Release : 1.fm2_1.el7
Architecture: noarch
Install Date: Tue 19 May 2020 10:13:37 AM CEST
Group : Applications/Systems

Update
Same behaviour with newest version tfm-rubygem-foreman_remote_execution-3.2.1-1.fm2_2.el7.noarch.rpm

For this you need tfm-rubygem-smart_proxy_remote_execution_ssh-0.3.0

Understood. Waiting for https://github.com/theforeman/foreman-packaging/pull/5254.

Thanks!