Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 922912 Details for
Bug 1125261
dnssec-trigger-script: use fcntl.flock instead of lockfile
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
fix
0001-avoid-stale-locks-by-using-fcntl.patch (text/plain), 1.88 KB, created by
Pavel Šimerda (pavlix)
on 2014-07-31 13:04:57 UTC
(
hide
)
Description:
fix
Filename:
MIME Type:
Creator:
Pavel Šimerda (pavlix)
Created:
2014-07-31 13:04:57 UTC
Size:
1.88 KB
patch
obsolete
>From 92f64ef6b330481ac18c01af132c47d385ae20e7 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Pavel=20=C5=A0imerda?= <psimerda@redhat.com> >Date: Thu, 17 Jul 2014 09:13:39 +0200 >Subject: [PATCH 1/2] avoid stale locks by using fcntl > >--- > dnssec-trigger-script.in | 23 ++++++++++++++++++++--- > 1 file changed, 20 insertions(+), 3 deletions(-) > >diff --git a/dnssec-trigger-script.in b/dnssec-trigger-script.in >index 9ae5e75..32d7749 100644 >--- a/dnssec-trigger-script.in >+++ b/dnssec-trigger-script.in >@@ -6,10 +6,9 @@ > """ > > from gi.repository import NMClient >-import os, sys, shutil, glob, subprocess >+import os, sys, fcntl, shutil, glob, subprocess > import logging, logging.handlers > import socket, struct >-import lockfile > > DEVNULL = open("/dev/null", "wb") > >@@ -24,6 +23,24 @@ os.environ['PATH'] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/b > class UserError(Exception): > pass > >+class Lock: >+ """Lock used to serialize the script""" >+ >+ path = "/var/run/dnssec-trigger/lock" >+ >+ def __init__(self): >+ # We don't use os.makedirs(..., exist_ok=True) to ensure Python 2 compatibility >+ dirname = os.path.dirname(self.path) >+ if not os.path.exists(dirname): >+ os.makedirs(dirname) >+ self.lock = open(self.path, "w") >+ >+ def __enter__(self): >+ fcntl.lockf(self.lock, fcntl.LOCK_EX) >+ >+ def __exit__(self, t, v, tb): >+ fcntl.lockf(self.lock, fcntl.LOCK_UN) >+ > class Config: > """Global configuration options""" > >@@ -357,7 +374,7 @@ class Application: > raise UserError("Usage: dnssec-trigger-script [--debug] [--async] --prepare|--update|--update-global-forwarders|--update-connection-zones|--cleanup") > > def run(self): >- with lockfile.FileLock("/var/run/dnssec-trigger/dnssec-trigger"): >+ with Lock(): > log.debug("Running: {}".format(self.method.__name__)) > self.method() > >-- >1.8.5.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1125261
: 922912