openstack_observer use XOS_DIR instead of hardcoded paths
diff --git a/planetstack/openstack_observer/ansible.py b/planetstack/openstack_observer/ansible.py
index 41dc6f0..b8cd311 100644
--- a/planetstack/openstack_observer/ansible.py
+++ b/planetstack/openstack_observer/ansible.py
@@ -8,11 +8,15 @@
import random
import re
+# XXX hardcoded path
+# is there any reason why we aren't importing planetstack.config ?
+XOS_DIR="/opt/planetstack"
+
try:
step_dir = Config().observer_steps_dir
sys_dir = Config().observer_sys_dir
except:
- step_dir = '/opt/planetstack/observer/steps'
+ step_dir = XOS_DIR + '/observer/steps'
sys_dir = '/opt/opencloud'
os_template_loader = jinja2.FileSystemLoader( searchpath=step_dir)
@@ -63,7 +67,7 @@
f.write(buffer)
f.flush()
- run = os.popen('/opt/planetstack/observer/run_ansible %s'%shellquote(fqp))
+ run = os.popen(XOS_DIR + "/observer/run_ansible %s'%shellquote(fqp))
#run = os.popen('ansible-playbook -v %s'%shellquote(fqp))
msg = run.read()
status = run.close()
diff --git a/planetstack/openstack_observer/event_loop.py b/planetstack/openstack_observer/event_loop.py
index bc0b226..ce0ab5e 100644
--- a/planetstack/openstack_observer/event_loop.py
+++ b/planetstack/openstack_observer/event_loop.py
@@ -20,7 +20,7 @@
from openstack.driver import OpenStackDriver
from util.logger import Logger, logging, logger
#from timeout import timeout
-from planetstack.config import Config
+from planetstack.config import Config, XOS_DIR
from observer.steps import *
from syncstep import SyncStep
from toposort import toposort
@@ -98,7 +98,7 @@
if hasattr(Config(), "observer_steps_dir"):
step_dir = Config().observer_steps_dir
else:
- step_dir = "/opt/planetstack/observer/steps"
+ step_dir = XOS_DIR + "/observer/steps"
for fn in os.listdir(step_dir):
pathname = os.path.join(step_dir,fn)
@@ -380,7 +380,7 @@
while True:
try:
loop_start = time.time()
- error_map_file = getattr(Config(), "error_map_path", "/opt/planetstack/error_map.txt")
+ error_map_file = getattr(Config(), "error_map_path", XOS_DIR + "/error_map.txt")
self.error_mapper = ErrorMapper(error_map_file)
# Set of whole steps that failed