|
1 | 1 |
|
2 | 2 | import pathlib
|
| 3 | + |
| 4 | +import urllib3.util |
3 | 5 | from contentctl.input.director import Director, DirectorOutputDto
|
4 | 6 | from contentctl.objects.config import validate
|
5 | 7 | from contentctl.enrichments.attack_enrichment import AttackEnrichment
|
@@ -89,19 +91,19 @@ def validate_latest_TA_information(self, data_sources: list[DataSource]) -> int:
|
89 | 91 | print("----------------------")
|
90 | 92 | for data_source in data_sources:
|
91 | 93 | for supported_TA in data_source.supported_TA:
|
92 |
| - ta_identifier = (supported_TA["name"], supported_TA["version"]) |
| 94 | + ta_identifier = (supported_TA.name, supported_TA.version) |
93 | 95 | if ta_identifier in validated_TAs:
|
94 | 96 | continue
|
95 |
| - if "url" in supported_TA: |
| 97 | + if supported_TA.url is not None: |
96 | 98 | validated_TAs.append(ta_identifier)
|
97 |
| - uid = int(supported_TA["url"].rstrip('/').split("/")[-1]) |
| 99 | + uid = int(str(supported_TA.url).rstrip('/').split("/")[-1]) |
98 | 100 | try:
|
99 | 101 | splunk_app = SplunkApp(app_uid=uid)
|
100 |
| - if splunk_app.latest_version != supported_TA["version"]: |
101 |
| - raise Exception(f"Version mismatch for TA {supported_TA['name']}: " |
| 102 | + if splunk_app.latest_version != supported_TA.version: |
| 103 | + raise Exception(f"Version mismatch for TA {supported_TA.name}: " |
102 | 104 | f"Latest version on Splunkbase is {splunk_app.latest_version}, "
|
103 |
| - f"but version {supported_TA['version']} is specified in the data source {data_source.name}.") |
| 105 | + f"but version {supported_TA.version} is specified in the data source {data_source.name}.") |
104 | 106 | except Exception as e:
|
105 |
| - print(f"Error processing TA {supported_TA['name']}: {str(e)}") |
| 107 | + print(f"Error processing TA {supported_TA.version}: {str(e)}") |
106 | 108 | error_occurred = True
|
107 | 109 | return 1 if error_occurred else 0
|
0 commit comments