Remove stopped containers.

@param bool|false $force
@param bool|false $remove_volumes
@return mixed
@throws \Exception
496477
public static function rm($force = false, $remove_volumes = false)
    {
        $args = [];
        if ($force) {
            $args[] = '-f';
        }
        if ($remove_volumes) {
            $args[] = '-v';
        }
        return self::runCommand('rm', $args);
    }
343869
def detach(self):
        
        attachments = self.attachments
        if not attachments:
            # Not attached; no error needed, just return
            return
        # A volume can only be attached to one device at a time, but for some
        # reason this is a list instead of a singular value
        att = attachments[0]
        instance_id = att["server_id"]
        attachment_id = att["id"]
        try:
            self._nova_volumes.delete_server_volume(instance_id, attachment_id)
        except Exception as e:
            raise exc.VolumeDetachmentFailed("%s" % e)
541144
public function removeAction(Request $request)
    {
        $container = $this->findContainerByRequest($request);
        $content = $container->getContent();

        try {
            $this->getEditor()->getContainerManager()->delete($container);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        // Stores id for front removal
        $removedId = $this->getViewBuilder()->buildContainer($container)->getAttributes()->getId();

        $this->validate($content);
        $this->persist($content);

        $data = [
            'removed' => [$removedId],
            //'contents' => [$this->getViewBuilder()->buildContent($content)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_LAYOUT);
    }
546300
def remove_container(self, container_id, force=False):
        
        logger.info("removing container '%s' from filesystem", container_id)
        logger.debug("container_id = '%s'", container_id)
        self.d.remove_container(container_id, force=force)
839581
public function remove(string $name, bool $force = false)
    {
        return $this->curl->delete($this->base_url.'/'.$name.'?'.http_build_query([
                    'force' => $force,
                ]
            )
        );
    }
71219
async def detach(self, device, force=False):
        
        device = self._find_device(device)
        if not self.is_handleable(device):
            self._log.warn(_('not detaching {0}: unhandled device', device))
            return False
        drive = device.root
        if not drive.is_detachable:
            self._log.warn(_('not detaching {0}: drive not detachable', drive))
            return False
        if force:
            await self.auto_remove(drive, force=True)
        self._log.debug(_('detaching {0}', device))
        await drive.detach()
        self._log.info(_('detached {0}', device))
        return True
937618
public function remove()
    {

        $removed = 0;
        foreach( func_get_args() as $arg ){

            // is this a container?
            if( $arg instanceof Container ) {

                $originalCount = $this->count();
                $this->collection = array_diff_key( $this->collection, $arg->collection );
                $removed += ( $originalCount - $this->count() );

            } else {

                // use array search
                $search = $this->search( $arg, true );

                foreach( $search as $value ){
                    if( $value !== false ){
                        $removed++;
                        $this->offsetUnset( $value );
                    }
                }

            }

        }
        $this->rewind();
        return $removed;

    }
255787
def destroy_volumes(role):
    
    state = dcos_agents_state()
    if not state or 'slaves' not in state.keys():
        return False
    all_success = True
    for agent in state['slaves']:
        if not destroy_volume(agent, role):
            all_success = False
    return all_success
176481
protected function remove($path, $force = false) {
		$stat = $this->stat($path);
		
		if (empty($stat)) {
			return $this->setError(elFinder::ERROR_RM, $this->path($path), elFinder::ERROR_FILE_NOT_FOUND);
		}
		
		$stat['realpath'] = $path;
		$this->rmTmb($stat);
		$this->clearcache();
		
		if (!$force && !empty($stat['locked'])) {
			return $this->setError(elFinder::ERROR_LOCKED, $this->path($path));
		}
		
		if ($stat['mime'] == 'directory') {
			$ret = $this->delTree($this->convEncIn($path));
			$this->convEncOut();
			if (!$ret) {
				return $this->setError(elFinder::ERROR_RM, $this->path($path));
			}
		} else {
			if ($this->convEncOut(!$this->_unlink($this->convEncIn($path)))) {
				return $this->setError(elFinder::ERROR_RM, $this->path($path));
			}
		}

		$this->removed[] = $stat;
		return true;
	}
1095926
public function stopProcessesCommand(bool $force = false)
    {
        $count = $this->processManager->killAllProcesses($force);
        $this->outputLine();

        if ($force === true) {
            $this->outputFormatted('<comment>force stopped %s</comment>', [
                $count === 1 ? '1 process' : $count . ' processes'
            ]);
        } else {
            $this->outputFormatted('<success>stopped %s</success>', [
                $count === 1 ? '1 process' : $count . ' processes'
            ]);
        }

        $this->outputLine();
        $this->outputFormatted('The processes will automatically restart during the next request');
        $this->outputLine();
    }
168698
async def eject(self, device, force=False):
        
        device = self._find_device(device)
        if not self.is_handleable(device):
            self._log.warn(_('not ejecting {0}: unhandled device'))
            return False
        drive = device.drive
        if not (drive.is_drive and drive.is_ejectable):
            self._log.warn(_('not ejecting {0}: drive not ejectable', drive))
            return False
        if force:
            # Can't autoremove 'device.drive', because that will be filtered
            # due to block=False:
            await self.auto_remove(device.root, force=True)
        self._log.debug(_('ejecting {0}', device))
        await drive.eject()
        self._log.info(_('ejected {0}', device))
        return True
974955
public function delete($name, $force = false)
    {
        $arg = ($force === true) ? '-D' : '-d';
        $this->clearAll();
        $this->addCommandName(self::BRANCH_COMMAND);
        $this->addCommandArgument($arg);
        $this->addCommandSubject($name);

        return $this->getCommand();
    }
432989
def delete(self, force=False):
        
        if not force and self._state not in (
            Bundle.INSTALLED,
            Bundle.RESOLVED,
            Bundle.STOPPING,
        ):
            _logger.warning("Trying to delete an active framework")
            return False

        return FrameworkFactory.delete_framework(self)
125833
def detach(gandi, resource, background, force):
    
    resource = sorted(tuple(set(resource)))
    if not force:
        proceed = click.confirm('Are you sure you want to detach %s?' %
                                ', '.join(resource))
        if not proceed:
            return

    result = gandi.disk.detach(resource, background)
    if background:
        gandi.pretty_echo(result)

    return result
71332
public function purge(bool $force, OutputInterface $output)
    {
        $tables = $this->db->getSchemaManager()->listTableNames();
        foreach ($tables as $table) {
            $output->writeln("<info>Dropping table $table</info>");
            if ($force) {
                $this->db->getSchemaManager()->dropTable($table);
            }
        }

        if (!$force) {
            $output->writeln('<comment>No query was run, use the --force option to run the queries</comment>');
        } else {
            $output->writeln('<comment>Queries were successfully run against the database</comment>');
        }

        $this->update($force, $output);
    }
1037564
public function delete(Model\RowInterface $row, $force = false)
    {
        $container = $row->getContainer();

        // Skip checks if forced
        if (!$force) {
            // Don't remove container's only row or named row
            if ($row->isAlone() || $row->isNamed()) {
                throw new InvalidOperationException(
                    "The row can't be removed because it is named or the parent container does not have enough children."
                );
            }

            // Don't remove standalone row
            if (null === $container) {
                throw new InvalidOperationException(
                    "The row does not belong to a container and therefore can't be removed."
                );
            }
        }

        $container->removeRow($row);

        $this->editor
            ->getContainerManager()
            ->fixRowsPositions($container);

        return $row;
    }
879356
public static function deleteTree($dir, $force = false, $delete_self = true)
    {
        if (is_dir($dir)) {
            $files = array_diff(scandir($dir), array('.', '..'));
            if (!empty($files) && !$force) {
                throw new \Exception("Directory not empty, can not delete without force option.");
            }
            foreach ($files as $file) {
                $delPath = $dir . DIRECTORY_SEPARATOR . $file;
                if (is_dir($delPath)) {
                    static::deleteTree($delPath, $force, true);
                } elseif (is_file($delPath)) {
                    unlink($delPath);
                } else {
                    // bad path?
                }
            }
            if ($delete_self) {
                rmdir($dir);
            }
        }
    }