Permalink
Browse files

new environment manager operational

  • Loading branch information...
chrischeyne committed Dec 15, 2011
1 parent 3f3cffa commit 5bd625149691bc2f200e9a8ed923b2620a51469d
@@ -138,14 +138,18 @@ def run(self,cmd,timeout=10):
env = os.environ
cassenv = self.getbubble('cassandra')
# replace current environment variables with our bubble
- os.environ['PYTHONHOME'] = cassenv['PYTHONHOME']
- os.environ['PYTHONPATH']= cassenv['PYTHONPATH']
- os.environ['JAVA_HOME']= cassenv['JAVA_HOME']
+ mykeys = ('PYTHONHOME','PYTHONPATH','JAVA_HOME')
+ try:
+ for k in mykeys:
+ env[k] = env.get(k,cassenv[k])
+ except KeyError:
+ env[k] = cassenv[k]
sys.prefix = cassenv['PYTHONHOME']
- sys.execprefix =PYTHONHOME
- sys.path.append(PYTHONHOME)
- sys.path.append(PYTHONPATH)
- os.chdir(PYTHONHOME)
+ sys.execprefix = cassenv['PYTHONHOME']
+ sys.path.append(cassenv['PYTHONHOME'])
+ sys.path.append(cassenv['JAVA_HOME'])
+ sys.path.append(cassenv['PYTHONPATH'])
+ os.chdir(cassenv['PYTHONHOME'])
# then we boot the run command, running in the environment and return
# STD{out,err} <-- FIXME: stderr catch
print '------------------------------'
@@ -282,20 +286,6 @@ def myportscan(self,mycluster=mynodes,myport=7199):
print "Port scanning for node listening..." , mycluster, myport
taskrunring("fuser -v " + str(myport) + "/tcp",mycluster)
- def initenvironment(self,mycluster=mynodes):
- """ ensure clusterSSH is running in the correct environment"""
- """ this ensures system python etc does not get in the way"""
- """ read in environment variables from myconfig """
- os.environ["PYTHONHOME"]=PYTHONHOME
- os.environ["PYTHONPATH"]=PYTHONPATH
- os.environ["JAVAHOME"]=JAVAHOME
- sys.prefix=PYTHONHOME
- sys.execprefix=PYTHONHOME
- sys.path.append(PYTHONHOME)
- sys.path.append(PYTHONPATH)
- os.chdir(PYTHONHOME)
- print "initenvironment(): path is ",PATH," pythonhome is, ", PYTHONHOME
-
# -----------------------------------------------------------------------------
# -- MAIN --
@@ -35,6 +35,7 @@ ringlive:
PYTHONHOME: /opt/python-2.7.2
JAVA_HOME: /opt/jdk1.6.0_27
CASSANDRAHOME: /opt/cassandra-dev/apache-cassandra-0.8.5
+ PYTHONPATH: /opt/python-2.7.2
cassandrabin: /bin/cassandra
cassandrayaml: -Dcassandra.config=file:cassandra.yaml
cassandraroot: /opt/cassandra-dev
@@ -1,3 +1,3 @@
-(F1323964080.023427
-F1323964080.043957
-t...
+(F1323967320.0563481
+F1323967320.0842021
+t.

0 comments on commit 5bd6251

Please sign in to comment.