Merge pull request #9641 from jumpserver/pr@dev@perf_ansible_gateway

fix: 修复 ansible 网关问题
pull/9643/head
老广 2023-02-20 16:22:39 +08:00 committed by GitHub
commit 17a77586f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 16 deletions

View File

@ -60,9 +60,7 @@ class AccountSerializerCreateValidateMixin:
return instance
class AccountSerializerCreateMixin(
AccountSerializerCreateValidateMixin, BulkModelSerializer
):
class AccountSerializerCreateMixin(AccountSerializerCreateValidateMixin, BulkModelSerializer):
template = serializers.BooleanField(
default=False, label=_("Template"), write_only=True
)

View File

@ -3,13 +3,12 @@
from django.utils.translation import ugettext as _
from rest_framework import serializers
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
from ops.mixin import PeriodTaskSerializerMixin
from common.utils import get_logger
from accounts.models import AccountBackupAutomation, AccountBackupExecution
from common.const.choices import Trigger
from common.serializers.fields import LabeledChoiceField
from accounts.models import AccountBackupAutomation, AccountBackupExecution
from common.utils import get_logger
from ops.mixin import PeriodTaskSerializerMixin
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
logger = get_logger(__file__)
@ -20,18 +19,21 @@ class AccountBackupSerializer(PeriodTaskSerializerMixin, BulkOrgResourceModelSer
class Meta:
model = AccountBackupAutomation
read_only_fields = [
'date_created', 'date_updated', 'created_by', 'periodic_display', 'executed_amount'
'date_created', 'date_updated', 'created_by',
'periodic_display', 'executed_amount'
]
fields = read_only_fields + [
'id', 'name', 'is_periodic', 'interval', 'crontab', 'comment', 'recipients', 'types'
'id', 'name', 'is_periodic', 'interval', 'crontab',
'comment', 'recipients', 'types'
]
extra_kwargs = {
'name': {'required': True},
'periodic_display': {'label': _('Periodic perform')},
'executed_amount': {'label': _('Executed amount')},
'recipients': {'label': _('Recipient'), 'help_text': _(
'Currently only mail sending is supported'
)},
'recipients': {
'label': _('Recipient'),
'help_text': _('Currently only mail sending is supported')
},
'types': {'label': _('Asset type')}
}
@ -42,7 +44,7 @@ class AccountBackupPlanExecutionSerializer(serializers.ModelSerializer):
class Meta:
model = AccountBackupExecution
read_only_fields = [
'id', 'date_start', 'timedelta', 'plan_snapshot', 'trigger', 'reason',
'is_success', 'org_id', 'recipients'
'id', 'date_start', 'timedelta', 'plan_snapshot',
'trigger', 'reason', 'is_success', 'org_id', 'recipients'
]
fields = read_only_fields + ['plan']

View File

@ -54,7 +54,7 @@ class JMSInventory:
if gateway.private_key:
proxy_command_list.append("-i {}".format(gateway.private_key_path))
proxy_command = "'-o ProxyCommand={}'".format(
proxy_command = '-o ProxyCommand=\"{}\"'.format(
" ".join(proxy_command_list)
)
return {"ansible_ssh_common_args": proxy_command}