Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor: job 类自动去除用户输入的左右空格 #7104

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,18 @@

from django.utils import translation
from django.utils.translation import ugettext_lazy as _

from pipeline.core.flow.io import (
StringItemSchema,
ObjectItemSchema,
BooleanItemSchema,
)
from pipeline.component_framework.component import Component
from pipeline.core.flow.io import BooleanItemSchema, ObjectItemSchema, StringItemSchema

from api.utils.request import batch_request
from gcloud.exceptions import ApiRequestError
from pipeline_plugins.components.collections.sites.open.job import JobService, GetJobTargetServerMixin
from pipeline_plugins.components.utils import get_job_instance_url, get_node_callback_url
from ..base import GetJobHistoryResultMixin, get_job_tagged_ip_dict_complex

from gcloud.conf import settings
from gcloud.constants import JobBizScopeType
from gcloud.exceptions import ApiRequestError
from gcloud.utils.handlers import handle_api_error
from pipeline_plugins.components.collections.sites.open.job import GetJobTargetServerMixin, JobService
from pipeline_plugins.components.utils import get_job_instance_url, get_node_callback_url

from ..base import GetJobHistoryResultMixin, get_job_tagged_ip_dict_complex

__group_name__ = _("作业平台(JOB)")

Expand Down Expand Up @@ -119,7 +114,10 @@ def inputs_format(self):
schema=StringItemSchema(description=_("执行脚本的目标机器 IP,多个用英文逗号 `,` 分隔")),
),
self.InputItem(
name=_("目标账户"), key="job_account", type="string", schema=StringItemSchema(description=_("执行脚本的目标机器账户")),
name=_("目标账户"),
key="job_account",
type="string",
schema=StringItemSchema(description=_("执行脚本的目标机器账户")),
),
self.InputItem(
name=_("滚动执行"),
Expand Down Expand Up @@ -217,7 +215,7 @@ def execute(self, data, parent_data):
"bk_scope_id": str(biz_cc_id),
"bk_biz_id": biz_cc_id,
"timeout": data.get_one_of_inputs("job_script_timeout"),
"account_alias": data.get_one_of_inputs("job_account"),
"account_alias": data.get_one_of_inputs("job_account").strip(),
"target_server": target_server,
"callback_url": get_node_callback_url(self.root_pipeline_id, self.id, getattr(self, "version", "")),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ class BaseJobLocalContentUploadService(Service, GetJobTargetServerMixin):
def inputs_format(self):
return [
self.InputItem(
name=_("生成文件名[后缀]"), key="local_name", type="string", schema=StringItemSchema(description=_("生成文件名")),
name=_("生成文件名[后缀]"),
key="local_name",
type="string",
schema=StringItemSchema(description=_("生成文件名")),
),
self.InputItem(
name=_("文本内容"), key="local_content", type="string", schema=StringItemSchema(description=_("文本内容")),
name=_("文本内容"),
key="local_content",
type="string",
schema=StringItemSchema(description=_("文本内容")),
),
self.InputItem(
name=_("目标IP"),
Expand All @@ -59,7 +65,10 @@ def inputs_format(self):
schema=StringItemSchema(description=_("请输入在蓝鲸作业平台上注册的账户名")),
),
self.InputItem(
name=_("目标路径"), key="file_path", type="string", schema=StringItemSchema(description=_("目标路径")),
name=_("目标路径"),
key="file_path",
type="string",
schema=StringItemSchema(description=_("目标路径")),
),
self.InputItem(
name=_("是否允许跨业务"),
Expand Down Expand Up @@ -113,7 +122,7 @@ def get_job_kwargs(self, biz_cc_id, data, target_server):
"bk_scope_type": JobBizScopeType.BIZ.value,
"bk_scope_id": str(biz_cc_id),
"bk_biz_id": biz_cc_id,
"account_alias": data.get_one_of_inputs("file_account"),
"account_alias": data.get_one_of_inputs("file_account").strip(),
"file_target_path": data.get_one_of_inputs("file_path"),
"file_list": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
"""

from django.utils.translation import ugettext_lazy as _

from pipeline.component_framework.component import Component
from pipeline.core.flow.io import BooleanItemSchema, StringItemSchema

from gcloud.conf import settings
from pipeline_plugins.components.collections.sites.open.job.push_local_files.base_service import (
BaseJobPushLocalFilesService,
)
from gcloud.conf import settings

__group_name__ = _("作业平台(JOB)")

Expand Down Expand Up @@ -67,7 +66,7 @@ def get_params_list(self, client, data, target_server, local_files_and_target_pa
job_rolling_mode = job_rolling_config.get("job_rolling_mode")
rolling_config = {"expression": job_rolling_expression, "mode": job_rolling_mode}

target_account = data.inputs.job_target_account
target_account = data.inputs.job_target_account.strip()
params_list = [
{
"esb_client": client,
Expand Down
Loading