Project

General

Profile

Actions

Bug #12195

closed

Dynflow Error on Deleting Host

Added by Riley Shott almost 9 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Setup:

Foreman 1.9.1 with foreman_chef (0.2.0)
SmartProxy 1.9.1 with smart_proxy_chef
Various Chef Clients with chef-handler-foreman

I'm getting the following error every time I delete a host in the Foreman. I have auto_deletion set to false as I don't want the Foreman to delete my nodes from the Chef server, so I'm surprised that dynflow is still attempting to execute a plan.

http://pastie.org/private/fdujgncwvvacgbk147iew

My apologies if this issue should have gone under foreman-tasks, but I decided to post it here as I'm not sure if it's an issue with foreman_chef executing dynflow plans when it shouldn't be.

If this is to be expected, should the following line be modified to catch if run.value is nil? (e.g. run.value.error? rescue nil)

https://github.com/theforeman/foreman-tasks/blob/0fe9b22da92c26b38bcd1452894e86a9315a0a07/app/models/foreman_tasks/concerns/action_triggering.rb#L132


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #12259: Host deletion generates error: undefined method `error?' for nil:NilClassDuplicate10/22/2015Actions
Actions #1

Updated by Marek Hulán almost 9 years ago

  • Translation missing: en.field_release deleted (73)

Thanks for the report, I see two issues in this ticket - 1) it tries to delete nodes and clients regardless of settings, 2) the deletion fails.

Ad 1) did you restart httpd (foreman) after you changed the value? What is your use case of not deleting data from chef-server? (I wonder if it should be disabled by default)

Ad 2) what is your smart_proxy_chef version? A new version fixing deletion API responses was published recently. Make sure you have 0.1.5 installed (and proxy restarted after updating).

Actions #2

Updated by Boris Kreitchman almost 9 years ago

I had the same issue just because I had foreman_chef installed - haven't even really configured or used it.
Hosts were deleted, but gave this error at the end.
So I suppose indeed it should be checked for nil at line 132 as suggested or with "if run.value && run.value.error?"

Actions #3

Updated by Riley Shott almost 9 years ago

It does try to delete nodes regardless of the setting, but it still actually does delete the host in the Foreman.

I did restart my httpd service (NGINX) after I changed the value, and I also touched 'tmp/restart.txt' inside the app for good measure. My use case for not deleting hosts from the Chef server is that I want to orchestrate that through our own means. There are a lot of other records in our various services that should also be deleted when a host is a removed (e.g. DNS, AD, Logging, etc...). I do think auto_deletion should be set to false by default as I would suspect our case wouldn't be unique.

I was using smart_proxy_chef version 0.1.4; I just updated to 0.1.5 and the problem still remains.

If you need anymore information please let me know!

Actions #4

Updated by Marek Hulán almost 9 years ago

It seems that there might be issue with dynflow executor not running. How did you install your foreman, was it using packages or gems? Could you try starting an executor with

RAILS_ENV=production rake foreman_tasks:dynflow:executor

and retry the deletion?

EDIT: I reproduced it locally and it helped

Actions #5

Updated by Marek Hulán almost 9 years ago

  • Project changed from Chef to foreman-tasks
  • Category deleted (foreman_chef)

Moving this issue to foreman-tasks to make the error message clearer.

Actions #6

Updated by Riley Shott almost 9 years ago

I installed my Foreman the manual way (i.e. git repo, & bundle commands) as I find it's easier to update when it's installed like this.

I ran the rake task and deleted a host and it worked! No errors. Do I need to setup a background task for this?

Actions #7

Updated by Marek Hulán almost 9 years ago

Yes, you need to have the executor running. We should document this and fix foreman-tasks so it does display a better error message.

Actions #8

Updated by Marek Hulán almost 9 years ago

  • Related to Bug #12259: Host deletion generates error: undefined method `error?' for nil:NilClass added
Actions #9

Updated by Riley Shott almost 9 years ago

Thanks for your help, Marek! I've created a service script for dynflow-executor. It assumes you're running dynflow-executor inside an RVM environment, and it should be easy enough to modify for those that aren't doing this.

https://gist.github.com/Ginja/fb123759d48b04b5f338

Actions #10

Updated by Marek Hulán almost 9 years ago

awesome, thank you, we should probably put this in gem docs

Actions #11

Updated by J LP almost 9 years ago

Marek Hulán wrote:

awesome, thank you, we should probably put this in gem docs

Also getting some variation on this where in 1.10rc2 and foreman_chef 0.2.0 it's Not actually deleting the clients/nodes from the chef server. I didn't install from the ground up, I used the installer (for both chef and foreman_chef) on ubuntu trust 14.04.03

Actions #12

Updated by The Foreman Bot almost 9 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Marek Hulán
  • Pull request https://github.com/theforeman/foreman-tasks/pull/149 added
Actions #13

Updated by Marek Hulán almost 9 years ago

  • Status changed from Ready For Testing to Resolved

I created a PR with the example service file. If the deletion still does not work it can be a different bug, could you please open a new issue with logs from failed deletion if you still encounter it (probably against foreman-chef project)? Closing this as resolved.

Actions

Also available in: Atom PDF