Fix dependency symlink idempotency

Previously, existing dependency symlinks were causing
FileExistsErrors. This simplifies the logic to ensure
they do get deleted before being recreated. It also
moves to erroring if a chart's `charts` directory is
not a directory, since this is something a chart author
ought to fix, since it needs to be a directory in order
to add dependency sub-directories to it.

Change-Id: I7cc1d50f2bf09602866ce2cf13a4d6c8f6e118ce
This commit is contained in:
Sean Eagan 2021-10-05 12:52:42 -05:00
parent 34ebac542b
commit 862c289e4b

View File

@ -55,14 +55,7 @@ class ChartBuilder(object):
# NOTE: Ideally we would only delete the subcharts being
# overridden, and leave the others in place, but we delete all
# for backward compatibility with the Helm 2 based Armada.
(rmtree(d) for d in charts_path.iterdir() if d.is_dir())
else:
if charts_path.exists():
# NOTE: Ideally we would throw an error if `charts` is a
# non-directory, but we don't for backward compatibility
# with the Helm 2 based Armada.
charts_path.unlink()
rmtree(charts_dir)
charts_path.mkdir()
# Add symlinks to dependencies into `charts` dir.