def get_oc_provider(self, dryrun=False, artifacts=[]):
     """
     Get OpenshiftProvider instance
     """
     op = OpenshiftProvider({}, '.', dryrun)
     op.artifacts = artifacts
     op.access_token = 'test'
     op.init()
     return op
예제 #2
0
파일: base.py 프로젝트: yileye/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: An instance of atomicapp.nulecule.config.Config
            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.globals, './', 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_nulecule_data(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)