@@ -215,7 +215,7 @@ def delete_project(self):
215215 self ._admin_conn .network .delete_security_group (sg .id )
216216 ##########################################################################################
217217
218- def get_and_create_machines (self , machines : list [str ]):
218+ def get_and_create_machines (self , machines : list [str ], wait_for_machines : bool ):
219219 if "none" in machines :
220220 LOGGER .warning ("Not creating a virtual machine, because 'none' was in the list" )
221221 self .close_connection ()
@@ -231,7 +231,7 @@ def get_and_create_machines(self, machines: list[str]):
231231 if self .workload_network is None or self .workload_network .obj_network is None :
232232 raise RuntimeError ("No Workload network object" )
233233
234- machine .create_or_get_server (self .workload_network .obj_network )
234+ machine .create_or_get_server (self .workload_network .obj_network , wait_for_machines )
235235
236236 if machine .floating_ip :
237237 self .ssh_proxy_jump = machine .floating_ip
@@ -251,21 +251,28 @@ def dump_inventory_hosts(self, directory_location: str):
251251 raise RuntimeError (f"Invalid reference to server for { workload_machine .machine_name } " )
252252
253253 workload_machine .update_assigned_ips ()
254- data = {
255- "id" : workload_machine .obj .id ,
256- "status" : workload_machine .obj .status ,
257- "hypervisor" : workload_machine .obj ['OS-EXT-SRV-ATTR:hypervisor_hostname' ],
254+
255+ if not workload_machine .internal_ip :
256+ raise RuntimeError (f"Unable to get associated ip address for { workload_machine .machine_name } " )
257+
258+ data : dict [str , str | dict [str , str ]] = {
259+ "openstack" : {
260+ "machine_id" : workload_machine .obj .id ,
261+ "machine_status" : workload_machine .obj .status ,
262+ "hypervisor" : workload_machine .obj ['OS-EXT-SRV-ATTR:hypervisor_hostname' ],
263+ "domain" : self .domain .name ,
264+ "project" : workload_machine .project .name ,
265+ },
258266 "hostname" : workload_machine .machine_name ,
259- "project" : workload_machine .project .name ,
260- "domain" : self .domain .name ,
261267 "ansible_host" : workload_machine .floating_ip or workload_machine .internal_ip ,
262268 "internal_ip" : workload_machine .internal_ip ,
263269 }
264270
265271 if self .ssh_proxy_jump and not workload_machine .floating_ip :
266272 data ["ansible_ssh_common_args" ] = f"-o ProxyJump={ self .ssh_proxy_jump } "
267273
268- base_dir = f"{ directory_location } /{ data ['domain' ]} -{ data ['project' ]} -{ data ['hostname' ]} "
274+ base_dir = f"{ directory_location } /{ self .domain .name } -{ workload_machine .project .name } -{ workload_machine .machine_name } "
275+
269276 filename = f'{ base_dir } /data.yml'
270277 os .makedirs (base_dir , exist_ok = True )
271278 with open (filename , 'w' ) as file :
0 commit comments