Exemple #1
0
    def __init__(self, *args, **kwargs):

        #############################
        # Temp cleanup for old method

        restart_docker = False

        if os.path.islink(
                '/storage/.config/system.d/service.system.docker.socket'):
            os.remove('/storage/.config/system.d/service.system.docker.socket')
        if os.path.islink('/storage/.config/system.d/docker.socket'):
            os.remove('/storage/.config/system.d/docker.socket')

        if os.path.islink(
                '/storage/.config/system.d/service.system.docker.service'):
            if 'systemd' in os.readlink(
                    '/storage/.config/system.d/service.system.docker.service'):
                os.remove(
                    '/storage/.config/system.d/service.system.docker.service')
                restart_docker = True

        if os.path.islink('/storage/.config/system.d/docker.service'):
            if 'systemd' in os.readlink(
                    '/storage/.config/system.d/docker.service'):
                os.remove('/storage/.config/system.d/docker.service')
                restart_docker = True

        if os.path.islink(
                '/storage/.config/system.d/multi-user.target.wants/service.system.docker.service'
        ):
            if 'systemd' in os.readlink(
                    '/storage/.config/system.d/multi-user.target.wants/service.system.docker.service'
            ):
                os.remove(
                    '/storage/.config/system.d/multi-user.target.wants/service.system.docker.service'
                )
                restart_docker = True

        if restart_docker:
            subprocess.run([
                'systemctl', 'enable',
                '/storage/.kodi/addons/service.system.docker/system.d/service.system.docker.service'
            ],
                           close_fds=True)
            subprocess.run(
                ['systemctl', 'restart', 'service.system.docker.service'],
                close_fds=True)

        # end temp cleanup
        #############################

        monitor = DockerMonitor(self)

        while not monitor.abortRequested():
            try:
                dockermon.watch(print_notification,
                                run=lambda: not monitor.abortRequested())
            except Exception:
                monitor.waitForAbort(1)
        del monitor
Exemple #2
0
 def run(self):
     while self._is_running:
         dockermon.watch(print_notification)
Exemple #3
0
 def run(self):
     while self._is_running:
         dockermon.watch(print_notification)