Since we need to compute this from outside utils.py, we change this to a
public function.
Reviewed-by: ultrotter
return 0
-def _DaemonPidFileName(name):
+def DaemonPidFileName(name):
"""Compute a ganeti pid file absolute path, given the daemon name.
"""
"""
pid = os.getpid()
- pidfilename = _DaemonPidFileName(name)
+ pidfilename = DaemonPidFileName(name)
if IsProcessAlive(ReadPidFile(pidfilename)):
raise errors.GenericError("%s contains a live process" % pidfilename)
"""
pid = os.getpid()
- pidfilename = _DaemonPidFileName(name)
+ pidfilename = DaemonPidFileName(name)
# TODO: we could check here that the file contains our pid
try:
RemoveFile(pidfilename)
def setUp(self):
self.dir = tempfile.mkdtemp()
self.f_dpn = lambda name: os.path.join(self.dir, "%s.pid" % name)
- utils._DaemonPidFileName = self.f_dpn
+ utils.DaemonPidFileName = self.f_dpn
def testPidFileFunctions(self):
pid_file = self.f_dpn('test')