From 8627e4e06d33fa19fcf98ae44e88e0441b0cfb00 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Mon, 27 Aug 2018 12:33:51 -0700 Subject: [PATCH] Unlink proper path to ansible cache os.listdir returns dirents relative to the dir being listed. We need to give full path to these entries when unlinking them. Do this by joining the inventory_cache_dir path to each inventory_cache file. Change-Id: I78376cfa3b2aa92641f2685b08616660f523dfaf --- launch/launch-node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch/launch-node.py b/launch/launch-node.py index c5b29ca0ac..2d46ae1f76 100755 --- a/launch/launch-node.py +++ b/launch/launch-node.py @@ -141,7 +141,7 @@ def bootstrap_server(server, key, name, volume_device, keep, # Zero the ansible inventory cache so that next run finds the new server inventory_cache_dir = '/var/cache/ansible/inventory' for inventory_cache in os.listdir(inventory_cache_dir): - os.unlink(inventory_cache) + os.unlink(os.path.join(inventory_cache_dir, inventory_cache)) with JobDir(keep) as jobdir: # Update the generated-groups file globally and incorporate it