diff --git a/sdcm/kafka/kafka_config.py b/sdcm/kafka/kafka_config.py index 7d0a65896b..fb17d3f922 100644 --- a/sdcm/kafka/kafka_config.py +++ b/sdcm/kafka/kafka_config.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import Field, BaseModel, Extra # pylint: disable=no-name-in-module +from pydantic import Field, BaseModel, ConfigDict # pylint: disable=no-name-in-module # pylint: disable=too-few-public-methods @@ -25,8 +25,7 @@ class ConnectorConfiguration(BaseModel): scylladb_username: Optional[str] = Field(alias="scylladb.username") scylladb_password: Optional[str] = Field(alias="scylladb.password") - class Config: - extra = Extra.allow + model_config = ConfigDict(arbitrary_types_allowed=True) class SctKafkaConfiguration(BaseModel): diff --git a/sdcm/mgmt/common.py b/sdcm/mgmt/common.py index 6cf48824e2..77c7ca3163 100644 --- a/sdcm/mgmt/common.py +++ b/sdcm/mgmt/common.py @@ -5,7 +5,7 @@ from typing import Optional from pathlib import Path -from pydantic import BaseModel, Extra +from pydantic import BaseModel, ConfigDict from sdcm.utils.distro import Distro from sdcm.utils.common import get_sct_root_path @@ -179,5 +179,4 @@ class AgentBackupParameters(BaseModel): transfers: Optional[int] = 2 low_level_retries: Optional[int] = 20 - class Config: - extra = Extra.forbid + model_config = ConfigDict(arbitrary_types_allowed=False) diff --git a/sdcm/provision/common/builders.py b/sdcm/provision/common/builders.py index 200baa936c..334a785372 100644 --- a/sdcm/provision/common/builders.py +++ b/sdcm/provision/common/builders.py @@ -13,13 +13,16 @@ from typing import Union -from pydantic import BaseModel # pylint: disable=no-name-in-module +from pydantic import BaseModel, ConfigDict # pylint: disable=no-name-in-module OptionalType = type(Union[str, None]) class AttrBuilder(BaseModel): + + model_config = ConfigDict(arbitrary_types_allowed=True) + @classmethod def get_properties(cls): return [prop for prop in dir(cls) if isinstance(getattr(cls, prop), property) and prop[0] != '_'] diff --git a/sdcm/provision/scylla_yaml/scylla_yaml.py b/sdcm/provision/scylla_yaml/scylla_yaml.py index d476e96073..94b19d315e 100644 --- a/sdcm/provision/scylla_yaml/scylla_yaml.py +++ b/sdcm/provision/scylla_yaml/scylla_yaml.py @@ -15,7 +15,7 @@ import logging import yaml -from pydantic import validator, BaseModel, Extra # pylint: disable=no-name-in-module +from pydantic import validator, BaseModel, ConfigDict # pylint: disable=no-name-in-module from sdcm.provision.scylla_yaml.auxiliaries import RequestSchedulerOptions, EndPointSnitchType, SeedProvider, \ ServerEncryptionOptions, ClientEncryptionOptions @@ -26,8 +26,7 @@ class ScyllaYaml(BaseModel): # pylint: disable=too-few-public-methods,too-many-instance-attributes - class Config: # pylint: disable=too-few-public-methods - extra = Extra.allow + model_config = ConfigDict(arbitrary_types_allowed=True) broadcast_address: str = None # "" api_port: int = None # 10000