diff options
author | Chad Smith <chad.smith@canonical.com> | 2018-01-03 12:56:22 -0700 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2018-01-03 12:56:22 -0700 |
commit | 0b5bacb1761aefa74adb79bd1683d614bdf8c998 (patch) | |
tree | 14c5afbf617570e5b48f252e2fae2551f9920f0a /cloudinit/cmd/clean.py | |
parent | 25ddc98e8dcd37272825f7044cf4487e3ade126b (diff) | |
download | vyos-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.py | 5 |
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) |