Merge "Add the upload-only option to the Horizon patch orchestration UI"

This commit is contained in:
Zuul 2023-03-08 16:12:30 +00:00 committed by Gerrit Code Review
commit ba46600775
3 changed files with 27 additions and 4 deletions

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
# #
# Copyright (c) 2017-2022 Wind River Systems, Inc. # Copyright (c) 2017-2023 Wind River Systems, Inc.
# #
import logging import logging
@ -125,7 +125,7 @@ def subcloud_group_update(request, subcloud_group_id, **kwargs):
class Strategy(base.APIResourceWrapper): class Strategy(base.APIResourceWrapper):
_attrs = ['strategy_type', 'subcloud_apply_type', _attrs = ['strategy_type', 'subcloud_apply_type',
'max_parallel_subclouds', 'stop_on_failure', 'state', 'max_parallel_subclouds', 'stop_on_failure', 'state',
'created_at', 'updated_at'] 'created_at', 'updated_at', 'extra_args']
def get_strategy(request): def get_strategy(request):

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2018-2022 Wind River Systems, Inc. # Copyright (c) 2018-2023 Wind River Systems, Inc.
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
@ -195,6 +195,20 @@ class CreateCloudStrategyForm(forms.SelfHandlingForm):
) )
) )
upload_only = forms.BooleanField(
label=_("Upload Only"),
initial=False,
required=False,
help_text=_('Stops strategy after uploading patches to subclouds'),
widget=forms.CheckboxInput(
attrs={
'class': 'switched',
'data-switch-on': 'strategy_types',
'data-strategy_types-patch': _("Upload Only")
}
)
)
def __init__(self, request, *args, **kwargs): def __init__(self, request, *args, **kwargs):
super(CreateCloudStrategyForm, self).__init__(request, *args, super(CreateCloudStrategyForm, self).__init__(request, *args,
**kwargs) **kwargs)
@ -250,6 +264,11 @@ class CreateCloudStrategyForm(forms.SelfHandlingForm):
del data['to-version'] del data['to-version']
del data['force-kubernetes'] del data['force-kubernetes']
if data['type'] == 'patch':
data['upload-only'] = str(data['upload-only']).lower()
else:
del data['upload-only']
response = api.dc_manager.strategy_create(request, data) response = api.dc_manager.strategy_create(request, data)
if not response: if not response:
messages.error(request, "Strategy creation failed") messages.error(request, "Strategy creation failed")

View File

@ -1,4 +1,4 @@
{% load i18n sizeformat %} {% load i18n sizeformat getvalue %}
{% block main %} {% block main %}
@ -17,6 +17,10 @@
<dd>{{ strategy.max_parallel_subclouds }}</dd> <dd>{{ strategy.max_parallel_subclouds }}</dd>
<dt>{% trans "Stop On Failure" %}</dt> <dt>{% trans "Stop On Failure" %}</dt>
<dd>{{ strategy.stop_on_failure }}</dd> <dd>{{ strategy.stop_on_failure }}</dd>
{% if strategy.strategy_type == 'patch' and strategy.extra_args %}
<dt>{% trans "Upload Only" %}</dt>
<dd>{{ strategy.extra_args|get_value:"upload-only" }}</dd>
{% endif %}
<dt>{% trans "State" %}</dt> <dt>{% trans "State" %}</dt>
<dd>{{ strategy.state }}</dd> <dd>{{ strategy.state }}</dd>
</dl> </dl>