From 91491c37650cfea665e5fabb6137886f34ed105f Mon Sep 17 00:00:00 2001 From: Pavel Šimerda Date: Jun 24 2014 13:16:44 +0000 Subject: Resolves: #1112248 - serialize the script instances --- diff --git a/dnssec-trigger-0.12-nm-script.patch b/dnssec-trigger-0.12-nm-script.patch index 6f6bfa7..7b5a146 100644 --- a/dnssec-trigger-0.12-nm-script.patch +++ b/dnssec-trigger-0.12-nm-script.patch @@ -1,8 +1,8 @@ diff --git a/dnssec-trigger-script.in b/dnssec-trigger-script.in -index b572dd1..d5d25c9 100644 +index b572dd1..a275806 100644 --- a/dnssec-trigger-script.in +++ b/dnssec-trigger-script.in -@@ -6,7 +6,7 @@ +@@ -6,17 +6,17 @@ """ from gi.repository import NMClient @@ -10,8 +10,10 @@ index b572dd1..d5d25c9 100644 +import os, sys, shutil, glob, subprocess import logging, logging.handlers import socket, struct ++import lockfile + + DEVNULL = open("/dev/null", "wb") -@@ -15,8 +15,7 @@ DEVNULL = open("/dev/null", "wb") log = logging.getLogger() log.setLevel(logging.INFO) log.addHandler(logging.handlers.SysLogHandler()) @@ -21,7 +23,7 @@ index b572dd1..d5d25c9 100644 # NetworkManager reportedly doesn't pass the PATH environment variable. os.environ['PATH'] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" -@@ -53,18 +52,17 @@ class ConnectionList: +@@ -53,18 +53,17 @@ class ConnectionList: nm_connections = None @@ -44,7 +46,7 @@ index b572dd1..d5d25c9 100644 return "".format(list(self), **vars(self)) def __iter__(self): -@@ -190,7 +188,7 @@ class UnboundZoneConfig: +@@ -190,7 +189,7 @@ class UnboundZoneConfig: if fields.pop(0) in ('forward', 'forward:'): fields.pop(0) secure = False @@ -53,7 +55,7 @@ index b572dd1..d5d25c9 100644 secure = True fields.pop(0) self.cache[name] = set(fields[3:]), secure -@@ -255,7 +253,7 @@ class Store: +@@ -255,7 +254,7 @@ class Store: line = line.strip() if line: self.cache.add(line) @@ -62,7 +64,7 @@ index b572dd1..d5d25c9 100644 pass log.debug(self) -@@ -277,10 +275,16 @@ class Store: +@@ -277,10 +276,16 @@ class Store: log.debug(self) def update(self, zones): @@ -82,7 +84,7 @@ index b572dd1..d5d25c9 100644 def remove(self, zone): """Remove zone from the cache.""" -@@ -309,7 +313,7 @@ class GlobalForwarders: +@@ -309,7 +314,7 @@ class GlobalForwarders: line = line.strip() if line: self.cache.add(line) @@ -91,7 +93,7 @@ index b572dd1..d5d25c9 100644 pass class Application: -@@ -328,17 +332,24 @@ class Application: +@@ -328,32 +333,40 @@ class Application: except AttributeError: self.usage() self.config = Config() @@ -118,7 +120,17 @@ index b572dd1..d5d25c9 100644 return True def usage(self): -@@ -353,7 +364,7 @@ class Application: + raise UserError("Usage: dnssec-trigger-script [--debug] [--async] --prepare|--update|--update-global-forwarders|--update-connection-zones|--cleanup") + + def run(self): +- log.debug("Running: {}".format(self.method.__name__)) +- self.method() ++ with lockfile.FileLock("/var/run/dnssec-trigger/dnssec-trigger"): ++ log.debug("Running: {}".format(self.method.__name__)) ++ self.method() + + def run_prepare(self): + """Prepare for dnssec-trigger.""" if not self.nm_handles_resolv_conf(): log.info("Backing up /etc/resolv.conf") @@ -127,7 +139,7 @@ index b572dd1..d5d25c9 100644 def run_cleanup(self): """Clean up after dnssec-trigger.""" -@@ -361,6 +372,18 @@ class Application: +@@ -361,6 +374,18 @@ class Application: stored_zones = Store('zones') unbound_zones = UnboundZoneConfig() @@ -146,7 +158,7 @@ index b572dd1..d5d25c9 100644 log.debug("clearing unbound configuration") for zone in stored_zones: unbound_zones.remove(zone) -@@ -370,11 +393,14 @@ class Application: +@@ -370,11 +395,14 @@ class Application: log.debug("recovering /etc/resolv.conf") subprocess.check_call(["chattr", "-i", "/etc/resolv.conf"]) if not self.nm_handles_resolv_conf(): @@ -163,7 +175,7 @@ index b572dd1..d5d25c9 100644 else: subprocess.check_call(["/etc/init.d/NetworkManager", "restart"]) -@@ -387,7 +413,7 @@ class Application: +@@ -387,7 +415,7 @@ class Application: subprocess.check_call(["dnssec-trigger-control", "status"], stdout=DEVNULL, stderr=DEVNULL) @@ -172,7 +184,7 @@ index b572dd1..d5d25c9 100644 servers = Store('servers') if servers.update(sum((connection.servers for connection in default_connections), [])): -@@ -399,7 +425,7 @@ class Application: +@@ -399,7 +427,7 @@ class Application: def run_update_connection_zones(self): """Configures forward zones in the unbound using unbound-control.""" diff --git a/dnssec-trigger.spec b/dnssec-trigger.spec index 52f940e..6303f2e 100644 --- a/dnssec-trigger.spec +++ b/dnssec-trigger.spec @@ -3,7 +3,7 @@ Summary: NetworkManager plugin to update/reconfigure DNSSEC resolving Name: dnssec-trigger Version: 0.12 -Release: 10%{?dist} +Release: 11%{?dist} License: BSD Url: http://www.nlnetlabs.nl/downloads/dnssec-trigger/ Source0: http://www.nlnetlabs.nl/downloads/dnssec-trigger/%{name}-%{version}.tar.gz @@ -30,7 +30,7 @@ Patch2: dnssec-trigger-0.12-nm-script.patch Patch3: dnssec-trigger-0.12-service.patch Requires(postun): initscripts -Requires: ldns >= 1.6.10, NetworkManager, NetworkManager-glib, unbound, xdg-utils +Requires: ldns >= 1.6.10, NetworkManager, NetworkManager-glib, unbound, xdg-utils, python-lockfile Requires(pre): shadow-utils BuildRequires: desktop-file-utils systemd-units, openssl-devel, ldns-devel BuildRequires: gtk2-devel, NetworkManager-devel @@ -133,6 +133,9 @@ fi %systemd_postun_with_restart %{name}d.service %changelog +* Tue Jun 24 2014 Pavel Šimerda - 0.12-11 +- Resolves: #1112248 - serialize the script instances + * Tue Jun 24 2014 Pavel Šimerda - 0.12-10 - Resolves: #1112248 - fix a typo