Example #1
0
 def driver(self):
     return (
         get_driver_from_expression(
             self.params.driver,
             get_driver,
             Provider,
             self.extra_drivers,
             self.root)
     )
Example #2
0
 def _get_source_container(self):
     try:
         return self._get_source_container_from_string()
     except errors.TypeError:
         driver = get_driver_from_expression(
             self.params.source, get_driver, Provider, self.extra_drivers, self.root, ignore=("container", ))
         container = driver.get_container(
             self.params.source.container.as_string())
         return container
Example #3
0
 def _get_source_container(self):
     try:
         return self._get_source_container_from_string()
     except errors.TypeError:
         driver = get_driver_from_expression(self.params.source,
                                             get_driver,
                                             Provider,
                                             self.extra_drivers,
                                             self.root,
                                             ignore=("container", ))
         container = driver.get_container(
             self.params.source.container.as_string())
         return container
Example #4
0
    def _get_destination_container(self):
        driver = get_driver_from_expression(
            self.params.destination, get_driver, Provider, self.extra_drivers, self.root, ignore=("container", ))

        container_name = self.params.destination.container.as_string()
        changed = False
        try:
            container = driver.get_container(container_name=container_name)
        except ContainerDoesNotExistError:
            if self.root.readonly:
                return True, None
            with self.root.ui.throbber("Create container '%s'" % container_name):
                if self.root.simulate:
                    return True, None
                container = driver.create_container(
                    container_name=container_name)
                changed = True
        return changed, container
Example #5
0
    def _get_destination_container(self):
        driver = get_driver_from_expression(self.params.destination,
                                            get_driver,
                                            Provider,
                                            self.extra_drivers,
                                            self.root,
                                            ignore=("container", ))

        container_name = self.params.destination.container.as_string()
        changed = False
        try:
            container = driver.get_container(container_name=container_name)
        except ContainerDoesNotExistError:
            if self.root.readonly:
                return True, None
            with self.root.ui.throbber("Create container '%s'" %
                                       container_name):
                if self.root.simulate:
                    return True, None
                container = driver.create_container(
                    container_name=container_name)
                changed = True
        return changed, container