From e57ef67c2f869513ee8e742e762130b945327ef9 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Sat, 2 Jun 2007 21:05:20 +0000 Subject: 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 --- src/sbin/bcfg2-admin | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/sbin/bcfg2-admin') 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 -- cgit v1.2.3-1-g7c22