@@ -172,16 +172,18 @@ def establish_connection():
172172
173173 for workload_domain in workload_domains .values ():
174174 for workload_project in workload_domain .get_projects (args .create_projects ):
175+ if args .generate_clouds_yaml :
176+ clouds_yaml_data [
177+ f"{ workload_domain .domain_name } -{ workload_project .project_name } "
178+ ] = workload_project .get_clouds_yaml_data ()
179+
175180 if args .create_machines :
176181 workload_project .get_and_create_machines (
177182 args .create_machines , args .wait_for_machines
178183 )
179184 if args .ansible_inventory :
180185 workload_project .dump_inventory_hosts (args .ansible_inventory )
181- if args .generate_clouds_yaml :
182- clouds_yaml_data [
183- f"{ workload_domain .domain_name } -{ workload_project .project_name } "
184- ] = workload_project .get_clouds_yaml_data ()
186+
185187 elif args .delete_machines :
186188 for machine_obj in workload_project .get_machines (
187189 args .delete_machines
@@ -192,9 +194,15 @@ def establish_connection():
192194 LOGGER .info (f"Creating a clouds yaml : { args .generate_clouds_yaml } " )
193195 clouds_yaml_data_new = {"clouds" : clouds_yaml_data }
194196
197+ initial_entries = 0
198+ generated_entries = 0
199+ total_entries = 0
200+
195201 if os .path .exists (args .generate_clouds_yaml ):
196202 with open (args .generate_clouds_yaml , "r" ) as file :
197203 existing_data = yaml .safe_load (file )
204+
205+ initial_entries = len (existing_data .get ("clouds" , []))
198206 backup_file = f"{ args .generate_clouds_yaml } _{ iso_timestamp ()} "
199207 logging .warning (
200208 f"File { args .generate_clouds_yaml } , making an backup to { backup_file } and adding the new values"
@@ -203,9 +211,12 @@ def establish_connection():
203211 args .generate_clouds_yaml ,
204212 f"{ args .generate_clouds_yaml } _{ iso_timestamp ()} " ,
205213 )
214+
215+ generated_entries = len (clouds_yaml_data_new .get ("clouds" , []))
206216 clouds_yaml_data_new = deep_merge_dict (
207217 existing_data , clouds_yaml_data_new
208218 )
219+ total_entries = len (clouds_yaml_data_new .get ("clouds" , []))
209220
210221 with open (args .generate_clouds_yaml , "w" ) as file :
211222 yaml .dump (
@@ -214,6 +225,8 @@ def establish_connection():
214225 default_flow_style = False ,
215226 explicit_start = True ,
216227 )
228+ LOGGER .info (f"Generated { generated_entries } entries, number of entries in "
229+ f"{ args .generate_clouds_yaml } is now { total_entries } (old { initial_entries } entries)" )
217230 sys .exit (0 )
218231 elif args .delete_projects :
219232 conn = establish_connection ()
0 commit comments