(self, container_names=None, force=True)
Provisions the containers of the project.
Provisions the containers of the project.
Provisions the containers of the project .
def provision(self, container_names=None, force=True):
        """ Provisions the containers of the project. """
        # This happens in two phases: local provisioning, then global provisioning.
        # Local provisioning is the provisioning that is declared directly in the
        # `containers` config section. Global provisioning is declared at the root
        # of the config.
        containers = [self.get_container_by_name(name) for name in container_names] \
            if container_names else self.containers
        for container in self._containers_generator(containers=containers):
            container.provision(force=force)

        host = Host.get()
        if not force:
            containers = [c for c in containers if not c.is_provisioned]
        if not containers:
            return

        guests = [Guest.get(c) for c in containers]
        for provisioning_item in self.provisioning_steps:
            provisioning_type = provisioning_item['type'].lower()
            provisioner_class = Provisioner.provisioners.get(provisioning_type)
            if provisioner_class is not None:
                provisioner = provisioner_class(
                    self.homedir, host, guests, provisioning_item)
                logger.info('Global provisioning with {0}'.format(provisioner.name))
                provisioner.provision()

        for guest in guests:
            guest.lxd_container.config['user.lxdock.provisioned'] = 'true'
            guest.lxd_container.save(wait=True)
def provision ( self , container_names = None , force = True ) : # This happens in two phases: local provisioning, then global provisioning. # Local provisioning is the provisioning that is declared directly in the # `containers` config section. Global provisioning is declared at the root # of the config. containers = [ self . get_container_by_name ( name ) for name in container_names ] if container_names else self . containers for container in self . _containers_generator ( containers = containers ) : container . provision ( force = force ) host = Host . get ( ) if not force : containers = [ c for c in containers if not c . is_provisioned ] if not containers : return guests = [ Guest . get ( c ) for c in containers ] for provisioning_item in self . provisioning_steps : provisioning_type = provisioning_item [ 'type' ] . lower ( ) provisioner_class = Provisioner . provisioners . get ( provisioning_type ) if provisioner_class is not None : provisioner = provisioner_class ( self . homedir , host , guests , provisioning_item ) logger . info ( 'Global provisioning with {0}' . format ( provisioner . name ) ) provisioner . provision ( ) for guest in guests : guest . lxd_container . config [ 'user.lxdock.provisioned' ] = 'true' guest . lxd_container . save ( wait = True )