From 8d737f58c17cfe3b2b2ff1be83c426aec4702e32 Mon Sep 17 00:00:00 2001
From: Benjamin Bertrand <benjamin.bertrand@esss.se>
Date: Mon, 18 Mar 2019 21:01:46 +0100
Subject: [PATCH] Removed unused update_inventory function

launch_awx_job function was updated to trigger an inventory update.
---
 app/tasks.py | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/app/tasks.py b/app/tasks.py
index 0707379..9a0cb51 100644
--- a/app/tasks.py
+++ b/app/tasks.py
@@ -197,29 +197,6 @@ def launch_awx_job(resource="job", **kwargs):
     return result
 
 
-def update_inventory(inventory_source, **kwargs):
-    """Update an inventory source in AWX
-
-    :param inventory_source: name or id of the inventory source to be updated
-    :param **kwargs: keyword arguments passed to update the inventory
-    :returns: A dictionary with information from resource.monitor
-    """
-    rq_job = get_current_job()
-    if not current_app.config.get("AWX_JOB_ENABLED", False):
-        current_app.logger.info("AWX job is disabled. Not sending any request.")
-        return "AWX inventory update not triggered"
-    # Launch the AWX job
-    resource = tower_cli.get_resource("inventory_source")
-    result = resource.update(inventory_source, **kwargs)
-    # Save the AWX job id in the task
-    task = models.Task.query.get(rq_job.id)
-    task.awx_job_id = result["id"]
-    db.session.commit()
-    # Monitor the job until done
-    result = resource.monitor(pk=result["id"])
-    return result
-
-
 def generate_items_excel_file():
     """Export all inventory items to an excel file
 
-- 
GitLab