Skip to content

Instantly share code, notes, and snippets.

View bcsaller's full-sized avatar

Benjamin Saller bcsaller

View GitHub Profile
from charmhelpers.relations import hook, RelationBase
class MysqlClient(RelationBase):
cache_keys = ['host', 'port', 'user', 'password']
@hook('relation-changed')
def db_connectable(self):
data = self.data_available(self.dsn_keys)
if data:
#!/usr/bin/env python
from charmhelpers.core import when, when_not
import framework
import helpers
CONFIG_FILE = "/etc/myapp/app.conf"
@when("db.connectable", "cache.ready")
def regen_config(db, cache):
#!/usr/bin/env python
import argparse
import pprint
import networkx as nx
import jujuclient
import yaml
def setup():
@bcsaller
bcsaller / -
Created October 27, 2014 19:42
=== modified file 'cloudfoundry/utils.py'
--- cloudfoundry/utils.py 2014-10-27 19:30:20 +0000
+++ cloudfoundry/utils.py 2014-10-27 19:41:54 +0000
@@ -438,9 +438,13 @@
return None
for server in ['@8.8.8.8', '']:
- output = subprocess.check_output(
- filter(None, ['dig', '+short', server, address]))
- result = filter_ip(output)
#!/usr/bin/env python
import argparse
import pprint
import networkx as nx
import yaml
def setup():
parser = argparse.ArgumentParser()
cloudfoundry:
relations:
- - login:uaa
- - uaa:uaa
- - loggregator-trafficcontrol:cc
- - cc:cc
- - etcd:client
- - cc-clock:etcd
- cc-worker:etcd
- router:etcd
cloudfoundry:
relations:
- - login:uaa
- - uaa:uaa
- - loggregator-trafficcontrol:cc
- - cc:cc
- - etcd:client
- - cc-clock:etcd
- cc-worker:etcd
- router:etcd
#!/bin/bash
# First, make sure that cgroups are mounted correctly.
CGROUP=/sys/fs/cgroup
: {LOG:=stdio}
[ -d $CGROUP ] || mkdir $CGROUP
mountpoint -q $CGROUP ||
mount -n -t tmpfs -o uid=0,gid=0,mode=0755 cgroup $CGROUP || {
echo "Could not make a tmpfs mount. Did you use -privileged?"
#!/usr/bin/env python
import argparse
import pprint
from jujuclient import Environment
def setup():
parser = argparse.ArgumentParser()