Permalink
Browse files

Write db properties file in nimbus-configure

  • Loading branch information...
1 parent 93c80f8 commit 87a96960add6f6b857a17a9f80a8c360eb6eecbb @labisso labisso committed with timf Jun 1, 2010
Showing with 32 additions and 0 deletions.
  1. +32 −0 home/sbin/nimbusconfigure.py
@@ -381,6 +381,35 @@ def write_env_file(self):
if f:
f.close()
+ def write_db_props(self):
+ """Writes ant properties file used by db-mgmt.xml
+ """
+ persistdir = os.path.join(self.gtdir, 'var/nimbus')
+ dbsetupdir = os.path.join(self.gtdir, 'share/nimbus')
+ dbsetuplibdir = os.path.join(self.gtdir, 'share/nimbus/lib')
+ derbyhomedir = os.path.join(self.gtdir, 'var')
+ derbylibdir = os.path.join(self.gtdir, 'lib')
+ pwgenfile = os.path.join(self.gtdir, 'etc/nimbus/workspace-service/other/shared-secret-suggestion.py')
+
+ lines = ['#Autogenerated by nimbus-configure\n',
+ '#'+time.strftime('%c')+'\n']
+ lines.append('workspace.dbdir.prop=%s\n' % persistdir)
+ lines.append('workspace.sqldir.prop=%s\n' % dbsetuplibdir)
+ lines.append('workspace.notifdir.prop=%s\n' % dbsetuplibdir)
+ lines.append('derby.system.home.prop=%s\n' % derbyhomedir)
+ lines.append('derby.relative.dir.prop=nimbus\n')
+ lines.append('derby.classpath.dir.prop=%s\n' % derbylibdir)
+ lines.append('pwGen.path.prop=%s\n' % pwgenfile)
+
+ db_props_path = os.path.join(dbsetupdir,'workspace.persistence.conf')
+ f = None
+ try:
+ f = open(db_props_path, 'w')
+ f.writelines(lines)
+ finally:
+ if f:
+ f.close()
+
def perform_setup(self):
# first, set up CA and host cert/key
ca_name = self["ca.name"]
@@ -457,6 +486,9 @@ def perform_setup(self):
# write an enviroment file
self.write_env_file()
+ # and db properties file
+ self.write_db_props()
+
def import_db(setup, old_db_path):
derbyrun_path = os.path.join(setup.gtdir, 'lib/derbyrun.jar')
if not os.path.exists(derbyrun_path):

0 comments on commit 87a9696

Please sign in to comment.