mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 19:07:36 -02:30
clean up commented code
This commit is contained in:
@@ -1314,8 +1314,12 @@ class RunProjectUpdate(BaseTask):
|
|||||||
return OutputEventFilter(stdout_handle, raw_callback=raw_callback)
|
return OutputEventFilter(stdout_handle, raw_callback=raw_callback)
|
||||||
|
|
||||||
def release_lock(self, instance):
|
def release_lock(self, instance):
|
||||||
# May raise IOError
|
try:
|
||||||
fcntl.flock(self.lock_fd, fcntl.LOCK_UN)
|
fcntl.flock(self.lock_fd, fcntl.LOCK_UN)
|
||||||
|
except IOError as e:
|
||||||
|
logger.error("I/O error({0}) while trying to open lock file [{1}]: {2}".format(e.errno, instance.get_lock_file(), e.strerror))
|
||||||
|
os.close(self.lock_fd)
|
||||||
|
raise
|
||||||
|
|
||||||
os.close(self.lock_fd)
|
os.close(self.lock_fd)
|
||||||
self.lock_fd = None
|
self.lock_fd = None
|
||||||
@@ -1328,16 +1332,21 @@ class RunProjectUpdate(BaseTask):
|
|||||||
if lock_path is None:
|
if lock_path is None:
|
||||||
raise RuntimeError(u'Invalid lock file path')
|
raise RuntimeError(u'Invalid lock file path')
|
||||||
|
|
||||||
# May raise IOError
|
try:
|
||||||
self.lock_fd = os.open(lock_path, os.O_RDONLY | os.O_CREAT)
|
self.lock_fd = os.open(lock_path, os.O_RDONLY | os.O_CREAT)
|
||||||
|
except OSError as e:
|
||||||
|
logger.error("I/O error({0}) while trying to open lock file [{1}]: {2}".format(e.errno, lock_path, e.strerror))
|
||||||
|
raise
|
||||||
|
|
||||||
# May raise IOError
|
try:
|
||||||
fcntl.flock(self.lock_fd, fcntl.LOCK_EX)
|
fcntl.flock(self.lock_fd, fcntl.LOCK_EX)
|
||||||
|
except IOError as e:
|
||||||
|
os.close(self.lock_fd)
|
||||||
|
logger.error("I/O error({0}) while trying to aquire lock on file [{1}]: {2}".format(e.errno, lock_path, e.strerror))
|
||||||
|
raise
|
||||||
|
|
||||||
def pre_run_hook(self, instance, **kwargs):
|
def pre_run_hook(self, instance, **kwargs):
|
||||||
if instance.launch_type == 'sync':
|
if instance.launch_type == 'sync':
|
||||||
#from celery.contrib import rdb
|
|
||||||
#rdb.set_trace()
|
|
||||||
self.acquire_lock(instance)
|
self.acquire_lock(instance)
|
||||||
|
|
||||||
def post_run_hook(self, instance, status, **kwargs):
|
def post_run_hook(self, instance, status, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user