Ubuntu Pastebin

Paste from frankban at Tue, 25 Oct 2016 12:16:10 +0000

Download as text
 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
#!/bin/sh

# Usage: juju-db
# Connect to the database holding the state of the current Juju controller.

set -e

while [ $# -ge 1 ]; do
    key="$1"
    case $key in
        -h|--help)
        echo usage: `basename $0`
        echo connect to the database holding the state of the current Juju controller
        exit 0
        ;;
        --description)
        echo conect to the Juju MongoDB
        exit 0
        ;;
        *)
        echo unexpected parameters passed: $*
        exit 1
        ;;
    esac
    shift
done

port=`juju controller-config state-port`
password=`juju ssh -m controller 0 sudo grep statepassword: /var/lib/juju/agents/machine-0/agent.conf | cut -b16- | sed 's/\\r//'`

echo state port: $port
echo password: $password

juju ssh -m controller 0 \
    sudo /usr/lib/juju/mongo3.2/bin/mongo 127.0.0.1:$port/admin --ssl \
    --sslAllowInvalidCertificates --sslPEMKeyPassword /var/lib/juju/shared-secret \
    --sslPEMKeyFile /var/lib/juju/server.pem -u machine-0 -p $password
Download as text