View contexts.py
1 2 3 4 5 6 7 8 9 10
import os
import subprocess
import yaml
 
from charmhelpers.core import hookenv
 
LATEST = "latest"
 
 
class Service(dict):
View lsblk.py
1 2 3 4 5 6 7 8 9 10
import subprocess
import re
 
regex = re.compile('([A-Z]+)=(?:"(.*?)")')
parts = "NAME,KNAME,MODEL,UUID,SIZE,ROTA,TYPE,MOUNTPOINT,MAJ:MIN"
 
def blocks():
blocks = []
output = subprocess.check_output([
"sudo", "lsblk", "-P", "-o",
View gist:41552afa0eef5730c686
1 2 3 4 5 6 7 8 9 10
2014-10-26 02:33:12 INFO network-relation-changed Registering machine
2014-10-26 02:33:12 INFO network-relation-changed registration request
{'kind': 'Minion', 'id': u'10.132.218.156',
'resources': {'capacity': {'mem': '2049988 K', 'cpu': 2}}, 'hostIP': u'10.132.218.156'}
 
2014-10-26 02:33:12 INFO network-relation-changed registration result
{"kind":"Status","creationTimestamp":null,"selfLink":"/api/v1beta1/minions",
"apiVersion":"v1beta1","status":"Failure",
"message":"The requested resource does not exist.",
"code":500}
View gist:194a934ca96eea0411a9
1 2 3 4 5 6 7 8 9 10
kube:
series: trusty
services:
kubernetes-master:
charm: kubernetes-master
flannel:
charm: flannel
num_units: 2
options:
container_type: docker
View lxc-host.py
1 2 3 4 5 6 7 8 9
#!/usr/bin/python
"""
Simple usage to log into a container via ssh
$ lxc-host -s -n container_name
Simple usage to query the addresses of a container
$ lxc-host -n container_name
View capture dependency as library
1 2 3 4 5 6 7 8 9 10
#!/bin/bash
 
sudo apt-get install python-virtualenv
 
virtualenv tosca-dev
source tosca-dev/bin/activate
 
git clone https://github.com/stackforge/heat-translator.git
# Edit access
git clone git@github.com:juju/juju-tosca.git
View security-group-gc.py
1 2 3 4 5 6 7 8 9
#!/usr/bin/env python
import argparse
import sys
import logging
 
from boto.ec2 import regions, connect_to_region
 
 
def main():
View gist:c65b1dc77f6832c31bff
1 2 3 4 5 6 7 8 9 10
 
# Capture all the deps
mkdir dist-cache
pip install -d dist-cache -r requirements.txt
cd ..
tar czvf mypackage-archive.tgz
 
# Transfer that to a new machine
# On the separate machine in a virtualenv
# Extract tarball and use
View azure-instance-info.txt
1 2 3 4 5 6 7 8 9 10
svc host fault upgrade size power ip
42fzbcx2ev juju0nezlcysed3o... 0 0 Small Started 10.0.0.20
42fzbcx2ev juju9bd6mjna00h0... 0 4 Small Started 10.0.0.60
42fzbcx2ev juju9ygqoy9qjkdq... 1 1 Small Started 10.0.0.28
42fzbcx2ev jujufrh460g4vyra... 1 0 Small Started 10.0.0.68
42fzbcx2ev jujukhrocaqpux90... 1 3 Small Started 10.0.0.52
42fzbcx2ev jujuzbbtbkk8tdo6... 0 2 Small Started 10.0.0.44
47rntclyak jujugk2ygbnatkhc... 0 0 Small Started 10.0.0.4
51etwr329x juju6329s6bqqao2... 0 0 Small Started 10.0.0.12
51etwr329x jujuuxa3sfxyp12f... 1 1 Small Started 10.0.0.36
View juju reboot support
1 2 3 4 5 6 7 8 9 10
api for unit agent request shutdown on self machine (triggered by hook exit value)
api for unit agent to watch for shutdown on machine
-> on receipt
stops further hook exec / blocking on the current one if any
signals ready for shutdown
 
api for unit agent to signal ready for shutdown
api for machine agent watch for shutdown
-> on shutdown recieved
-> disables unit deployment
Something went wrong with that request. Please try again.