summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorMofassir <Mofassir_arif@Dellteam.com>2016-01-06 04:03:57 -0800
committerMofassir <Mofassir_arif@Dellteam.com>2016-01-06 04:05:24 -0800
commit61159e1e4f028dbb34573f2186d448be578894ee (patch)
tree5d9dc9ff46974f9e86c9a69bd2a37e4561fe7d63 /func
parentcb47406502e3ab9029530e82cacc2f9f012d5bd3 (diff)
started work on the dashboard API
Change-Id: Ifbb16f20ff8a0821b790c0c44a1eae82875f9051 Signed-off-by: Mofassir <Mofassir_arif@Dellteam.com>
Diffstat (limited to 'func')
-rw-r--r--func/spawn_vm.py30
1 files changed, 26 insertions, 4 deletions
diff --git a/func/spawn_vm.py b/func/spawn_vm.py
index 39587b34..4723e999 100644
--- a/func/spawn_vm.py
+++ b/func/spawn_vm.py
@@ -23,6 +23,7 @@ from func.create_zones import create_zones
class SpawnVM(Env_setup):
vm_role_ip_dict = defaultdict(list)
+ installer = ''
def __init__(self, vm_info):
print 'SpawnVM Class initiated'
@@ -35,10 +36,28 @@ class SpawnVM(Env_setup):
nova =self. _get_nova_client()
azoneobj = create_zones()
azoneobj.create_agg(vm_info['availability_zone'])
- self.Heat_template1 = self.HeatTemplate_vm(vm_info)
+ installer= self.get_installer_type()
+ self.Heat_template1 = self.HeatTemplate_vm(vm_info,installer)
self.create_stack(vm_role_ip_dict, self.Heat_template1)
- def HeatTemplate_vm(self, vm_params):
+ def get_installer_type(self):
+ print 'Getting Installer Name'
+ return os.environ['INSTALLER_TYPE']
+
+ def get_public_network(self,installer_detected):
+
+ '''
+ TODO: GET THE NAMES OF THE PUBLIC NETWORKS for OTHER PROJECTS
+ '''
+ print 'Getting Public Network'
+ if installer_detected.lower() == 'fuel':
+ return 'net04_ext'
+ if installer_detected.lower() == 'apex':
+ return 'net04_ext'
+ if installer_detected.lower() == 'compass':
+ return 'net04_ext'
+
+ def HeatTemplate_vm(self, vm_params, installer):
try:
Heat_Dic=''
with open('./heat/SampleHeat.yaml', 'r+') as H_temp:
@@ -54,7 +73,9 @@ class SpawnVM(Env_setup):
fopenstr = fopenstr.rstrip()
scriptcmd = '#!/bin/bash \n echo {0} >> foo.txt \n echo {1} >> /root/.ssh/authorized_keys'.format(
fopenstr, fopenstr)
-
+
+ netName = self.get_public_network(installer)
+ print netName
Heat_Dic['heat_template_version'] = '2014-10-16'
Heat_Dic['resources']['KeyPairSavePrivate'] = {
'type': 'OS::Nova::KeyPair',
@@ -65,7 +86,8 @@ class SpawnVM(Env_setup):
}
Heat_Dic['parameters']['public_network'] = {
'type': 'string',
- 'default': vm_params['public_network'][0]
+ #'default': vm_params['public_network'][0]
+ 'default': netName
}
for x in range(1, len(vm_params['availability_zone']) + 1):
avail_zone = vm_params['availability_zone'][x - 1]