File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
abstract_security_content_objects Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -476,7 +476,7 @@ def serialize_model(self):
476
476
"name" : lookup .name ,
477
477
"description" : lookup .description ,
478
478
"filename" : lookup .filename .name ,
479
- "default_match" : "true" if lookup .default_match else "false" ,
479
+ "default_match" : lookup .default_match ,
480
480
"case_sensitive_match" : "true"
481
481
if lookup .case_sensitive_match
482
482
else "false" ,
Original file line number Diff line number Diff line change @@ -69,7 +69,10 @@ class Lookup_Type(StrEnum):
69
69
70
70
# TODO (#220): Split Lookup into 2 classes
71
71
class Lookup (SecurityContentObject , abc .ABC ):
72
- default_match : Optional [bool ] = None
72
+ default_match : str = Field (default = '' , description = "This field is given a default value of ''"
73
+ "because it is the default value specified in the transforms.conf "
74
+ "docs. Giving it a type of str rather than str | None simplifies "
75
+ "the typing for the field." )
73
76
# Per the documentation for transforms.conf, EXACT should not be specified in this list,
74
77
# so we include only WILDCARD and CIDR
75
78
match_type : list [Annotated [str , Field (pattern = r"(^WILDCARD|CIDR)\(.+\)$" )]] = Field (
@@ -88,7 +91,7 @@ def serialize_model(self):
88
91
89
92
# All fields custom to this model
90
93
model = {
91
- "default_match" : "true" if self .default_match is True else "false" ,
94
+ "default_match" : self .default_match ,
92
95
"match_type" : self .match_type_to_conf_format ,
93
96
"min_matches" : self .min_matches ,
94
97
"max_matches" : self .max_matches ,
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ filename = {{ lookup.app_filename.name }}
7
7
collection = {{ lookup.collection }}
8
8
external_type = kvstore
9
9
{% endif %}
10
- {% if lookup .default_match is defined and lookup . default_match != None %}
11
- default_match = {{ lookup.default_match | lower }}
10
+ {% if lookup .default_match != '' %}
11
+ default_match = {{ lookup.default_match }}
12
12
{% endif %}
13
13
{% if lookup .case_sensitive_match is defined and lookup .case_sensitive_match != None %}
14
14
case_sensitive_match = {{ lookup.case_sensitive_match | lower }}
You can’t perform that action at this time.
0 commit comments