Skip to content

Instantly share code, notes, and snippets.

@jamesbeedy
jamesbeedy / pgsql.py
Created November 16, 2017 02:51
bug_1732547
@when('pgsql.connected')
@when_not('data-api.database.requested')
def request_postgresql_database(pgsql):
"""Request PGSql DB
"""
conf = config()
status_set('maintenance', 'Requesting database for data-api')
pgsql.set_database(conf.get('db-name', 'data_api'))
wget https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
qemu-img create -f qcow2 ub1.img 50G
sudo virt-resize --format qcow2 --output-format qcow2 --expand /dev/sda1 xenial-server-cloudimg-amd64-disk1.img
ub1.img
@jamesbeedy
jamesbeedy / .gitignore
Created November 4, 2017 01:39 — forked from smoser/.gitignore
cloud-init ubuntu nocloud example with network config
*.img
*.raw
@jamesbeedy
jamesbeedy / .gitignore
Created November 4, 2017 01:39 — forked from smoser/.gitignore
cloud-init ubuntu nocloud example with network config
*.img
*.raw
# $ cat user-data
# #cloud-config
# password: mysecret
# chpasswd: { expire: False }
# ssh_pwauth: True
# $ cat meta-data
# instance-id: juju-controller-0
# local-hostname: juju-controller-0
series: xenial
applications:
newcharm:
charm: "cs:~jamesbeedy/newcharm-6"
num_units: 2
annotations:
"gui-x": "714"
"gui-y": "362.5"
to:
- "0"
@jamesbeedy
jamesbeedy / provides.py
Created October 25, 2017 19:49
http_interface_endpoints_network_get
from charmhelpers.core.hookenv import network_get
from charms.reactive import set_flag, clear_flag
from charms.reactive import Endpoint
class HttpProvides(Endpoint):
def configure(self, port, interface_name):
"""
Configure the HTTP relation by providing a port and interface_name.
@jamesbeedy
jamesbeedy / .bashrc
Last active October 4, 2017 23:41
juju bash prompt
function show_juju_env {
local model
local controller
model=`juju whoami --format json | jq -r '.["model"]'`
controller=`juju whoami --format json | jq -r '.["controller"]'`
printf "%s:%s" "$controller" "$model"
}
export PS1="[\[\e\[\033[01;32m\]\$(show_juju_env)\[\e[0m\]]\n${PS1}";
haproxy:
ssl_key: |
------- BASE64 ENCODED PRIVATE SSL KEY ----
...
--------------- END KEY -------------------
ssl_cert: |
---- BASE 64 ENCODED PRIVATE SSL CERT -----
...
----------------- END CERT ----------------
@jamesbeedy
jamesbeedy / list_model_users.sh
Last active September 10, 2017 17:57
list juju model users
#!/bin/bash
set -e
model="`juju models --format json | jq -r '.["current-model"]'`"
users=`juju show-model $model --format json | model=$model jq '.[env.model]["users"]' | jq -r 'keys[] as $k | "\($k)"'`