Commit 64511f5b authored by Spiros Koulouzis's avatar Spiros Koulouzis

change env from list to map

parent f697af80
version: '3'
services: services:
server: AlertChecker:
image: salmant/ul_monitoring_server_container_image2 container_name: alerter_AlertChecker
ports: environment: ['TOSCA=http://i213.cscloud.cf.ac.uk:7001/api/switchapps/258/tosca',
- "8080:8080" MONITORING_PROXY=Monitoring Proxy]
- "4242:4242" image: beia/alerter
- "4245:4245" Graphite:
- "7199:7199" container_name: graphite_Graphite
- "7000:7000" environment: [Environment=SET_ITS_VALUE, Environment=SET_ITS_VALUE, Environment=SET_ITS_VALUE,
- "7001:7001" TOSCA=SET_ITS_VALUE, TOSCA=SET_ITS_VALUE, TOSCA=SET_ITS_VALUE, MONITORING_PROXY=SET_ITS_VALUE,
- "9160:9160" MONITORING_PROXY=SET_ITS_VALUE, MONITORING_PROXY=SET_ITS_VALUE]
- "9042:9042" image: vladwing/graphite
- "8012:8012" SIPNotifier:
- "61621:61621" container_name: sip_notifier_SIPNotifier
environment: environment: ['TOSCA=http://i213.cscloud.cf.ac.uk:7001/api/switchapps/258/tosca',
- "MONITORING_SERVER=server" MONITORING_PROXY=Monitoring Proxy]
image: beia/sip_notifier
agent: version: '2'
image: salmant/monitoring_agent \ No newline at end of file
deploy: {replicas: 10}
depends_on: [server]
command: --monitoringServerIP=server
\ No newline at end of file
This diff is collapsed.
...@@ -82,7 +82,7 @@ def handle_delivery(message): ...@@ -82,7 +82,7 @@ def handle_delivery(message):
def test_local(): def test_local():
home = expanduser("~") home = expanduser("~")
transformer = DockerComposeTransformer(home+"/workspace/DRIP/docs/input_tosca_files/Matej.BEIA.yml") transformer = DockerComposeTransformer(home+"/workspace/DRIP/docs/input_tosca_files/BEIAv3.yml")
compose = transformer.getnerate_compose() compose = transformer.getnerate_compose()
print yaml.dump(compose) print yaml.dump(compose)
response = {} response = {}
......
...@@ -63,9 +63,16 @@ class DockerComposeTransformer: ...@@ -63,9 +63,16 @@ class DockerComposeTransformer:
for prop in properties: for prop in properties:
if prop == 'Environment_variables' or prop == 'Live_variables' or prop =='Environment': if prop == 'Environment_variables' or prop == 'Live_variables' or prop =='Environment':
for var in properties[prop]: for var in properties[prop]:
environment ={} if 'Environment' in properties[prop]:
environment[var] = properties[prop][var] for key in properties[prop]['Environment']:
environments.append(environment) environment ={}
environment[str(key)] = str(properties[prop]['Environment'][key])
environments.append(environment)
else:
environment ={}
environment[str(var)] = str(properties[prop][var])
environments.append(environment)
# environments.append(str(var)+"="+str(properties[prop][var]))
# if properties[prop] and not isinstance(properties[prop],dict): # if properties[prop] and not isinstance(properties[prop],dict):
# environment.append(prop+"="+str(properties[prop])) # environment.append(prop+"="+str(properties[prop]))
return environments return environments
...@@ -140,7 +147,7 @@ class DockerComposeTransformer: ...@@ -140,7 +147,7 @@ class DockerComposeTransformer:
docker_types = self.get_docker_types() docker_types = self.get_docker_types()
node_templates = self.get_node_templates() node_templates = self.get_node_templates()
services = {} services = {}
services['version'] = '2' # services['version'] = '2'
services['services'] = {} services['services'] = {}
all_volumes = [] all_volumes = []
for node_template_key in node_templates: for node_template_key in node_templates:
...@@ -162,7 +169,9 @@ class DockerComposeTransformer: ...@@ -162,7 +169,9 @@ class DockerComposeTransformer:
properties = self.get_properties(node_templates[node_template_key]) properties = self.get_properties(node_templates[node_template_key])
environment = self.get_enviroment_vars(properties) environment = self.get_enviroment_vars(properties)
if environment: if environment:
service['environment'] = environment for env in environment:
service['environment'] = env
# service['environment'] = environment
port_maps = self.get_port_map(properties) port_maps = self.get_port_map(properties)
if port_maps: if port_maps:
......
...@@ -99,14 +99,14 @@ def handle_delivery(message): ...@@ -99,14 +99,14 @@ def handle_delivery(message):
return json.dumps(response) return json.dumps(response)
if __name__ == "__main__": if __name__ == "__main__":
# home = expanduser("~") home = expanduser("~")
# planner = DumpPlanner(home+"/workspace/DRIP/docs/input_tosca_files/BEIA_cardif2.yml") planner = DumpPlanner(home+"/workspace/DRIP/docs/input_tosca_files/BEIAv3.yml")
# print planner.plan() print planner.plan()
logger.info("Input args: " + sys.argv[0] + ' ' + sys.argv[1] + ' ' + sys.argv[2]) # logger.info("Input args: " + sys.argv[0] + ' ' + sys.argv[1] + ' ' + sys.argv[2])
channel = init_chanel(sys.argv) # channel = init_chanel(sys.argv)
global queue_name # global queue_name
queue_name = sys.argv[2] # queue_name = sys.argv[2]
start(channel) # start(channel)
# #
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment