@@ -38,10 +38,8 @@ def execute(self, input_dto: validate) -> DirectorOutputDto:
38
38
director .execute (input_dto )
39
39
self .ensure_no_orphaned_files_in_lookups (input_dto .path , director_output_dto )
40
40
if input_dto .data_source_TA_validation :
41
- if self .validate_latest_TA_information (director_output_dto .data_sources ) != 1 :
42
- print ("All TA versions are up to date." )
43
- else :
44
- raise Exception ("One or more TA versions are out of date. Please update the data source with the latest version." )
41
+ self .validate_latest_TA_information (director_output_dto .data_sources )
42
+
45
43
return director_output_dto
46
44
47
45
@@ -83,9 +81,9 @@ def ensure_no_orphaned_files_in_lookups(self, repo_path:pathlib.Path, director_o
83
81
return
84
82
85
83
86
- def validate_latest_TA_information (self , data_sources : list [DataSource ]) -> int :
84
+ def validate_latest_TA_information (self , data_sources : list [DataSource ]) -> None :
87
85
validated_TAs : list [tuple [str , str ]] = []
88
- error_occurred = False
86
+ errors : list [ str ] = []
89
87
print ("----------------------" )
90
88
print ("Validating latest TA:" )
91
89
print ("----------------------" )
@@ -100,10 +98,18 @@ def validate_latest_TA_information(self, data_sources: list[DataSource]) -> int:
100
98
try :
101
99
splunk_app = SplunkApp (app_uid = uid )
102
100
if splunk_app .latest_version != supported_TA .version :
103
- raise Exception (f"Version mismatch for TA { supported_TA .name } : "
104
- f" Latest version on Splunkbase is { splunk_app .latest_version } , "
105
- f"but version { supported_TA . version } is specified in the data source { data_source . name } . " )
101
+ errors . append (f"Version mismatch in ' { data_source . file_path } ' supported TA ' { supported_TA .name } ' "
102
+ f" \n Latest version on Splunkbase : { splunk_app .latest_version } "
103
+ f" \n Version specified in data source: { supported_TA . version } " )
106
104
except Exception as e :
107
- print (f"Error processing TA { supported_TA .version } : { str (e )} " )
108
- error_occurred = True
109
- return 1 if error_occurred else 0
105
+ errors .append (f"Error processing checking version of TA { supported_TA .name } : { str (e )} " )
106
+
107
+ if len (errors ) > 0 :
108
+ errorString = '\n \n ' .join (errors )
109
+ raise Exception (f"[{ len (errors )} ] or more TA versions are out of date or have other errors."
110
+ f"Please update the following data sources with the latest versions of "
111
+ f"their supported tas:\n \n { errorString } " )
112
+ print ("All TA versions are up to date." )
113
+
114
+
115
+
0 commit comments