from common.methods import set_progress
from containerorchestrators.kuberneteshandler.models import Kubernetes


def run(job, *args, **kwargs):
    resource = job.resource_set.first()
    
    container_orchestrator = Kubernetes.objects.get(id=resource.container_orchestrator_id)
    environment = container_orchestrator.environment_set.first()
    
    container_orchestrator.delete()
    environment.delete()
from common.methods import set_progress
from containerorchestrators.kuberneteshandler.models import Kubernetes
from utilities.run_command import execute_command


def run(job, *args, **kwargs):
    resource = job.resource_set.first()
    
    container_orchestrator = Kubernetes.objects.get(id=resource.container_orchestrator_id)
    environment = container_orchestrator.environment_set.first()
    
    container_orchestrator.delete()
    environment.delete()

    resource_dir = '/var/opt/cloudbolt/kubernetes/resource-{}'.format(resource_id)
    execute_command('rm -rf {}'.format(RESOURCE_LOCATION))

Remove config files from filesystem on teardown
Remove config files from filesystem on teardown

[DEV-13843]

  from common.methods import set_progress
  from containerorchestrators.kuberneteshandler.models import Kubernetes
+ from utilities.run_command import execute_command
  
  
  def run(job, *args, **kwargs):
      resource = job.resource_set.first()
      
      container_orchestrator = Kubernetes.objects.get(id=resource.container_orchestrator_id)
      environment = container_orchestrator.environment_set.first()
      
      container_orchestrator.delete()
      environment.delete()
+ 
+     resource_dir = '/var/opt/cloudbolt/kubernetes/resource-{}'.format(resource_id)
+     execute_command('rm -rf {}'.format(RESOURCE_LOCATION))
+ 
Remove config files from filesystem on teardown
## Code Before:
from common.methods import set_progress
from containerorchestrators.kuberneteshandler.models import Kubernetes


def run(job, *args, **kwargs):
    resource = job.resource_set.first()
    
    container_orchestrator = Kubernetes.objects.get(id=resource.container_orchestrator_id)
    environment = container_orchestrator.environment_set.first()
    
    container_orchestrator.delete()
    environment.delete()
## Instruction:
Remove config files from filesystem on teardown
## Code After:
from common.methods import set_progress
from containerorchestrators.kuberneteshandler.models import Kubernetes
from utilities.run_command import execute_command


def run(job, *args, **kwargs):
    resource = job.resource_set.first()
    
    container_orchestrator = Kubernetes.objects.get(id=resource.container_orchestrator_id)
    environment = container_orchestrator.environment_set.first()
    
    container_orchestrator.delete()
    environment.delete()

    resource_dir = '/var/opt/cloudbolt/kubernetes/resource-{}'.format(resource_id)
    execute_command('rm -rf {}'.format(RESOURCE_LOCATION))
