~arosales/charms/trusty/datameer/trunk

« back to all changes in this revision

Viewing changes to hooks/common.py

  • Committer: Antonio Rosales
  • Date: 2015-02-24 17:36:21 UTC
  • Revision ID: antonio.rosales@canonical.com-20150224173621-axjdwc682g82rdom
Create stub relations

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
import os
 
3
import subprocess
 
4
from charmhelpers.core.hookenv import log, unit_get
 
5
import shlex
 
6
 
 
7
hue_home = os.path.join(os.path.sep, "usr", "share", "hue")
 
8
hue_ini = os.path.join(os.path.sep, hue_home, "desktop", "conf","hue.ini")
 
9
stop_hue_script = os.path.join(os.path.sep, os.environ['CHARM_DIR'], "files", "scripts", "stop_hue.sh")
 
10
 
 
11
def restart_hue():
 
12
    # stop_hue_script is a workaround to shutdown "hue runserver" - needs a better solution
 
13
    # from hue community - sent an email 12/13/2014 - amir sanjar
 
14
    subprocess.call(stop_hue_script)
 
15
    ip = unit_get('private-address')
 
16
    hue_exe = os.path.join(os.path.sep, hue_home, "build", "env", "bin", "hue")
 
17
    cmd = hue_exe+" runserver "+ip+":8000" 
 
18
    subprocess.Popen(shlex.split(cmd),stdout=subprocess.PIPE,stderr=subprocess.PIPE)
 
 
b'\\ No newline at end of file'