~bigdata-dev/charms/trusty/apache-hive/rewrite

« back to all changes in this revision

Viewing changes to hooks/callbacks.py

  • Committer: Cory Johns
  • Date: 2015-02-20 03:31:22 UTC
  • Revision ID: cory.johns@canonical.com-20150220033122-58qeq3l2p7n3nijt
Fixed conf dir and relation data access

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        charmdata.kv.set('hive.installed', True)
43
43
 
44
44
    def setup_hive_config(self):
 
45
        with utils.environment_edit_in_place('/etc/environment') as env:
 
46
            env['HIVE_CONF_DIR'] = self.DIRS['hive_real_conf']
45
47
        # copy default config into alternate dir
46
48
        conf_dir = self.DIRS['hive_installed'] / 'conf'
47
49
        self.DIRS['hive_conf'].rmtree_p()
62
64
        config = hookenv.config()
63
65
        hive_site = self.DIRS['hive_conf'] / 'hive-site.xml'
64
66
        with utils.xmlpropmap_edit_in_place(hive_site) as props:
65
 
            mysql = charmdata.kv.get('relations.filtered.db')[0]
 
67
            mysql = charmdata.kv.get('relations.ready')['db'].values()[0]
66
68
            props['javax.jdo.option.ConnectionURL'] = "jdbc:mysql://{}/{}".format(
67
 
                mysql['host'], mysql['db']
 
69
                mysql['host'], mysql['database']
68
70
            )
69
71
            props['javax.jdo.option.ConnectionUserName'] = mysql['user']
70
72
            props['javax.jdo.option.ConnectionPassword'] = mysql['password']