Skip to content

Commit

Permalink
Update: Refactoring mixin script
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Lamirault <[email protected]>
  • Loading branch information
nlamirault committed Nov 17, 2023
1 parent 3ecad3f commit 9aa0f41
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions hack/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,22 @@ def manage_mixin(mixin_directory, mixin):
update_chart(mixin, mixin_version, chart_dst)


def main(url, filename, chart):
def main(url, filename, chart, download_enabled):
download(url, filename)
with zipfile.ZipFile(filename, "r") as zf:
mixins_directory = pathlib.Path(filename).stem
logger.info("Extract into: %s", mixins_directory)
pathlib.Path(mixins_directory).mkdir(parents=True, exist_ok=True)
zf.extractall(path=mixins_directory)
logger.info("Extract monitoring mixins")
for mixin in os.listdir(path=mixins_directory):
if mixin == chart:
manage_mixin(mixins_directory, mixin)
else:
logger.debug("Not mixin: %s", mixin)
os.remove(filename)
shutil.rmtree(mixins_directory)

for mixin in os.listdir(path=mixins_directory):
if mixin == chart:
manage_mixin(mixins_directory, mixin)
else:
logger.debug("Not mixin: %s", mixin)
os.remove(filename)
shutil.rmtree(mixins_directory)


if __name__ == "__main__":
Expand Down

0 comments on commit 9aa0f41

Please sign in to comment.