mirror of
https://github.com/MAGICGrants/truenas-apps.git
synced 2026-01-09 20:47:58 -05:00
chore(deps): update updates-patch-minor (#3602)
* chore(deps): update updates-patch-minor * uptime-kuma * fix opencloud * fix duplicati * Delete docker-compose.yaml --------- Co-authored-by: bugclerk <bugclerk@ixsystems.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <s.kois@outlook.com>
This commit is contained in:
@@ -24,6 +24,7 @@ class Environment:
|
||||
self._app_dev_variables: dict[str, Any] = {}
|
||||
|
||||
self._skip_generic_variables: bool = render_instance.values.get("skip_generic_variables", False)
|
||||
self._skip_id_variables: bool = render_instance.values.get("skip_id_variables", False)
|
||||
|
||||
self._auto_add_variables_from_values()
|
||||
|
||||
@@ -65,6 +66,12 @@ class Environment:
|
||||
value = value.lower()
|
||||
return value
|
||||
|
||||
def remove_auto_env(self, name: str):
|
||||
if name in self._auto_variables.keys():
|
||||
del self._auto_variables[name]
|
||||
return
|
||||
raise RenderError(f"Environment variable [{name}] is not defined.")
|
||||
|
||||
def add_env(self, name: str, value: Any):
|
||||
if not name:
|
||||
raise RenderError(f"Environment variable name cannot be empty. [{name}]")
|
||||
@@ -49,6 +49,7 @@ def test_auto_add_vars(mock_values):
|
||||
|
||||
def test_skip_generic_variables(mock_values):
|
||||
mock_values["skip_generic_variables"] = True
|
||||
mock_values["run_as"] = {"user": "1000", "group": "1000"}
|
||||
render = Render(mock_values)
|
||||
c1 = render.add_container("test_container", "test_image")
|
||||
c1.healthcheck.disable()
|
||||
@@ -56,7 +57,29 @@ def test_skip_generic_variables(mock_values):
|
||||
envs = output["services"]["test_container"]["environment"]
|
||||
|
||||
assert len(envs) == 1
|
||||
assert envs["NVIDIA_VISIBLE_DEVICES"] == "void"
|
||||
assert envs == {
|
||||
"NVIDIA_VISIBLE_DEVICES": "void",
|
||||
}
|
||||
|
||||
|
||||
def test_remove_auto_env(mock_values):
|
||||
mock_values["run_as"] = {"user": "1000", "group": "1000"}
|
||||
render = Render(mock_values)
|
||||
c1 = render.add_container("test_container", "test_image")
|
||||
c1.healthcheck.disable()
|
||||
c1.environment.remove_auto_env("UID")
|
||||
|
||||
output = render.render()
|
||||
envs = output["services"]["test_container"]["environment"]
|
||||
assert "UID" not in envs
|
||||
|
||||
|
||||
def test_remove_env_not_defined(mock_values):
|
||||
render = Render(mock_values)
|
||||
c1 = render.add_container("test_container", "test_image")
|
||||
c1.healthcheck.disable()
|
||||
with pytest.raises(Exception):
|
||||
c1.environment.remove_auto_env("NOT_DEFINED")
|
||||
|
||||
|
||||
def test_add_from_all_sources(mock_values):
|
||||
@@ -1,2 +1,2 @@
|
||||
0.0.1: f074617a82a86d2a6cc78a4c8a4296fc9d168e456f12713e50c696557b302133
|
||||
2.1.61: de8d91053f62a1b7a782bcf3f96d38851349a7725c457abb090beab46ac0e1ea
|
||||
2.1.62: 5d04ea326fca3ee8d6bbdd7ae966453f45e80ba8c83a81dfdae14ff99f8e70d5
|
||||
|
||||
Reference in New Issue
Block a user