appsv2: missing raw_msg=True for exceptions

This commit is contained in:
Alexandre Aubin 2023-02-13 18:17:39 +01:00
parent aa9bc47aa6
commit 1d1a3756ba

View file

@ -302,7 +302,8 @@ class PermissionsResource(AppResource):
and properties["main"]["url"] != "/" and properties["main"]["url"] != "/"
): ):
raise YunohostError( raise YunohostError(
"URL for the 'main' permission should be '/' for webapps (or undefined/None for non-webapps). Note that / refers to the install url of the app" "URL for the 'main' permission should be '/' for webapps (or undefined/None for non-webapps). Note that / refers to the install url of the app",
raw_msg=True
) )
super().__init__({"permissions": properties}, *args, **kwargs) super().__init__({"permissions": properties}, *args, **kwargs)
@ -470,12 +471,12 @@ class SystemuserAppResource(AppResource):
if check_output(f"getent passwd {self.app} &>/dev/null || true").strip(): if check_output(f"getent passwd {self.app} &>/dev/null || true").strip():
os.system(f"deluser {self.app} >/dev/null") os.system(f"deluser {self.app} >/dev/null")
if check_output(f"getent passwd {self.app} &>/dev/null || true").strip(): if check_output(f"getent passwd {self.app} &>/dev/null || true").strip():
raise YunohostError(f"Failed to delete system user for {self.app}") raise YunohostError(f"Failed to delete system user for {self.app}", raw_msg=True)
if check_output(f"getent group {self.app} &>/dev/null || true").strip(): if check_output(f"getent group {self.app} &>/dev/null || true").strip():
os.system(f"delgroup {self.app} >/dev/null") os.system(f"delgroup {self.app} >/dev/null")
if check_output(f"getent group {self.app} &>/dev/null || true").strip(): if check_output(f"getent group {self.app} &>/dev/null || true").strip():
raise YunohostError(f"Failed to delete system user for {self.app}") raise YunohostError(f"Failed to delete system user for {self.app}", raw_msg=True)
# FIXME : better logging and error handling, add stdout/stderr from the deluser/delgroup commands... # FIXME : better logging and error handling, add stdout/stderr from the deluser/delgroup commands...
@ -743,7 +744,8 @@ class AptDependenciesAppResource(AppResource):
isinstance(values.get(k), str) for k in ["repo", "key", "packages"] isinstance(values.get(k), str) for k in ["repo", "key", "packages"]
): ):
raise YunohostError( raise YunohostError(
"In apt resource in the manifest: 'extras' repo should have the keys 'repo', 'key' and 'packages' defined and be strings" "In apt resource in the manifest: 'extras' repo should have the keys 'repo', 'key' and 'packages' defined and be strings",
raw_msg=True
) )
super().__init__(properties, *args, **kwargs) super().__init__(properties, *args, **kwargs)
@ -860,7 +862,8 @@ class PortsResource(AppResource):
if infos["fixed"]: if infos["fixed"]:
if self._port_is_used(port_value): if self._port_is_used(port_value):
raise YunohostValidationError( raise YunohostValidationError(
f"Port {port_value} is already used by another process or app." f"Port {port_value} is already used by another process or app.",
raw_msg=True
) )
else: else:
while self._port_is_used(port_value): while self._port_is_used(port_value):