Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
cobbler.21408
detect-parallel-cobbler-sync.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File detect-parallel-cobbler-sync.patch of Package cobbler.21408
diff -urN cobbler-2.6.6.orig/cobbler/action_sync.py cobbler-2.6.6/cobbler/action_sync.py --- cobbler-2.6.6.orig/cobbler/action_sync.py 2014-10-19 13:25:16.000000000 +0200 +++ cobbler-2.6.6/cobbler/action_sync.py 2018-05-08 14:10:19.556736071 +0200 @@ -94,6 +94,32 @@ if not os.path.exists(self.bootloc): utils.die(self.logger,"cannot find directory: %s" % self.bootloc) + piddir = "/tmp/cobbler-sync" + pidfile = piddir + "/pid" + try: + os.mkdir(piddir) + except(OSError): + if os.path.exists(piddir): + if os.path.exists(pidfile): + with open(pidfile, 'r') as f: + pidstr = f.read() + f.close() + pid = int(pidstr) + try: + os.kill(pid, 0) + self.logger.info("Another instance running!") + return False + except(OSError): + self.logger.info("Stale lock file found! Removing...") + os.remove(pidfile) + else: + self.logger.info("lockdir creation failed") + return False + + pidfd = os.open(pidfile, os.O_CREAT|os.O_WRONLY) + os.write(pidfd, str(os.getpid())) + os.close(pidfd) + self.logger.info("running pre-sync triggers") # run pre-triggers... @@ -154,6 +180,9 @@ utils.run_triggers(self.api, None, "/var/lib/cobbler/triggers/sync/post/*", logger=self.logger) utils.run_triggers(self.api, None, "/var/lib/cobbler/triggers/change/*", logger=self.logger) + os.remove(pidfile) + os.rmdir(piddir) + return True def make_tftpboot(self):
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor