Ubuntu Pastebin

Paste from suchvenu at Wed, 13 Apr 2016 15:13:02 +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
@when 'db.available'
@when 'db.installed'
@when 'db.sshconfigured'
@when_not 'db.consumerdbscreated'
function create_consumer_dbs(){
        DB2_INSTALL_PATH=/opt/ibm/db2/V10.5
        #Create the user for the remote unit connected
        create_user

        #Create the DBs after parsing
        create_dbs
        juju-log "Create DBs done, All completed"
        set_state 'db.consumerdbscreated'
}

@when 'db.available'
@when 'db.installed'
@when 'db.consumerdbscreated'
@when_not 'db.exportdbdetails'
function export_db_details(){
        get_cfgusername
        service_name=`su - $cfgusername -c 'db2 get dbm cfg|grep -i svce|cut -d"=" -f2'`
        db2_port=`grep $service_name /etc/services | cut -d"/" -f1 | cut -f2`
        db2_path="/opt/ibm/db2"
        hostname=`unit-get private-address`
        dbusername=$cfgusername
        dbuserpw=$cfgpasswd
        db2_instance_name=$cfgusername

        juju-log "Sending the port number $db2_port"
        juju-log "Other vals are hostname = $hostname dbusername=$dbusername dbuserpw=$dbuserpw db2_instance_name=$db2_instance_name"
        juju-log "***************In configure_db reactive function**********"
        relation_call --state=db.connected set_db_details $db2_path $db2_port $hostname $dbusername $dbuserpw $db2_instance_name || true
        set_state 'db.exportdbdetails'
}
Download as text