From 862c289e4bfd9506007406cd5a75615e3d1920b8 Mon Sep 17 00:00:00 2001 From: Sean Eagan Date: Tue, 5 Oct 2021 12:52:42 -0500 Subject: [PATCH] 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 --- armada/handlers/chartbuilder.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/armada/handlers/chartbuilder.py b/armada/handlers/chartbuilder.py index 7952b554..761c9f60 100644 --- a/armada/handlers/chartbuilder.py +++ b/armada/handlers/chartbuilder.py @@ -55,15 +55,8 @@ 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() - - charts_path.mkdir() + rmtree(charts_dir) + charts_path.mkdir() # Add symlinks to dependencies into `charts` dir. for chart_dep in dependencies: