Exemplo n.º 1
0
    def __init__(self, storage, path, name, manifest, address, container, registry='', on_read=None):

        print "__init", storage, path, name, manifest, address, container

        super(DockerImport, self).__init__(storage)
        self.path = path or os.path.curdir
        self.name = name or os.path.basename(os.path.abspath(self.path))
        self.container_url = container
        if registry:
            self.fullname = '{0}/{1}'.format(registry, self.name)
        else:
            self.fullname = self.name

        self.manifest = manifest

        self.client = docker.Client(address)

        log.debug('checking Dockerfile')
        if not address:
            raise ValueError('Docker address is not specified')

        if on_read is not None:
            if not callable(on_read):
                raise ValueError("on_read must ne callable")
            self._on_read = on_read

        self._last_message = ''
Exemplo n.º 2
0
 def __init__(self):
     self.storage = Service("storage")
     self.good_path = os.path.join(
         os.path.abspath(os.path.dirname(__file__)), "fixtures/docker_app")
     self.broken_path = os.path.join(
         os.path.abspath(os.path.dirname(__file__)),
         "fixtures/broken_docker_app")
     self.docker_address = os.getenv("DOCKER_HOST")
     self.registry_address = os.getenv("DOCKER_REGISTRY")
     if not (self.docker_address and self.registry_address):
         raise SkipTest("Can't do it without Docker or Registry")
     self.client = docker.Client(self.docker_address, io_loop=io)
Exemplo n.º 3
0
    def __init__(self, storage, path, name, manifest, address, registry=''):
        super(DockerUpload, self).__init__(storage)
        self.path = path
        self.name = name or os.path.basename(os.path.abspath(path))
        if registry:
            self.name = '{0}/{1}'.format(registry, self.name)
        print(self.name)

        self.manifest = manifest

        self.client = docker.Client(address)

        if not os.path.exists(os.path.join(path, 'Dockerfile')):
            raise ValueError('Dockerfile not found')
        if not address:
            raise ValueError('Docker address is not specified')