[sysadmin-bin] Copy signed zones to /var/lib/nsd/master



commit 120b7a0b85fc4c6a8760ee62c2e343f8ba9efefc
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Mon Mar 7 20:02:32 2022 +0100

    Copy signed zones to /var/lib/nsd/master

 certbot/auth-hook    | 6 ++++++
 certbot/cleanup-hook | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/certbot/auth-hook b/certbot/auth-hook
index 33ead03..c788fb5 100755
--- a/certbot/auth-hook
+++ b/certbot/auth-hook
@@ -1,6 +1,7 @@
 #!/usr/bin/python3
 
 import os
+import shutil
 import subprocess
 import sys
 import tempfile
@@ -57,6 +58,11 @@ def main():
 
         repo.remotes[0].push(["refs/heads/master:refs/heads/master"])
 
+        for built_zone in os.listdir(f"{tmpdir}/built"):
+            zone_name, zone_ext = os.path.splitext(built_zone)
+            if zone_ext == "signed":
+                shutil.copyfile(f"{tmpdir}/built/{built_zone}", f"/var/lib/nsd/master/{zone_name}")
+
         subprocess.run(["sudo", "/usr/sbin/nsd-control", "reload"], check=True)
         subprocess.run(["sudo", "/usr/sbin/nsd-control", "notify"], check=True)
 
diff --git a/certbot/cleanup-hook b/certbot/cleanup-hook
index 6c182e0..01b097c 100755
--- a/certbot/cleanup-hook
+++ b/certbot/cleanup-hook
@@ -1,10 +1,10 @@
 #!/usr/bin/python3
 
 import os
+import shutil
 import subprocess
 import sys
 import tempfile
-import time
 
 import pygit2
 
@@ -61,6 +61,11 @@ def main():
 
         repo.remotes[0].push(["refs/heads/master:refs/heads/master"])
 
+        for built_zone in os.listdir(f"{tmpdir}/built"):
+            zone_name, zone_ext = os.path.splitext(built_zone)
+            if zone_ext == "signed":
+                shutil.copyfile(f"{tmpdir}/built/{built_zone}", f"/var/lib/nsd/master/{zone_name}")
+
         subprocess.run(["sudo", "/usr/sbin/nsd-control", "reload"], check=True)
         subprocess.run(["sudo", "/usr/sbin/nsd-control", "notify"], check=True)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]