diff options
author | Rob Austein <sra@hactrn.net> | 2013-04-19 02:22:57 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2013-04-19 02:22:57 +0000 |
commit | ddfb8c4eb8139b94e1031c6f8555aee4b6287afb (patch) | |
tree | 159b3fce49ac6594fc2ea0b1c327bdd973a990f0 /rpkid/rpki/irdb/zookeeper.py | |
parent | de186b4393ce25cdfb51b1c3240e0326c85890cf (diff) |
Add option to allow setting initial resource validity when configuring
child in rpkic, and teach yamltest to use it.
svn path=/trunk/; revision=5301
Diffstat (limited to 'rpkid/rpki/irdb/zookeeper.py')
-rw-r--r-- | rpkid/rpki/irdb/zookeeper.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/rpkid/rpki/irdb/zookeeper.py b/rpkid/rpki/irdb/zookeeper.py index 6b72a8a8..86aabb08 100644 --- a/rpkid/rpki/irdb/zookeeper.py +++ b/rpkid/rpki/irdb/zookeeper.py @@ -457,7 +457,7 @@ class Zookeeper(object): @django.db.transaction.commit_on_success - def configure_child(self, filename, child_handle = None): + def configure_child(self, filename, child_handle = None, valid_until = None): """ Configure a new child of this RPKI entity, given the child's XML identity file as an input. Extracts the child's data from the @@ -472,7 +472,12 @@ class Zookeeper(object): if child_handle is None: child_handle = c.get("handle") - valid_until = rpki.sundial.now() + rpki.sundial.timedelta(days = 365) + if valid_until is None: + valid_until = rpki.sundial.now() + rpki.sundial.timedelta(days = 365) + else: + valid_until = rpki.sundial.datetime.fromXMLtime(valid_until) + if valid_until < rpki.sundial.now(): + raise PastExpiration, "Specified new expiration time %s has passed" % valid_until self.log("Child calls itself %r, we call it %r" % (c.get("handle"), child_handle)) @@ -791,7 +796,7 @@ class Zookeeper(object): if valid_until is None: valid_until = rpki.sundial.now() + rpki.sundial.timedelta(days = 365) else: - valid_until = rpki.sundial.fromXMLtime(valid_until) + valid_until = rpki.sundial.datetime.fromXMLtime(valid_until) if valid_until < rpki.sundial.now(): raise PastExpiration, "Specified new expiration time %s has passed" % valid_until |