From 2cf939310efc5eca280cfa5c80fbc79b98ed2dd2 Mon Sep 17 00:00:00 2001 From: Enzo Candotti Date: Mon, 26 Dec 2022 16:38:51 -0300 Subject: [PATCH] Fix 'Edit Host' modal When trying to edit a host, the modal is not able to save the changes unless the max_cpu_mhz_configured parameter is modified since it's set as required. This change fixes that problem by setting the max_cpu_mhz_configured as not required and removing the forced assignment during clean() function. Test Plan: PASS: Change BMC type, IP, User and Password. Verify changes are listed in system show command. PASS: Modify host location, CPU frequency, Clock Synchronization. Verify changes are listed in system show command. Closes-Bug: 2000484 Signed-off-by: Enzo Candotti Change-Id: Icb6d05fe170d9202e7cc01ede7154c8d2bb98c72 --- .../dashboards/admin/inventory/workflows.py | 9 +++------ tox.ini | 6 +++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/workflows.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/workflows.py index f01735be..929f4e29 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/workflows.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/workflows.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2013-2021 Wind River Systems, Inc. +# Copyright (c) 2013-2022 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -141,6 +141,7 @@ class AddHostInfoAction(workflows.Action): class UpdateHostInfoAction(workflows.Action): + failure_message = _('Unable to modify host "%s".') host_id = forms.CharField(widget=forms.widgets.HiddenInput) personality = forms.ChoiceField(label=_("Personality"), @@ -192,7 +193,7 @@ class UpdateHostInfoAction(workflows.Action): label=_("Max CPU Frequency (MHz)"), initial=1, min_value=1, - required=True, + required=False, widget=forms.TextInput( attrs={ 'class': 'switched', @@ -283,9 +284,6 @@ class UpdateHostInfoAction(workflows.Action): def clean(self): cleaned_data = super(UpdateHostInfoAction, self).clean() - if cleaned_data['cpu_freq_config'] == 'max_cpu_mhz_allowed': - cleaned_data['max_cpu_mhz_configured'] = 'max_cpu_mhz_allowed' - disabled = self.fields['personality'].widget.attrs.get('disabled') if disabled == 'disabled': if self.system_type == constants.TS_AIO: @@ -316,7 +314,6 @@ class UpdateHostInfoAction(workflows.Action): LOG.error(ce) msg = self.failure_message + " " + str(ce) self.failure_message = msg - exceptions.handle(request, msg) return False except Exception as e: msg = str(e) diff --git a/tox.ini b/tox.ini index 326b9b42..9f26036c 100644 --- a/tox.ini +++ b/tox.ini @@ -21,7 +21,7 @@ deps = -r{toxinidir}/test-requirements.txt [testenv:linters] basepython = python3 -whitelist_externals = bash +allowlist_externals = bash commands = bash -c "find {toxinidir} \ -not \( -type d -name .?\* -prune \) \ @@ -82,7 +82,7 @@ install_command = pip install -U {opts} {packages} commands = rm -rf doc/build sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html -whitelist_externals = rm +allowlist_externals = rm [testenv:releasenotes] basepython = python3 @@ -91,7 +91,7 @@ install_command = pip install -U {opts} {packages} commands = rm -rf releasenotes/build sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html -whitelist_externals = +allowlist_externals = rm reno