Skip to content
Snippets Groups Projects
Commit 8d737f58 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Removed unused update_inventory function

launch_awx_job function was updated to trigger an inventory update.
parent 540732dc
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment