summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAdrian Likins <alikins@grimlock.devel.redhat.com>2008-03-04 17:57:52 -0500
committerAdrian Likins <alikins@grimlock.devel.redhat.com>2008-03-04 17:57:52 -0500
commit890b150077b5390b879642adc2b42fe3e1944e4a (patch)
treeb5730b8c561e06019ea0097d30735fefdebadd2c /scripts
parent7bff89141d9547e4b95049cf4322a78277d451ed (diff)
downloadfunc-890b150077b5390b879642adc2b42fe3e1944e4a.tar.gz
func-890b150077b5390b879642adc2b42fe3e1944e4a.tar.xz
func-890b150077b5390b879642adc2b42fe3e1944e4a.zip
Fix a couple of bugs here, and turn on more debugging output.
We were copying the /etc/pki/func/ contents to a subdir of /etc/pki/certmaster instead of into the dir directly. Fixed.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/update-func40
1 files changed, 19 insertions, 21 deletions
diff --git a/scripts/update-func b/scripts/update-func
index fb9318d..faf4dd1 100755
--- a/scripts/update-func
+++ b/scripts/update-func
@@ -41,7 +41,7 @@ FUNC_MINION_CONF="/etc/func/minion.conf"
CERTMASTER_MINION_CONF="/etc/certmaster/minion.conf"
FUNC_MINION_CERT_DIR="/etc/pki/func/"
-CERTMASTER_MINION_CERT_DIR="/etc/pki/certmaster"
+CERTMASTER_MINION_CERT_DIR="/etc/pki/certmaster/"
CERTMASTER_CONF="/etc/certmaster/certmaster.conf"
@@ -58,8 +58,8 @@ def list_files(files):
print "%s not found" % filename
-#list_files([FUNC_MINION_CONF, CERTMASTER_MINION_CONF, FUNC_MINION_CERT_DIR,
-# CERTMASTER_MINION_CERT_DIR, FUNC_CERTMASTER_CERT_DIR,CERTMASTER_CERT_DIR])
+list_files([FUNC_MINION_CONF, CERTMASTER_MINION_CONF, FUNC_MINION_CERT_DIR,
+ CERTMASTER_MINION_CERT_DIR, FUNC_CERTMASTER_CERT_DIR,CERTMASTER_CERT_DIR])
def func_minion_has_cert_info(fmc_content):
@@ -94,16 +94,17 @@ def migrate_minion_conf_settings():
# ugh, do I really want to parse these files?
# guess I kind of have to...
+ print "migrating settings"
# see if we have edited this file before
fc_f = open(FUNC_MINION_CONF, "r")
# we can't rely on the new config class to read the old config
# files, so we do it the old fashioned way
- obs = False
- if read_config(FUNC_MINION_CONF, "obsolete"):
- obs = True
+ migrated = False
+ if read_config(FUNC_MINION_CONF, "migrated"):
+ migrated = True
- if obs == True:
+ if migrated == True:
return
@@ -111,13 +112,6 @@ def migrate_minion_conf_settings():
cm_mc = cm_config.read_config(CERTMASTER_MINION_CONF, cm_commonconfig.MinionConfig)
- cert_dir = read_config(FUNC_MINION_CONF, "cert_dir")
-
-# # don't migrate the default, just use the new default
-# if cert_dir and cert_dir != "/etc/pki/func":
-# cmc.cert_dir = cert_dir
-# cm_mc.cert_dir = cert_dir
-
cert_master = read_config(FUNC_MINION_CONF, "certmaster")
if cert_master:
@@ -135,7 +129,7 @@ def migrate_minion_conf_settings():
# so this is a kluge
fc_f = open(FUNC_MINION_CONF, "a+")
- fc_f.write("obsolete = 1\n")
+ fc_f.write("migrated = 1\n")
fc_f.close()
@@ -157,15 +151,19 @@ if os.access(FUNC_MINION_CONF, os.R_OK):
# note that we do no migrate the old config settings. basically, everyone gets moved to
# the new default cert dir.
cert_dir = read_config(FUNC_MINION_CONF, "cert_dir")
-if os.access(cert_dir, os.R_OK):
-# print "copying files from %s to %s" % (cert_dir, CERTMASTER_MINION_CERT_DIR)
- output = subprocess.Popen(["cp", "-var", cert_dir, CERTMASTER_MINION_CERT_DIR], stdout=subprocess.PIPE).communicate()[0]
-# print "foo", output
+if cert_dir:
+ FUNC_MINION_CERT_DIR = cert_dir
+
+if os.access(FUNC_MINION_CERT_DIR, os.R_OK):
+ print "copying files from %s/* to %s" % (FUNC_MINION_CERT_DIR, CERTMASTER_MINION_CERT_DIR)
+# output = subprocess.Popen(["cp", "-var", "%s/*" % FUNC_MINION_CERT_DIR, CERTMASTER_MINION_CERT_DIR], stdout=subprocess.PIPE).communicate()[0]
+ output = subprocess.Popen("cp -var %s/* %s" % (FUNC_MINION_CERT_DIR, CERTMASTER_MINION_CERT_DIR), shell=True, stdout=subprocess.PIPE).communicate()[0]
+ print "foo", output
if os.access(CERTMASTER_CERT_DIR, os.R_OK):
-# print "copyying files from %s to %s" % (FUNC_CERTMASTER_CERT_DIR, CERTMASTER_CERT_DIR)
+ print "copyying files from %s to %s" % (FUNC_CERTMASTER_CERT_DIR, CERTMASTER_CERT_DIR)
output = subprocess.Popen(["cp", "-var", FUNC_CERTMASTER_CERT_DIR, CERTMASTER_CERT_DIR], stdout=subprocess.PIPE).communicate()[0]
-# print output
+ print output