summaryrefslogtreecommitdiff
path: root/cloudinit/cmd/clean.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2018-01-03 12:56:22 -0700
committerChad Smith <chad.smith@canonical.com>2018-01-03 12:56:22 -0700
commit0b5bacb1761aefa74adb79bd1683d614bdf8c998 (patch)
tree14c5afbf617570e5b48f252e2fae2551f9920f0a /cloudinit/cmd/clean.py
parent25ddc98e8dcd37272825f7044cf4487e3ade126b (diff)
downloadvyos-cloud-init-0b5bacb1761aefa74adb79bd1683d614bdf8c998.tar.gz
vyos-cloud-init-0b5bacb1761aefa74adb79bd1683d614bdf8c998.zip
cli: cloud-init clean handles symlinks
Fix cloud-init clean subcommand to unlink symlinks instead of calling del_dir. LP: #1741093
Diffstat (limited to 'cloudinit/cmd/clean.py')
-rw-r--r--cloudinit/cmd/clean.py5
1 files changed, 3 insertions, 2 deletions
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)