Univention Bugzilla – Bug 43816
App Setting: Implement setting for an App
Last modified: 2023-03-25 06:39:57 CET
Goal is to allow Apps to specify custom setting that are then applied inside the container / on the host. Specification is done via a new file: myapp.settings with is dritten in ini format: [my/setting] ... [my/second/setting] ...
*** Bug 29649 has been marked as a duplicate of this bug. ***
An ISV asked for this feature: Two Variables should be configured for an app, which should trigger a ucr set for two respective UCRVs. Their scenario: Configure repository credentials
Done. Please note that a configure script is a Docker script, so it does not work for Non-Docker that easily. But: UCR variables work. One could register a UCR script.
*** Bug 42455 has been marked as a duplicate of this bug. ***
Created attachment 8921 [details] A list of all settings currently supported
Created attachment 8922 [details] .settings
@eduard, kannst du bitte parallel QA machen
During app installation, when a file widget with 'Write = Install' was added but no file is uploaded and the user proceeds to install: Die Ausführung des Kommandos appcenter/docker/progress ist fehlgeschlagen: Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/univention/management/console/base.py", line 281, in execute function(self, request) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 318, in _response result = _multi_response(self, request) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 462, in _response return list(function(self, iterator, *nones)) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 284, in _fake_func yield function(self, *args) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/mixins.py", line 149, in progress ret = progress_obj.poll() File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 309, in _thread result = _multi_response(self, request) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 462, in _response return list(function(self, iterator, *nones)) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 284, in _fake_func yield function(self, *args) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/appcenter/__init__.py", line 391, in invoke_docker result['success'] = action.call(app=app, username=self.username, password=self.password, **kwargs) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/__init__.py", line 196, in call return obj.call_with_namespace(namespace) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/__init__.py", line 202, in call_with_namespace result = self.main(namespace) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/install.py", line 67, in main return self.do_it(args) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/install_base.py", line 123, in do_it self._do_it(app, args) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/docker_install.py", line 63, in _do_it ret = super(Install, self)._do_it(app, args) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/install.py", line 85, in _do_it self._configure(app, args) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/install_base.py", line 306, in _configure configure.call(app=app, set_vars=args.set_vars) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/__init__.py", line 196, in call return obj.call_with_namespace(namespace) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/__init__.py", line 202, in call_with_namespace result = self.main(namespace) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/configure.py", line 65, in main self._set_config(args.app, set_vars, args) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/docker_configure.py", line 58, in _set_config super(Configure, self)._set_config(app, set_vars, args) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/configure.py", line 85, in _set_config setting.set_value(app, value) File "/usr/lib/pymodules/python2.7/univention/appcenter/settings.py", line 199, in set_value return self._write_file_content(docker.path(self.filename), value) File "/usr/lib/pymodules/python2.7/univention/appcenter/settings.py", line 177, in _write_file_content self.warn('Could not set content: %s' % exc) AttributeError: 'FileSetting' object has no attribute 'warn'
Die Ausführung des Kommandos appcenter/docker/progress ist fehlgeschlagen: Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/univention/management/console/base.py", line 281, in execute function(self, request) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 318, in _response result = _multi_response(self, request) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 462, in _response return list(function(self, iterator, *nones)) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 284, in _fake_func yield function(self, *args) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/mixins.py", line 149, in progress ret = progress_obj.poll() File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 309, in _thread result = _multi_response(self, request) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 462, in _response return list(function(self, iterator, *nones)) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 284, in _fake_func yield function(self, *args) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/appcenter/__init__.py", line 391, in invoke_docker result['success'] = action.call(app=app, username=self.username, password=self.password, **kwargs) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/__init__.py", line 196, in call return obj.call_with_namespace(namespace) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/__init__.py", line 202, in call_with_namespace result = self.main(namespace) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/install.py", line 67, in main return self.do_it(args) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/install_base.py", line 123, in do_it self._do_it(app, args) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/docker_install.py", line 63, in _do_it ret = super(Install, self)._do_it(app, args) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/install.py", line 84, in _do_it if self._install_app(app, args): File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/docker_install.py", line 57, in _install_app self._start_docker_image(app, hostdn, password, args) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/docker_base.py", line 161, in _start_docker_image if 'Install' in setting.write or 'Upgrade' in setting.write: AttributeError: 'StringSetting' object has no attribute 'write
Fixed those tracebacks. FYI: After discussion, we changed Write = to Show = and Read = to ShowReadOnly =
* Default values are not applied for installation, but later (if the setting is empty) maybe we should respect defaults only for the installation? minor: * Installation log error for every setting [ ERROR]: Cannot read nc/string while nextcloud=11.0.3-0 is not running => this is not an error * if i set a attribute to '' [ INFO]: Setting nc/string to None => better Unsetting nc/string ...
container upgrade resets settings Going to install Nextcloud (11.0.2-0) ... Calling configure Setting nc/noinstall to 'my aa' Setting nc/string to 'my default' ... Going to upgrade Nextcloud (11.0.3-0) Setting nc/noinstall to 'aa' Setting nc/string to 'default' -> univention-app shell nextcloud cat /etc/univention/base.conf| grep nc nc/bool: true nc/noinstall: aa nc/string: default
Should be fixed in univention-appcenter 5.0.23-86.320.201706210133 There is still a configure step during image upgrade (like Nextcloud) because of the way an image upgrade is performed. But as no script is executed there (only variables are set) and the variables are overwritten in the next step, this seems fine.
(In reply to Dirk Wiesenthal from comment #13) > Should be fixed in > univention-appcenter 5.0.23-86.320.201706210133 > > There is still a configure step during image upgrade (like Nextcloud) > because of the way an image upgrade is performed. > > But as no script is executed there (only variables are set) and the > variables are overwritten in the next step, this seems fine. OK, works * app settings are removed when uninstalling the app -> this is OK, but could we backup the settings before removing the app? (maybe to /var/lib/univention-appcenter/apps/$APP/settings) -> maybe also a hint in the remove dialog that all the app settings are removed? * default value should only apply for the installation
Required = True does not seem to have an effect?
Type = File shows the content of the File in UMC, univention-app configure --list and in /var/log/univention/appcenter.log. I uploaded a binary file and messed up my terminal, better not display the content (just the filename?)
A Type = File can't be deleted, ist this OK? For Type = Password(File) only one password input field is generate, so no protection against typo's?
as discussed, * merge to 4.2 * revert in 4.1 * Milestone errata4.2-1
It's now impossible to build univention-system-setup: run-parts: tests/test_setup_script_profile exited with return code 1 Traceback (most recent call last): File "tests/test_setup_script_ucr", line 10, in <module> from setup_script import TransactionalUcr File "tests/../umc/python/setup/setup_script.py", line 39, in <module> from util import PATH_SETUP_SCRIPTS, PATH_PROFILE File "tests/../umc/python/setup/util.py", line 68, in <module> from univention.appcenter.actions import get_action File "/usr/lib/pymodules/python2.7/univention/appcenter/__init__.py", line 34, in <module> from univention.appcenter.app import App, AppManager File "/usr/lib/pymodules/python2.7/univention/appcenter/app.py", line 54, in <module> from univention.appcenter.settings import Setting File "/usr/lib/pymodules/python2.7/univention/appcenter/settings.py", line 50, in <module> class Setting(TypedIniSectionObject): File "/usr/lib/pymodules/python2.7/univention/appcenter/settings.py", line 54, in Setting type = IniSectionAttribute(default='String', choices=['String', 'Int', 'Bool', 'List', 'Password', 'File', 'PasswordFile', 'Status']) TypeError: __init__() got an unexpected keyword argument 'choices'
Reverted for 4.1-4. Please verify the revert as it was a lot.
It seems to me, that the revert also removes parts of r80236. Have a look at management/univention-appcenter/python/appcenter/actions/remove.py Otherwise it looks clean.
(In reply to Eduard Mai from comment #21) > It seems to me, that the revert also removes parts of r80236. Have a look at > management/univention-appcenter/python/appcenter/actions/remove.py > > Otherwise it looks clean. This is wrong, the missing line is in docker_upgrade.py.
As discussed, I think the revert is okay. I have deleted two empty files and adjusted the YAML univention-appcenter 5.0.23-88.321.201706281252
yaml: OK Package: univention-appcenter Version: 5.0.23-88.321.201706281252 Branch: ucs_4.1-0 Scope: errata4.1-4 OK - app settings behave as before the revert VERIFIED