From b7af2b3d2bbee569e55d7568f465af8396b4a32f Mon Sep 17 00:00:00 2001 From: Pallab Pain Date: Mon, 21 Oct 2024 15:51:47 +0530 Subject: [PATCH 1/2] fix(apply): deep merge secrets and values --- riocli/apply/parse.py | 11 ++++++----- uv.lock | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/riocli/apply/parse.py b/riocli/apply/parse.py index 1e86574f..ee594be1 100644 --- a/riocli/apply/parse.py +++ b/riocli/apply/parse.py @@ -18,6 +18,7 @@ import click import yaml +from benedict import benedict from graphlib import TopologicalSorter from munch import munchify @@ -28,7 +29,7 @@ print_resolved_objects, ) from riocli.config import Configuration -from riocli.constants import Colors, Symbols, ApplyResult +from riocli.constants import ApplyResult, Colors, Symbols from riocli.exceptions import ResourceNotFound from riocli.utils import dump_all_yaml, print_centered_text, run_bash from riocli.utils.graph import Graphviz @@ -488,7 +489,7 @@ def _inject_rio_namespace(self, values: typing.Optional[dict] = None) -> dict: } if "rio" in values: - values["rio"].update(rio) + benedict(values["rio"]).merge(rio) else: values["rio"] = rio @@ -498,15 +499,15 @@ def _process_values_and_secrets( self, values: typing.List, secrets: typing.List ) -> None: """Process the values and secrets files and inject them into the manifest files""" - self.values, self.secrets = {}, {} + self.values, self.secrets = benedict({}), benedict({}) values = values or [] secrets = secrets or [] for v in values: - self.values.update(self._load_file_content(v, is_value=True)[0]) + benedict(self.values).merge(self._load_file_content(v, is_value=True)[0]) self.values = self._inject_rio_namespace(self.values) for s in secrets: - self.secrets.update(self._load_file_content(s, is_secret=True)[0]) + benedict(self.values).merge(self._load_file_content(s, is_secret=True)[0]) diff --git a/uv.lock b/uv.lock index 62298082..0ec11e68 100644 --- a/uv.lock +++ b/uv.lock @@ -721,7 +721,7 @@ wheels = [ [[package]] name = "rapyuta-io-cli" -version = "0.0.0" +version = "9.0.4" source = { editable = "." } dependencies = [ { name = "argparse" }, From 6407576533fc76142194e3c7938567a93ba40823 Mon Sep 17 00:00:00 2001 From: Pallab Pain Date: Tue, 22 Oct 2024 11:11:39 +0530 Subject: [PATCH 2/2] chore: format files --- riocli/device/report.py | 4 +--- riocli/vpn/util.py | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/riocli/device/report.py b/riocli/device/report.py index abcfad47..e33ad43f 100644 --- a/riocli/device/report.py +++ b/riocli/device/report.py @@ -97,7 +97,5 @@ def report_device( spinner.green.ok(Symbols.SUCCESS) except Exception as e: - spinner.text = click.style( - "Failed to report device: {}".format(e), fg=Colors.RED - ) + spinner.text = click.style("Failed to report device: {}".format(e), fg=Colors.RED) spinner.red.fail(Symbols.ERROR) diff --git a/riocli/vpn/util.py b/riocli/vpn/util.py index 057288f7..6d5c0e2b 100644 --- a/riocli/vpn/util.py +++ b/riocli/vpn/util.py @@ -94,8 +94,7 @@ def install_vpn_tools() -> None: click.confirm( click.style( - "{} VPN tools are not installed. Do you want " - "to install them now?".format( + "{} VPN tools are not installed. Do you want " "to install them now?".format( Symbols.INFO ), fg=Colors.YELLOW,