Commit 0b5ff71a authored by Jérome Perrin's avatar Jérome Perrin

openoffice: fix psutil usage in _releaseOpenOfficePort

This uses psutil.process_iter to iterate on all processes, but in the meantime
some process might terminate.

As we could observe in the logs:

    2021-04-26 12:53:02 - Cloudooo - DEBUG - Stop Pid - 15816
    Exception in thread Thread-1:
    Traceback (most recent call last):
      File "python2.7/lib/python2.7/", line 801, in __bootstrap_inner
      File "cloudooo-repository/cloudooo/handler/ooo/monitor/", line 60, in run
      File "cloudooo-repository/cloudooo/handler/ooo/application/", line 79, in restart
      File "cloudooo-repository/cloudooo/handler/ooo/application/", line 169, in stop
      File "cloudooo-repository/cloudooo/handler/ooo/application/", line 122, in _releaseOpenOfficePort
        if process.exe() == join(self.office_binary_path, self._bin_soffice):
      File "psutil-5.8.0-py2.7-linux-x86_64.egg/psutil/", line 660, in exe
        exe = self._proc.exe()
      File "psutil-5.8.0-py2.7-linux-x86_64.egg/psutil/", line 1688, in exe
        raise NoSuchProcess(, self._name)
    NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=19382)

Update to catch and ignore such exceptions, and minor refactorings such as:
 - Not calculate the path of openoffice binary in the loop, this is not
   supposed to change.
 - Remove reference to lsof in logged message, this does not use lsof.
 - Catch all exceptions.
parent be6c35c0
Pipeline #15345 failed with stage
in 0 seconds