Commit acf6ac1e authored by Nicolas Wavrant's avatar Nicolas Wavrant

clammit: download the database once when the slappart is started the first time

The database will be refreshed by cron daily, but we need a way to initialize
the first download without waiting for the first cron to kick in.
parent 6adb55fb
......@@ -15,7 +15,7 @@
[instance.cfg.in]
filename = instance.cfg.in
md5sum = a327c7aebd30df6c59c01078cc0efe3a
md5sum = 83addd63b24d84fad15356276a5db484
[clamd.conf.in]
filename = clamd.conf.in
......
......@@ -115,9 +115,19 @@ context =
section clamconfig clam-config
key clamd_config_file clamd.conf:output
[freshclam-updater]
recipe = slapos.recipe.template
output = ${directory:bin}/freshclam
inline =
#!/bin/sh
if [ ! -f "${directory:var.clamdb}/freshclam.dat" ]; then
{{ clamav.location }}/bin/freshclam --config-file ${freshclam.conf:output}
fi
mode = 700
[freshclam]
recipe = slapos.cookbook:wrapper
command-line = {{ clamav.location }}/bin/freshclam --config-file ${freshclam.conf:output}
command-line = ${freshclam-updater:output}
wrapper-path = ${directory:etc.run}/${:_buildout_section_name_}
[freshclam-database-refresh-time]
......
......@@ -83,6 +83,16 @@ class ClammitTestCase(SlapOSInstanceTestCase):
)
self.assertEqual(r.status_code, 418)
def test_virus_database_is_downloaded_on_instanciation(self):
database_path = os.path.join(
self.computer_partition_root_path,
"var", "clamdb", "freshclam.dat"
)
try:
os.stat(database_path)
except OSError:
raise AssertionError("No database found at %s", database_path)
def test_renew_certificate(self):
def _getpeercert():
# XXX low level way to get the server certificate
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment