4 from dha_adapters.libvirt_adapter import LibvirtAdapter
5 from dha_adapters.ipmi_adapter import IpmiAdapter
6 from dha_adapters.hp_adapter import HpAdapter
8 class DeploymentHardwareAdapter(object):
9 def __new__(cls, yaml_path):
10 with io.open(yaml_path) as yaml_file:
11 dha_struct = yaml.load(yaml_file)
12 type = dha_struct['adapter']
14 if cls is DeploymentHardwareAdapter:
15 if type == 'libvirt': return LibvirtAdapter(yaml_path)
16 if type == 'ipmi': return IpmiAdapter(yaml_path)
17 if type == 'hp': return HpAdapter(yaml_path)
19 return super(DeploymentHardwareAdapter, cls).__new__(cls)