diff --git a/app/tasks.py b/app/tasks.py index 070737965be6d02f9824efc8fdb1a95e83d561ab..9a0cb51d73267ccc4cd1d9b0dcee7b6a41652774 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