~johnsca/charms/trusty/cloudfoundry/better-basic-reconciler-status

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function cfadminpass() {
    juju run --unit uaa/0 'relation-get -r $(relation-ids credentials) admin-password cloudfoundry/0'
}


function cfadminurl() {
    echo "http://$(juju status webadmin | grep public-address | awk '{print $NF}'):8070"
}


function cfadminui() {
    python -m webbrowser -t "$(cfadminurl)"
}


function cflogin() {
    ENDPOINT=`juju status haproxy/0 |grep public-address|cut -f 2 -d : `
    IP=`dig +short $ENDPOINT`
    # get the _IP_ of the public address
    cf api http://api.${IP}.xip.io
    cf auth admin "$(cfadminpass)"
    cf create-space -o juju-org my-space
    cf target -o juju-org -s my-space
}


function cfdeploy() {
    if [ -d trusty ] ; then
        mkdir trusty
        bzr branch lp:~cf-charmers/charms/trusty/cloudfoundry/trunk trusty/cloudfoundry
    fi
    export ADMIN_PASS=`cat ${JUJU_HOME:-~/.juju}/environments/$(juju switch).jenv|grep admin-secret|awk '{print $2;}'`
    cat << EOF > cf.yaml
cloudfoundry:
    admin_secret: $ADMIN_PASS
    placement: ${1:-dense}
    cf_version: latest
EOF
    juju deploy --config=cf.yaml local:trusty/cloudfoundry
}

function runrc(){
    old_venv=$VIRTUAL_ENV
    . .tox/py27/bin/activate && PYTHONPATH=. rcnlr --config=$1 $@
    if [ -n "$old_venv" ]; then
        . $old_venv/bin/activate
    fi

}