Skip to content

Commit

Permalink
fix(core): disable interpolation when loading/storing renku config (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
m-alisafaee committed Dec 14, 2021
1 parent 74c48f2 commit 4724b60
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion renku/core/management/config.py
Expand Up @@ -83,7 +83,8 @@ def load_config(self, config_filter=ConfigFilter.ALL):
except ImportError:
import importlib.resources as importlib_resources

config = configparser.ConfigParser()
# NOTE: Use RawConfigParser because ConfigParser does non-standard INI interpolation of some values
config = configparser.RawConfigParser()
ref = importlib_resources.files("renku.data") / "defaults.ini"
with importlib_resources.as_file(ref) as default_ini:
config_files = [default_ini]
Expand Down
13 changes: 13 additions & 0 deletions tests/cli/test_config.py
Expand Up @@ -259,3 +259,16 @@ def single_true(iterable):

# NOTE: assess the value was actually written
assert CONFIG_VALUE in get_value()


@pytest.mark.parametrize("value", ["%value", "${value}"])
def test_config_interpolation_is_disabled(client, runner, value):
"""Test ConfigParser interpolation is disabled."""
result = runner.invoke(cli, ["config", "set", "key", value])

assert 0 == result.exit_code, format_result_exception(result)

result = runner.invoke(cli, ["config", "show", "key"])

assert 0 == result.exit_code, format_result_exception(result)
assert f"{value}\n" == result.output

0 comments on commit 4724b60

Please sign in to comment.