1 ###############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 # szilard.cserey@ericsson.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ###############################################################################
15 from environments.libvirt_environment import LibvirtEnvironment
16 from environments.virtual_fuel import VirtualFuel
19 class ExecutionEnvironment(object):
21 def __new__(cls, storage_dir, pxe_bridge, dha_path, dea):
23 with io.open(dha_path) as yaml_file:
24 dha_struct = yaml.load(yaml_file)
26 type = dha_struct['adapter']
28 root_dir = os.path.dirname(os.path.realpath(__file__))
30 if cls is ExecutionEnvironment:
32 return LibvirtEnvironment(storage_dir, dha_path, dea, root_dir)
34 if type in ['ipmi', 'hp', 'amt']:
35 return VirtualFuel(storage_dir, pxe_bridge, dha_path, root_dir)
37 return super(ExecutionEnvironment, cls).__new__(cls)