diff options
-rw-r--r-- | rpki/pubd.py | 2 | ||||
-rw-r--r-- | rpki/pubdb/migrations/0003_remove_delta_xml.py | 18 | ||||
-rw-r--r-- | rpki/pubdb/models.py | 13 |
3 files changed, 26 insertions, 7 deletions
diff --git a/rpki/pubd.py b/rpki/pubd.py index dbc9c12d..9813703c 100644 --- a/rpki/pubd.py +++ b/rpki/pubd.py @@ -290,7 +290,7 @@ class main(object): else: if delta is not None: - self.session.synchronize_rrdp_files(self.rrdp_publication_base, self.rrdp_base_uri) + self.session.synchronize_rrdp_files(self.rrdp_publication_base, self.rrdp_base_uri, delta) delta.update_rsync_files(self.publication_base) request.send_cms_response(rpki.publication.cms_msg().wrap(r_msg, self.pubd_key, self.pubd_cert, self.pubd_crl)) diff --git a/rpki/pubdb/migrations/0003_remove_delta_xml.py b/rpki/pubdb/migrations/0003_remove_delta_xml.py new file mode 100644 index 00000000..e2c0ce16 --- /dev/null +++ b/rpki/pubdb/migrations/0003_remove_delta_xml.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('pubdb', '0002_auto_20160221_0617'), + ] + + operations = [ + migrations.RemoveField( + model_name='delta', + name='xml', + ), + ] diff --git a/rpki/pubdb/models.py b/rpki/pubdb/models.py index 580cb309..644f3e3f 100644 --- a/rpki/pubdb/models.py +++ b/rpki/pubdb/models.py @@ -173,21 +173,23 @@ class Session(models.Model): return ElementToString(xml, pretty_print = True) - def synchronize_rrdp_files(self, rrdp_publication_base, rrdp_base_uri): + def synchronize_rrdp_files(self, rrdp_publication_base, rrdp_base_uri, delta): """ Write current RRDP files to disk, clean up old files and directories. """ current_filenames = self.keep_these_files.copy() - for delta in self.delta_set.all(): - self._write_rrdp_file(delta.fn, delta.xml, rrdp_publication_base) - current_filenames.add(delta.fn) - snapshot_xml, snapshot_hash = self._generate_snapshot() self._write_rrdp_file(self.snapshot_fn, snapshot_xml, rrdp_publication_base) current_filenames.add(self.snapshot_fn) + self._write_rrdp_file(delta.fn, delta.xml, rrdp_publication_base) + current_filenames.add(delta.fn) + + for delta in self.delta_set.all(): + current_filenames.add(delta.fn) + self._write_rrdp_file(self.notification_fn, self._generate_update_xml(rrdp_base_uri, snapshot_hash), rrdp_publication_base, overwrite = True) @@ -207,7 +209,6 @@ class Session(models.Model): class Delta(models.Model): serial = models.BigIntegerField() - xml = models.TextField() hash = models.CharField(max_length = 64) expires = SundialField() session = models.ForeignKey(Session) |