Bug 1741631

Summary: Embedded Ansible runs do not clean up the temp directory on completion
Product: Red Hat CloudForms Management Engine Reporter: Jason Frey <jfrey>
Component: Embedded AnsibleAssignee: dmetzger
Status: CLOSED CURRENTRELEASE QA Contact: Gaurav Talreja <gtalreja>
Severity: medium Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: high    
Version: 5.11.0CC: abellott, dmetzger, gtalreja, obarenbo, simaishi
Target Milestone: GA   
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.21 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-13 14:57:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jason Frey 2019-08-15 16:19:59 UTC
Description of problem:
Embedded Ansible runs do not clean up the temp directory on completion


Version-Release number of selected component (if applicable):
5.11.0


How reproducible:
100%


Steps to Reproduce:
1. Run an Embedded Ansible job


Actual results:
Temp dir still contains the source checkout


Expected results:
Temp dir does not contain the source checkout

Comment 3 CFME Bot 2019-08-15 18:55:39 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/aa334b5d297dfb8826b819f4791d29f672ba59cf
commit aa334b5d297dfb8826b819f4791d29f672ba59cf
Author:     Jason Frey <jfrey>
AuthorDate: Tue Aug 13 14:51:56 2019 -0400
Commit:     Jason Frey <jfrey>
CommitDate: Tue Aug 13 14:51:56 2019 -0400

    Cleanup the temporary checkout created by Embedded Ansible runs

    This moves the knowledge of creation and destruction of the temporary
    directory into the AnsibleRunnerWorkflow.  AnsibleRunnerWorkflow now
    supports both a direct playbook_path (for on-disk playbooks) or a
    configuration_script_source_id + playbook_relative_path pair of options.
    If that pair is present, then the workflow knows it must checkout the
    git repository contents first, and then later clean it up.

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1741631

 app/models/manageiq/providers/ansible_playbook_workflow.rb | 13 +
 app/models/manageiq/providers/ansible_role_workflow.rb | 17 +
 app/models/manageiq/providers/ansible_runner_workflow.rb | 49 +-
 app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script.rb | 12 +-
 spec/models/manageiq/providers/ansible_playbook_workflow_spec.rb | 86 +-
 spec/models/manageiq/providers/ansible_role_workflow_spec.rb | 91 +-
 spec/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_spec.rb | 7 +-
 7 files changed, 243 insertions(+), 32 deletions(-)

Comment 4 CFME Bot 2019-08-16 15:31:09 UTC
New commit detected on ManageIQ/manageiq/ivanchuk:

https://github.com/ManageIQ/manageiq/commit/330d3327c8010dbe57fb9912ff8a78dd3d8af02e
commit 330d3327c8010dbe57fb9912ff8a78dd3d8af02e
Author:     Nick Carboni <ncarboni>
AuthorDate: Thu Aug 15 14:52:04 2019 -0400
Commit:     Nick Carboni <ncarboni>
CommitDate: Thu Aug 15 14:52:04 2019 -0400

    Merge pull request #19145 from Fryguy/cleanup_git_repository_after_ansible_runner_workflow

    Cleanup the temporary checkout created by Embedded Ansible runs

    (cherry picked from commit e9a1b4144b0d1d745ac1b3791a703cb001dbc3dc)

    https://bugzilla.redhat.com/show_bug.cgi?id=1741631

 app/models/manageiq/providers/ansible_playbook_workflow.rb | 13 +
 app/models/manageiq/providers/ansible_role_workflow.rb | 17 +
 app/models/manageiq/providers/ansible_runner_workflow.rb | 49 +-
 app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script.rb | 12 +-
 spec/models/manageiq/providers/ansible_playbook_workflow_spec.rb | 86 +-
 spec/models/manageiq/providers/ansible_role_workflow_spec.rb | 91 +-
 spec/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_spec.rb | 7 +-
 7 files changed, 243 insertions(+), 32 deletions(-)

Comment 5 Satyajit Bulage 2019-08-23 10:26:40 UTC
After playbook execution finished without error. Able to see the directory is being cleaned up properly.

Verified Version: 5.11.0.21.20190821214526_b0060d0