Skip to content

Commit f2caab0

Browse files
committed
Merge branch 'add_drilldown_support' of https://github.com/splunk/contentctl into add_drilldown_support
2 parents fca535b + a4f4222 commit f2caab0

File tree

8 files changed

+127
-159
lines changed

8 files changed

+127
-159
lines changed

contentctl/actions/detection_testing/infrastructures/DetectionTestingInfrastructure.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from shutil import copyfile
1414
from typing import Union, Optional
1515

16-
from pydantic import BaseModel, PrivateAttr, Field, dataclasses
16+
from pydantic import ConfigDict, BaseModel, PrivateAttr, Field, dataclasses
1717
import requests # type: ignore
1818
import splunklib.client as client # type: ignore
1919
from splunklib.binding import HTTPError # type: ignore
@@ -48,9 +48,9 @@ class SetupTestGroupResults(BaseModel):
4848
success: bool = True
4949
duration: float = 0
5050
start_time: float
51-
52-
class Config:
53-
arbitrary_types_allowed = True
51+
model_config = ConfigDict(
52+
arbitrary_types_allowed=True
53+
)
5454

5555

5656
class CleanupTestGroupResults(BaseModel):
@@ -91,9 +91,9 @@ class DetectionTestingInfrastructure(BaseModel, abc.ABC):
9191
_conn: client.Service = PrivateAttr()
9292
pbar: tqdm.tqdm = None
9393
start_time: Optional[float] = None
94-
95-
class Config:
96-
arbitrary_types_allowed = True
94+
model_config = ConfigDict(
95+
arbitrary_types_allowed=True
96+
)
9797

9898
def __init__(self, **data):
9999
super().__init__(**data)

contentctl/actions/detection_testing/views/DetectionTestingViewWeb.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
from bottle import template, Bottle, ServerAdapter
2-
from contentctl.actions.detection_testing.views.DetectionTestingView import (
3-
DetectionTestingView,
4-
)
1+
from threading import Thread
52

3+
from bottle import template, Bottle, ServerAdapter
64
from wsgiref.simple_server import make_server, WSGIRequestHandler
75
import jinja2
86
import webbrowser
9-
from threading import Thread
7+
from pydantic import ConfigDict
8+
9+
from contentctl.actions.detection_testing.views.DetectionTestingView import (
10+
DetectionTestingView,
11+
)
1012

1113
DEFAULT_WEB_UI_PORT = 7999
1214

@@ -100,9 +102,9 @@ def log_exception(*args, **kwargs):
100102
class DetectionTestingViewWeb(DetectionTestingView):
101103
bottleApp: Bottle = Bottle()
102104
server: SimpleWebServer = SimpleWebServer(host="0.0.0.0", port=DEFAULT_WEB_UI_PORT)
103-
104-
class Config:
105-
arbitrary_types_allowed = True
105+
model_config = ConfigDict(
106+
arbitrary_types_allowed=True
107+
)
106108

107109
def setup(self):
108110
self.bottleApp.route("/", callback=self.showStatus)

contentctl/enrichments/cve_enrichment.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import shelve
66
import time
77
from typing import Annotated, Any, Union, TYPE_CHECKING
8-
from pydantic import BaseModel,Field, computed_field
8+
from pydantic import ConfigDict, BaseModel,Field, computed_field
99
from decimal import Decimal
1010
from requests.exceptions import ReadTimeout
1111
from contentctl.objects.annotated_types import CVE_TYPE
@@ -32,13 +32,12 @@ def url(self)->str:
3232
class CveEnrichment(BaseModel):
3333
use_enrichment: bool = True
3434
cve_api_obj: Union[CVESearch,None] = None
35-
3635

37-
class Config:
38-
# Arbitrary_types are allowed to let us use the CVESearch Object
39-
arbitrary_types_allowed = True
40-
frozen = True
41-
36+
# Arbitrary_types are allowed to let us use the CVESearch Object
37+
model_config = ConfigDict(
38+
arbitrary_types_allowed=True,
39+
frozen=True
40+
)
4241

4342
@staticmethod
4443
def getCveEnrichment(config:validate, timeout_seconds:int=10, force_disable_enrichment:bool=True)->CveEnrichment:

contentctl/objects/base_test_result.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from typing import Union, Any
22
from enum import Enum
33

4-
from pydantic import BaseModel
5-
from splunklib.data import Record
4+
from pydantic import ConfigDict, BaseModel
5+
from splunklib.data import Record # type: ignore
66

77
from contentctl.helper.utils import Utils
88

@@ -53,11 +53,11 @@ class BaseTestResult(BaseModel):
5353
# The Splunk endpoint URL
5454
sid_link: Union[None, str] = None
5555

56-
class Config:
57-
validate_assignment = True
58-
59-
# Needed to allow for embedding of Exceptions in the model
60-
arbitrary_types_allowed = True
56+
# Needed to allow for embedding of Exceptions in the model
57+
model_config = ConfigDict(
58+
validate_assignment=True,
59+
arbitrary_types_allowed=True
60+
)
6161

6262
@property
6363
def passed(self) -> bool:

0 commit comments

Comments
 (0)