Пример #1
0
 def docker_exe(self):
     """
     Return the docker executable to use, using the service configuration
     docker_exe as the first choice, and a docker.io or docker exe found
     in PATH as a fallback.
     """
     if capabilities.has("node.x.docker.io"):
         return "docker.io"
     if capabilities.has("node.x.docker"):
         return "docker"
     raise ex.InitError("docker executable not found")
Пример #2
0
    def check_stat(self):
        if not capabilities.has("node.x.stat"):
            return True

        if self.device is None:
            return True

        proc = subprocess.Popen(['stat', self.device],
                                stderr=subprocess.PIPE,
                                stdout=subprocess.PIPE)
        for retry in range(self.stat_timeout*10, 0, -1):
            if proc.poll() is None:
                time.sleep(0.1)
            else:
                return True
        try:
            proc.kill()
        except OSError:
            pass
        return False
Пример #3
0
 def dockerd_exe(self):
     if capabilities.has("node.x.dockerd"):
         return "dockerd"
     else:
         raise ex.InitError("dockerd executable not found")
Пример #4
0
 def has_capability(self, cap):
     return capabilities.has("drivers.resource.%s" % cap)