~ubuntuone-hackers/charms/xenial/graphite-beacon/trunk

« back to all changes in this revision

Viewing changes to reactive/graphite_beacon.py

  • Committer: Guillermo Gonzalez
  • Date: 2017-04-13 22:25:53 UTC
  • Revision ID: guillermo.gonzalez@canonical.com-20170413222553-8vxn1d2ug9x8yd64
misc xenial fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
        hookenv.log('Service venv already exists')
61
61
    elif not os.path.exists(env_dir):
62
62
        hookenv.log('Installing python packages into the venv ...')
63
 
        subprocess.check_call(['virtualenv', '-p', 'python', env_dir])
 
63
        subprocess.check_call(['virtualenv', '--no-download', '-p', 'python', env_dir])
64
64
 
65
65
    pip_cache = os.path.join(hookenv.charm_dir(), 'files', 'pip-cache')
66
66
    args = []
115
115
        source='systemd.j2',
116
116
        target='/etc/systemd/system/{}.service'.format(SERVICE_NAME),
117
117
        context=hookenv.config().copy()),
 
118
    # reload systemd to get new configs applied
 
119
    subprocess.check_call(['systemctl', 'daemon-reload'])
 
120
    subprocess.check_call(['systemctl', 'enable', '{}.service'.format(SERVICE_NAME)])
118
121
    reactive.set_state('graphite-beacon.ready')
119
122
 
120
123
 
 
124
 
121
125
@when_file_changed(os.path.join(get_base_directory(), 'etc', 'config.yml'),
122
126
                   os.path.join(get_base_directory(), 'etc', 'alerts.yml'))
123
127
def restart():
124
 
    if not os.path.exists('/etc/init/{}.conf'.format(SERVICE_NAME)):
 
128
    if not os.path.exists('/etc/systemd/system/{}.service'.format(SERVICE_NAME)):
125
129
        return
126
130
    host.service_restart('graphite-beacon')
127
131