Teardown Tasks

Hello All, I am trying to get to a point of where the teardown task will remove the node from the chef integration. The issue I am running into is I can execute the task manually with a server context and it works great in removing the node from chef. The problem arises when it is the teardown task in the workflow.

For testing purposes up front, it is a very simple task via bash:
cd /path/to/chef/command
knife node delete $servername -y
knife client delete $servername -y

It doesn’t appear to run at all and shows nothing in the logs of the remote server or anything.

Does anyone have an example of a teardown script for removing chef nodes that works in the actual teardown process?

Any help or discussion is appreciated…

Hello, just a few questions to help better answer you. Is there a delayed removal policy in place. Is the machine powered on when you hit delete? If it isn’t it cannot run those knife commands on the target vm. Or are you running with context local and using the knife command on the appliance?

The knife command is being ran on a remote server and the script is kept local to the morpheus server. The instance itself I don’t think would be required to be powered on at all with it being a teardown task, right? In this example I am really just echo’ing everything into a file for validation that the task is running, and I get nothing on the remote server when it is a portion of the workflow assigned during the provisioning of the instance. Only when the task is executed manually with any existing instance name.

Cool, how are you applying the workflow to the instance. is it targeted as part of provisioning?

Provisioning via policy to that specific cloud currently.

So confirming this is greenfield. because the workflow containing that teardown phase has to be attached to the instance from the initial run in order for. teardown to kick off

That would be correct. I am deploying a new instance every time I am testing the process. I have also ran it with policy as well as assigning the workflow manually. I guess one question is where can I tell that the teardown task is actually getting ran? I am assuming that the normal morpheus variables are also still valid during the teardown process. I am having the same issue with an email task for deletion as well. Works with the manual execution, but not during the actual teardown phase of a compute deletion.

okay , so I may have just noticed something… do the teardown tasks not run unless I delete the instance itself?

So, this is interesting. If you delete via virtual machine in cloud => compute with remove infra and the associated instances, it does not run the teardown tasks. why would this be any different than deleting through the instances area?

Wow, that cost me a ton of time…

I believe this is due to the provisioning workflow being tied to the instance itself which can contain multiple VMs, Deleting a VM from outside of the instance would not trigger any workflow to run.