7 from environments.libvirt_environment import LibvirtEnvironment
8 from environments.virtual_fuel import VirtualFuel
9 from dea import DeploymentEnvironmentAdapter
11 exec_cmd = common.exec_cmd
14 check_dir_exists = common.check_dir_exists
15 check_file_exists = common.check_file_exists
16 check_if_root = common.check_if_root
17 ArgParser = common.ArgParser
19 class ExecutionEnvironment(object):
20 def __new__(cls, storage_dir, pxe_bridge, dha_path, dea):
22 with io.open(dha_path) as yaml_file:
23 dha_struct = yaml.load(yaml_file)
25 type = dha_struct['adapter']
27 root_dir = os.path.dirname(os.path.realpath(__file__))
29 if cls is ExecutionEnvironment:
31 return LibvirtEnvironment(storage_dir, dha_path, dea, root_dir)
33 if type == 'ipmi' or type == 'hp':
34 return VirtualFuel(storage_dir, pxe_bridge, dha_path, root_dir)
36 return super(ExecutionEnvironment, cls).__new__(cls)