示例#1
0
文件: base.py 项目: schmerk/atomicapp
    def unpack(cls, image, dest, config=None, namespace=GLOBAL_CONF,
               nodeps=False, dryrun=False, update=False):
        """
        Pull and extracts a docker image to the specified path, and loads
        the Nulecule application from the path.

        Args:
            image (str): A Docker image name.
            dest (str): Destination path where Nulecule data from Docker
                        image should be extracted.
            config (dict): Dictionary, config data for Nulecule application.
            namespace (str): Namespace for Nulecule application.
            nodeps (bool): Don't pull external Nulecule dependencies when
                           True.
            update (bool): Don't update contents of destination directory
                           if False, else update it.

        Returns:
            A Nulecule instance, or None in case of dry run.
        """
        logger.info('Unpacking image: %s to %s' % (image, dest))
        docker_handler = DockerHandler(dryrun=dryrun)
        docker_handler.pull(image)
        docker_handler.extract(image, APP_ENT_PATH, dest, update)
        return cls.load_from_path(
            dest, config=config, namespace=namespace, nodeps=nodeps,
            dryrun=dryrun, update=update)
示例#2
0
    def unpack(cls, image, dest, config=None, namespace=GLOBAL_CONF,
               nodeps=False, dryrun=False, update=False):
        """
        Pull and extracts a docker image to the specified path, and loads
        the Nulecule application from the path.

        Args:
            image (str): A Docker image name.
            dest (str): Destination path where Nulecule data from Docker
                        image should be extracted.
            config (dict): Dictionary, config data for Nulecule application.
            namespace (str): Namespace for Nulecule application.
            nodeps (bool): Don't pull external Nulecule dependencies when
                           True.
            update (bool): Don't update contents of destination directory
                           if False, else update it.

        Returns:
            A Nulecule instance, or None in case of dry run.
        """
        logger.info('Unpacking image: %s to %s' % (image, dest))
        if Utils.running_on_openshift():
            # pass general config data containing provider specific data
            # to Openshift provider
            op = OpenShiftProvider(config.get('general', {}), './', False)
            op.artifacts = []
            op.init()
            op.extract(image, APP_ENT_PATH, dest, update)
        else:
            docker_handler = DockerHandler(dryrun=dryrun)
            docker_handler.pull(image)
            docker_handler.extract(image, APP_ENT_PATH, dest, update)
        return cls.load_from_path(
            dest, config=config, namespace=namespace, nodeps=nodeps,
            dryrun=dryrun, update=update)
示例#3
0
    def unpack(cls,
               image,
               dest,
               config=None,
               namespace=GLOBAL_CONF,
               nodeps=False,
               dryrun=False,
               update=False):
        """
        Pull and extracts a docker image to the specified path, and loads
        the Nulecule application from the path.

        Args:
            image (str): A Docker image name.
            dest (str): Destination path where Nulecule data from Docker
                        image should be extracted.
            config (dict): Dictionary, config data for Nulecule application.
            namespace (str): Namespace for Nulecule application.
            nodeps (bool): Don't pull external Nulecule dependencies when
                           True.
            update (bool): Don't update contents of destination directory
                           if False, else update it.

        Returns:
            A Nulecule instance, or None in case of dry run.
        """
        logger.info('Unpacking image: %s to %s' % (image, dest))
        if Utils.running_on_openshift():
            # pass general config data containing provider specific data
            # to Openshift provider
            op = OpenShiftProvider(config.get('general', {}), './', False)
            op.artifacts = []
            op.init()
            op.extract(image, APP_ENT_PATH, dest, update)
        else:
            docker_handler = DockerHandler(dryrun=dryrun)
            docker_handler.pull(image)
            docker_handler.extract(image, APP_ENT_PATH, dest, update)
            cockpit_logger.info("All dependencies installed successfully.")
        return cls.load_from_path(dest,
                                  config=config,
                                  namespace=namespace,
                                  nodeps=nodeps,
                                  dryrun=dryrun,
                                  update=update)
示例#4
0
    def unpack(cls,
               image,
               dest,
               config=None,
               namespace=GLOBAL_CONF,
               nodeps=False,
               dryrun=False,
               update=False):
        """
        Pull and extracts a docker image to the specified path, and loads
        the Nulecule application from the path.

        Args:
            image (str): A Docker image name.
            dest (str): Destination path where Nulecule data from Docker
                        image should be extracted.
            config (dict): Dictionary, config data for Nulecule application.
            namespace (str): Namespace for Nulecule application.
            nodeps (bool): Don't pull external Nulecule dependencies when
                           True.
            update (bool): Don't update contents of destination directory
                           if False, else update it.

        Returns:
            A Nulecule instance, or None in case of dry run.
        """
        logger.info('Unpacking image: %s to %s' % (image, dest))
        docker_handler = DockerHandler(dryrun=dryrun)
        docker_handler.pull(image)
        docker_handler.extract(image, APP_ENT_PATH, dest, update)
        return cls.load_from_path(dest,
                                  config=config,
                                  namespace=namespace,
                                  nodeps=nodeps,
                                  dryrun=dryrun,
                                  update=update)