Skip to content

Commit

Permalink
feat(backend): 更新依赖包 #6854
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 committed Sep 11, 2024
1 parent 2ef6120 commit 7407744
Show file tree
Hide file tree
Showing 210 changed files with 1,063 additions and 849 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python_code_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8==5.0.4 black=="22.3.0"
pip install flake8==7.1.1 black=="22.3.0"
- name: Lint with flake8
run: |
FLAKE8_RESULT=$(flake8 dbm-ui/backend --config=dbm-ui/backend/.flake8 || true)
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
args: [--config=./dbm-ui/pyproject.toml]
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 7.1.1
hooks:
- id: flake8
args: [--config=./dbm-ui/backend/.flake8]
Expand Down
2 changes: 2 additions & 0 deletions dbm-ui/backend/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ exclude =
per-file-ignores =
*/__init__.py: F401,F403,F405
nginx_template.py: W605
dbm-ui/backend/db_services/mysql/remote_service/handlers.py: W605
dbm-ui/backend/flow/plugins/components/collections/mysql/filter_database_table_by_flashback_input.py: W605
max-line-length=129
max-complexity=21
format=pylint
Expand Down
8 changes: 5 additions & 3 deletions dbm-ui/backend/components/bklog/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ def __init__(self):
)
self.fast_update = self.generate_data_api(
method="POST",
url="databus/collectors/{collector_config_id}/fast_update/"
if is_esb
else "/databus_collectors/{collector_config_id}/fast_update/",
url=(
"databus/collectors/{collector_config_id}/fast_update/"
if is_esb
else "/databus_collectors/{collector_config_id}/fast_update/"
),
description=_("简易更新采集配置"),
)
self.pre_check = self.generate_data_api(
Expand Down
5 changes: 4 additions & 1 deletion dbm-ui/backend/components/cc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ def __init__(self):
description=_("查询业务下的主机和拓扑信息"),
)
self.get_biz_internal_module = self.generate_data_api(
method="GET", url="get_biz_internal_module/", description=_("查询业务的空闲机/故障机/待回收模块"), cache_time=60 * 60
method="GET",
url="get_biz_internal_module/",
description=_("查询业务的空闲机/故障机/待回收模块"),
cache_time=60 * 60,
)
self.find_host_topo_relation = self.generate_data_api(
method="POST",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class Migration(migrations.Migration):
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("name", models.CharField(max_length=255, verbose_name="功能名称")),
("is_enabled", models.BooleanField(default=False, verbose_name="是否开启")),
("is_frozen", models.BooleanField(default=False, help_text="人工冻结此开关,将不受更新影响", verbose_name="是否冻结")),
(
"is_frozen",
models.BooleanField(default=False, help_text="人工冻结此开关,将不受更新影响", verbose_name="是否冻结"),
),
("parent_name", models.CharField(blank=True, max_length=255, null=True, verbose_name="父功能名称")),
],
options={
Expand Down
15 changes: 12 additions & 3 deletions dbm-ui/backend/configuration/migrations/0008_auto_20231121_2147.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,28 @@ class Migration(migrations.Migration):
),
migrations.AlterModelOptions(
name="dbadministrator",
options={"verbose_name": "DBA人员设置(DBAdministrator)", "verbose_name_plural": "DBA人员设置(DBAdministrator)"},
options={
"verbose_name": "DBA人员设置(DBAdministrator)",
"verbose_name_plural": "DBA人员设置(DBAdministrator)",
},
),
migrations.AlterModelOptions(
name="functioncontroller",
options={"verbose_name": "功能控制器(FunctionController)", "verbose_name_plural": "功能控制器(FunctionController)"},
options={
"verbose_name": "功能控制器(FunctionController)",
"verbose_name_plural": "功能控制器(FunctionController)",
},
),
migrations.AlterModelOptions(
name="ipwhitelist",
options={"verbose_name": "IP白名单(IPWhitelist)", "verbose_name_plural": "IP白名单(IPWhitelist)"},
),
migrations.AlterModelOptions(
name="passwordpolicy",
options={"verbose_name": "密码安全策略(PasswordPolicy)", "verbose_name_plural": "密码安全策略(PasswordPolicy)"},
options={
"verbose_name": "密码安全策略(PasswordPolicy)",
"verbose_name_plural": "密码安全策略(PasswordPolicy)",
},
),
migrations.AlterModelOptions(
name="profile",
Expand Down
4 changes: 3 additions & 1 deletion dbm-ui/backend/configuration/views/password_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def get_random_password(self, request, *args, **kwargs):
return Response({"password": random_password})

@common_swagger_auto_schema(
operation_summary=_("更新密码随机化周期"), request_body=ModifyMySQLPasswordRandomCycleSerializer(), tags=[SWAGGER_TAG]
operation_summary=_("更新密码随机化周期"),
request_body=ModifyMySQLPasswordRandomCycleSerializer(),
tags=[SWAGGER_TAG],
)
@action(methods=["POST"], detail=False, serializer_class=ModifyMySQLPasswordRandomCycleSerializer)
def modify_random_cycle(self, request, *args, **kwargs):
Expand Down
4 changes: 3 additions & 1 deletion dbm-ui/backend/core/encrypt/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class Migration(migrations.Migration):
(
"type",
models.CharField(
choices=[("PRIVATE_KEY", "私钥"), ("PUBLIC_KEY", "公钥")], max_length=64, verbose_name="密钥类型"
choices=[("PRIVATE_KEY", "私钥"), ("PUBLIC_KEY", "公钥")],
max_length=64,
verbose_name="密钥类型",
),
),
(
Expand Down
1 change: 1 addition & 0 deletions dbm-ui/backend/db_meta/api/cluster/sqlserverha/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

from .create_cluster import create, create_pre_check
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

import logging
from typing import List, Optional

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

from .create_cluster import create, create_pre_check
from .decommission import decommission
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

import logging

from django.db import transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

from django.db import transaction

from backend.db_meta import api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

from .add_spider import add_spiders
from .add_spider_mnt import add_spider_mnt
from .create_cluster import create, create_pre_check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

from typing import List, Optional

from django.db import transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

import logging
from typing import List, Optional

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

import logging
from typing import List, Optional

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

import logging

from django.db import transaction
Expand Down
1 change: 1 addition & 0 deletions dbm-ui/backend/db_meta/api/cluster/tendbcluster/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

from typing import List, Optional

from django.db import transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
specific language governing permissions and limitations under the License.
"""


import logging

from django.core.exceptions import ObjectDoesNotExist
Expand Down
5 changes: 4 additions & 1 deletion dbm-ui/backend/db_meta/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ class Migration(migrations.Migration):
("updater", models.CharField(max_length=64, verbose_name="修改人")),
("update_at", models.DateTimeField(auto_now=True, verbose_name="更新时间")),
("bk_idc_city_id", models.IntegerField(default=0, primary_key=True, serialize=False)),
("bk_idc_city_name", models.CharField(default="", help_text="IDC 城市名", max_length=128, unique=True)),
(
"bk_idc_city_name",
models.CharField(default="", help_text="IDC 城市名", max_length=128, unique=True),
),
],
options={
"abstract": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class Migration(migrations.Migration):
(
"machine",
models.ForeignKey(
help_text="关联的machine信息", on_delete=django.db.models.deletion.PROTECT, to="db_meta.machine"
help_text="关联的machine信息",
on_delete=django.db.models.deletion.PROTECT,
to="db_meta.machine",
),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ class Migration(migrations.Migration):
model_name="extraprocessinstance",
name="phase",
field=models.CharField(
choices=[("online", "正常"), ("offline", "禁用"), ("destroy", "销毁"), ("trans_stage", "scr/gcs迁移中")],
choices=[
("online", "正常"),
("offline", "禁用"),
("destroy", "销毁"),
("trans_stage", "scr/gcs迁移中"),
],
default="online",
max_length=64,
),
Expand Down
15 changes: 12 additions & 3 deletions dbm-ui/backend/db_meta/migrations/0030_auto_20231229_0933.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterModelOptions(
name="appcache",
options={"verbose_name": "CMDB业务信息缓存表(AppCache)", "verbose_name_plural": "CMDB业务信息缓存表(AppCache)"},
options={
"verbose_name": "CMDB业务信息缓存表(AppCache)",
"verbose_name_plural": "CMDB业务信息缓存表(AppCache)",
},
),
migrations.AlterModelOptions(
name="appmonitortopo",
options={"verbose_name": "业务监控拓扑(AppMonitorTopo)", "verbose_name_plural": "业务监控拓扑(AppMonitorTopo)"},
options={
"verbose_name": "业务监控拓扑(AppMonitorTopo)",
"verbose_name_plural": "业务监控拓扑(AppMonitorTopo)",
},
),
migrations.AlterModelOptions(
name="bkcity",
Expand All @@ -28,7 +34,10 @@ class Migration(migrations.Migration):
),
migrations.AlterModelOptions(
name="clusterentry",
options={"verbose_name": "集群访问入口(ClusterEntry)", "verbose_name_plural": "集群访问入口(ClusterEntry)"},
options={
"verbose_name": "集群访问入口(ClusterEntry)",
"verbose_name_plural": "集群访问入口(ClusterEntry)",
},
),
migrations.AlterModelOptions(
name="clustermonitortopo",
Expand Down
6 changes: 3 additions & 3 deletions dbm-ui/backend/db_meta/models/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def compress_dbm_meta_content(dbm_meta: dict) -> str:
cluster_domain=cluster.immute_domain,
db_type=ClusterType.cluster_type_to_db_type(cluster.cluster_type),
# tendbcluster中扩展了proxy的类型,需要特殊处理
instance_role=tendb_cluster_spider_ext.spider_role
if tendb_cluster_spider_ext
else "proxy",
instance_role=(
tendb_cluster_spider_ext.spider_role if tendb_cluster_spider_ext else "proxy"
),
instance_port=str(proxy.port),
)
)
Expand Down
1 change: 1 addition & 0 deletions dbm-ui/backend/db_meta/models/proxy_instance_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

from django.db import models

from backend.bk_web.models import AuditedModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ class Migration(migrations.Migration):
verbose_name="策略状态",
),
),
("dispatch_group_id", models.BigIntegerField(default=0, verbose_name="分派策略组ID,0代表没有对应的策略")),
(
"dispatch_group_id",
models.BigIntegerField(default=0, verbose_name="分派策略组ID,0代表没有对应的策略"),
),
("monitor_policy_id", models.BigIntegerField(default=0, verbose_name="蓝鲸监控策略ID")),
],
options={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ class Migration(migrations.Migration):
model_name="monitorpolicy",
name="target_level",
field=models.CharField(
choices=TargetLevel.get_choices(), default="app_id", max_length=64, verbose_name="监控目标级别,跟随targets调整"
choices=TargetLevel.get_choices(),
default="app_id",
max_length=64,
verbose_name="监控目标级别,跟随targets调整",
),
),
]
8 changes: 5 additions & 3 deletions dbm-ui/backend/db_monitor/models/alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,11 @@ def save(self, *args, **kwargs):
params = {
"name": f"{self.db_type}_{self.name}",
"bk_biz_id": env.DBA_APP_BK_BIZ_ID,
"effective_time": self.effective_time
if isinstance(self.effective_time, str)
else self.effective_time.strftime("%Y-%m-%d %H:%M:%S"),
"effective_time": (
self.effective_time
if isinstance(self.effective_time, str)
else self.effective_time.strftime("%Y-%m-%d %H:%M:%S")
),
"end_time": self.end_time.strftime("%Y-%m-%d %H:%M:%S") if self.end_time else "",
"labels": [self.db_type],
"enabled": self.is_enabled,
Expand Down
1 change: 1 addition & 0 deletions dbm-ui/backend/db_monitor/models/dataclass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

from dataclasses import dataclass, field
from typing import List

Expand Down
1 change: 1 addition & 0 deletions dbm-ui/backend/db_monitor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

import logging
import re

Expand Down
4 changes: 3 additions & 1 deletion dbm-ui/backend/db_monitor/views/duty_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
@method_decorator(
name="partial_update",
decorator=common_swagger_auto_schema(
operation_summary=_("部分更新轮值规则"), tags=[SWAGGER_TAG], request_body=serializers.DutyRuleUpdateSerializer()
operation_summary=_("部分更新轮值规则"),
tags=[SWAGGER_TAG],
request_body=serializers.DutyRuleUpdateSerializer(),
),
)
@method_decorator(
Expand Down
8 changes: 6 additions & 2 deletions dbm-ui/backend/db_monitor/views/notice_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
@method_decorator(
name="create",
decorator=common_swagger_auto_schema(
operation_summary=_("新建监控告警组"), tags=[SWAGGER_TAG], request_body=serializers.NoticeGroupCreateSerializer()
operation_summary=_("新建监控告警组"),
tags=[SWAGGER_TAG],
request_body=serializers.NoticeGroupCreateSerializer(),
),
)
@method_decorator(
Expand All @@ -49,7 +51,9 @@
@method_decorator(
name="update",
decorator=common_swagger_auto_schema(
operation_summary=_("更新监控告警组"), tags=[SWAGGER_TAG], request_body=serializers.NoticeGroupUpdateSerializer()
operation_summary=_("更新监控告警组"),
tags=[SWAGGER_TAG],
request_body=serializers.NoticeGroupUpdateSerializer(),
),
)
@method_decorator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""

from .task import check_expired_job_users_for_mysql, check_expired_job_users_for_sqlserver
Loading

0 comments on commit 7407744

Please sign in to comment.