summaryrefslogtreecommitdiffstats
path: root/src/sbin
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-06-02 21:05:20 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-06-02 21:05:20 +0000
commite57ef67c2f869513ee8e742e762130b945327ef9 (patch)
treea39b45738fada13a3451fdb7108dd6004d2da6af /src/sbin
parent6d5c8583ecf0cafa139d20a7bfb123c843ad77b8 (diff)
downloadbcfg2-e57ef67c2f869513ee8e742e762130b945327ef9.tar.gz
bcfg2-e57ef67c2f869513ee8e742e762130b945327ef9.tar.bz2
bcfg2-e57ef67c2f869513ee8e742e762130b945327ef9.zip
Fix bcfg2-init for non /etc paths (Patch from gogo) (Resolves Ticket #447)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3224 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin')
-rwxr-xr-xsrc/sbin/bcfg2-admin12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/sbin/bcfg2-admin b/src/sbin/bcfg2-admin
index 9a5c021d0..6dc4319e1 100755
--- a/src/sbin/bcfg2-admin
+++ b/src/sbin/bcfg2-admin
@@ -3,6 +3,7 @@
import getopt, difflib, logging, lxml.etree, os, popen2, re, socket, sys, ConfigParser
import Bcfg2.Server.Core, Bcfg2.Logging, Bcfg2.tlslite.api
+import xml.sax.saxutils
log = logging.getLogger('bcfg-admin')
@@ -34,7 +35,7 @@ sendmailpath = /usr/sbin/sendmail
[communication]
protocol = xmlrpc/ssl
password = %s
-key = /etc/bcfg2.key
+key = %s/bcfg2.key
[components]
bcfg2 = %s
@@ -92,13 +93,16 @@ def initialize_repo(cfile):
if uri == '':
uri = server
- open(cfile,"w").write(config % ( repo, password, uri ))
+ #guess path of ssl key file
+ keypath = os.path.dirname(os.path.abspath(cfile))
+
+ open(cfile,"w").write(config % ( repo, password, keypath, uri ))
#generate the ssl key
print "Now we will generate the ssl key used for secure communitcation"
- os.popen('openssl req -x509 -nodes -days 1000 -newkey rsa:1024 -out /etc/bcfg2.key -keyout /etc/bcfg2.key')
+ os.popen('openssl req -x509 -nodes -days 1000 -newkey rsa:1024 -out %s/bcfg2.key -keyout %s/bcfg2.key' % (keypath, keypath))
try:
- os.chmod('/etc/bcfg2.key','0600')
+ os.chmod('%s/bcfg2.key'% keypath,'0600')
except:
pass