projects
/
certmaster.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(Not working yet, but the changeset was getting too big: The service starts, but...
[certmaster.git]
/
scripts
/
certmaster-sync
diff --git
a/scripts/certmaster-sync
b/scripts/certmaster-sync
index
bd27af5
..
4d9559f
100644
(file)
--- a/
scripts/certmaster-sync
+++ b/
scripts/certmaster-sync
@@
-7,7
+7,19
@@
import os
import sys
import os
import sys
-import sha
+try:
+ import hashlib
+except ImportError:
+ # Python-2.4.z ... gah! (or even 2.3!)
+ import sha
+ class hashlib:
+ @staticmethod
+ def new(algo):
+ if algo == 'sha1':
+ return sha.new()
+ raise ValueError, "Bad checksum type"
+
+
import xmlrpclib
from glob import glob
from time import sleep
import xmlrpclib
from glob import glob
from time import sleep
@@
-67,12
+79,13
@@
def local_certs():
results = []
for f in files:
hostname = os.path.basename(f).replace('.' + cm.cfg.cert_extension, '')
results = []
for f in files:
hostname = os.path.basename(f).replace('.' + cm.cfg.cert_extension, '')
+ dirname = os.path.dirname(f)
digest = checksum(f)
digest = checksum(f)
- results.append([hostname, digest])
+ results.append([hostname, digest
, dirname
])
return results
def checksum(f):
return results
def checksum(f):
- thissum =
sha.new(
)
+ thissum =
hashlib.new('sha1'
)
if os.path.exists(f):
fo = open(f, 'r')
data = fo.read()
if os.path.exists(f):
fo = open(f, 'r')
data = fo.read()
@@
-107,7
+120,7
@@
def copy_updated_certs(local, remote):
for cert in local:
if cert not in peers:
cert_name = '%s.%s' % (cert[0], cm.cfg.cert_extension)
for cert in local:
if cert not in peers:
cert_name = '%s.%s' % (cert[0], cm.cfg.cert_extension)
- full_path = os.path.join(c
m.cfg.certroot
, cert_name)
+ full_path = os.path.join(c
ert[2]
, cert_name)
fd = open(full_path)
certblob = fd.read()
fd.close()
fd = open(full_path)
certblob = fd.read()
fd.close()