summaryrefslogtreecommitdiffstats
path: root/ipaserver/install
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-09-23 12:09:37 -0400
committerRob Crittenden <rcritten@redhat.com>2010-09-24 15:31:23 -0400
commita67b524510f66ce112192261f60adf88d07fa96c (patch)
tree0feff0231b22a00c0d722775a0fbd0519ab7a0c4 /ipaserver/install
parent2951901d1e85d5d787baea5934fdee7fe9a6dcb8 (diff)
downloadfreeipa-a67b524510f66ce112192261f60adf88d07fa96c.tar.gz
freeipa-a67b524510f66ce112192261f60adf88d07fa96c.tar.xz
freeipa-a67b524510f66ce112192261f60adf88d07fa96c.zip
Automatically convert a v1-style ca_serialno to the v2 config style.
This has been annoying for developers who switch back and forth. It will still break v1 but at least going from v1 to v2 will work seemlessly. ticket 240
Diffstat (limited to 'ipaserver/install')
-rw-r--r--ipaserver/install/certs.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py
index a9891fbd..033bda28 100644
--- a/ipaserver/install/certs.py
+++ b/ipaserver/install/certs.py
@@ -34,7 +34,7 @@ from ipapython import sysrestore
from ipapython import ipautil
from ipapython import certmonger
from ipalib import pkcs10
-from ConfigParser import RawConfigParser
+from ConfigParser import RawConfigParser, MissingSectionHeaderError
import service
from ipalib import x509
from ipalib.errors import CertificateOperationError
@@ -105,6 +105,18 @@ def next_serial(serial_file=CA_SERIALNO):
cur_serial = serial + 1
except IOError, e:
raise RuntimeError("Unable to determine serial number: %s" % str(e))
+ except MissingSectionHeaderError:
+ fcntl.flock(fp.fileno(), fcntl.LOCK_UN)
+ fp.close()
+ f=open(serial_file,"r")
+ r = f.readline()
+ f.close()
+ cur_serial = int(r) + 1
+ fp = open(serial_file, "w")
+ fcntl.flock(fp.fileno(), fcntl.LOCK_EX)
+ parser.add_section('selfsign')
+ parser.set('selfsign', 'nextreplica', 500000)
+ parser.set('selfsign', 'replicainterval', 500000)
else:
fp = open(serial_file, "w")
fcntl.flock(fp.fileno(), fcntl.LOCK_EX)