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

change env from list to map

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