~abentley/charms/precise/juju-reports/use-configured-port

« back to all changes in this revision

Viewing changes to hooks/database-relation-changed

  • Committer: j.c.sackett
  • Date: 2014-02-01 22:38:43 UTC
  • Revision ID: jcsackett@canonical.com-20140201223843-yfwln33hcbv3ni1z
Restart needs to be from code dir, not charm dir

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
from Cheetah.Template import Template
7
7
 
 
8
def with_chdir(fn):
 
9
    def dec_fn(*args):
 
10
        os.chdir(project_dir)
 
11
        fn(*args)
 
12
        os.chdir(working_dir)
 
13
    return dec_fn
8
14
 
9
15
def install_ini(mongo_url):
10
16
    t = Template(file='templates/ini.tmpl')
11
17
    t.mongo_url = mongo_url
12
18
    file('/home/ubuntu/juju-reports/production.ini', 'w').write(str(t))
13
19
 
 
20
@with_chdir
14
21
def restart():
15
22
    subprocess.check_call(['scripts/stop'])
16
23
    subprocess.check_call(['scripts/run'])