diff --git a/inventory_provider/tasks/worker.py b/inventory_provider/tasks/worker.py index 54c26e587bb8afae7571dc40986e6241d6690d2e..93603c6103b9860ad5b31b1d32366d46f5adbd30 100644 --- a/inventory_provider/tasks/worker.py +++ b/inventory_provider/tasks/worker.py @@ -226,3 +226,19 @@ def update_inventory_system_cache(): update_interface_statuses.s() ]) g.apply_async() + + +@app.task() +def update_junosspace_device_list(): + logger = logging.getLogger(constants.TASK_LOGGER_NAME) + logger.error('HERE: update_junosspace_device_list') + + r = get_redis(InventoryTask.config) + + logger.error(InventoryTask.config["junosspace"]) + for d in juniper.load_routers_from_junosspace( + InventoryTask.config["junosspace"]): + logger.error(d) + r.set( + 'junosspace:' + d['hostname'], + json.dumps(d).encode('utf-8'))