Skip to content

Instantly share code, notes, and snippets.

@AdamIsrael
Created March 25, 2015 00:49
Show Gist options
  • Save AdamIsrael/7ead3157593f87b98de9 to your computer and use it in GitHub Desktop.
Save AdamIsrael/7ead3157593f87b98de9 to your computer and use it in GitHub Desktop.
Generate yaml for haproxy charm
#!/usr/bin/env python
import json
service = [
{
'service_name': 'demo',
'service_options': ['mode http', 'balance leastconn', 'option httpchk GET / HTTP/1.0'],
'server_options': ['maxconn 100'],
'servers': [
[
'demo-1',
'${host}',
'${port}',
''
]
]
},
]
services = json.dumps(foo)
services = services.replace('"', "'")
print "relation-set \"services=%s\"" % services
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment