From 0b5bacb1761aefa74adb79bd1683d614bdf8c998 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Wed, 3 Jan 2018 12:56:22 -0700 Subject: cli: cloud-init clean handles symlinks Fix cloud-init clean subcommand to unlink symlinks instead of calling del_dir. LP: #1741093 --- cloudinit/cmd/clean.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cloudinit/cmd/clean.py') diff --git a/cloudinit/cmd/clean.py b/cloudinit/cmd/clean.py index 81797b1c..de22f7f2 100644 --- a/cloudinit/cmd/clean.py +++ b/cloudinit/cmd/clean.py @@ -10,7 +10,8 @@ import sys from cloudinit.stages import Init from cloudinit.util import ( - ProcessExecutionError, chdir, del_dir, del_file, get_config_logfiles, subp) + ProcessExecutionError, chdir, del_dir, del_file, get_config_logfiles, + is_link, subp) def error(msg): @@ -65,7 +66,7 @@ def remove_artifacts(remove_logs, remove_seed=False): if path == 'seed' and not remove_seed: continue try: - if os.path.isdir(path): + if os.path.isdir(path) and not is_link(path): del_dir(path) else: del_file(path) -- cgit v1.2.3