~bigdata-dev/charms/trusty/hdp-accumulo/trunk

« back to all changes in this revision

Viewing changes to hooks/tabletserver-relation-changed

  • Committer: amir sanjar
  • Date: 2014-09-29 13:05:03 UTC
  • Revision ID: amir.sanjar@canonical.com-20140929130503-bgplejwzd82fzsep
adding ssh and other fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import os
4
4
import sys
5
5
 
6
 
from bdutils import fileSetKV, fileRemoveKey
 
6
from bdutils import fileAddLine, fileRemoveKey, fconfigured
7
7
from charmhelpers.core.hookenv import relation_get
8
8
from common import accumulo_masters_file
9
9
 
26
26
    if not accumulo_master_IP:
27
27
        log ("accumulo  ==> tabletserver not ready","INFO")
28
28
        sys.exit(0)
 
29
    if fconfigured("tserver_init"):
 
30
        return
29
31
    log("accumulo ==> tabletserver IP={}".format(accumulo_master_IP),"INFO")
30
32
    fileRemoveKey(accumulo_masters_file, "localhost")
31
 
    fileSetKV(accumulo_masters_file, accumulo_master_IP, "\n")
 
33
    fileAddLine(accumulo_masters_file, accumulo_master_IP)
 
34
    ssh_pub_key = str(relation_get('sshpubkey'))
 
35
    ssh_auth_path = os.path.join(os.path.sep, 'home', 'ubuntu','.ssh', 'authorized_keys')
 
36
    with open(ssh_auth_path, 'a') as fssh:
 
37
        fssh.write(ssh_pub_key)
32
38
    
33
39
    
34
40