Bug#728750: add a mandatory option to lxc-detroy to really remove the container

2013-11-04 Thread Gianluigi Tiesi
Source: lxc
Severity: wishlist
Tags: patch upstream

Hi maintainer,
by using different virtualization system one get used to
call destroy the action of stopping a vm.
In lxc context destroy really means to remove the container.

It would be nice to actually requiring something like -y
to really remove the container.

I known this kind of change can break scripts and may not be
easy accepted, but I think it can avoid some headaches.

I've attached a proposted patch

Regards

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
--- /usr/bin/lxc-destroy.orig	2013-11-05 01:16:06.326585022 +0100
+++ /usr/bin/lxc-destroy	2013-11-05 01:18:41.422587740 +0100
@@ -26,7 +26,7 @@
 #
 
 usage() {
-echo usage: $(basename $0) -n NAME [-f] 2
+echo usage: $(basename $0) -n NAME [-f] -y 2
 }
 
 help() {
@@ -37,6 +37,7 @@
 echo Options: 2
 echo   -n NAME   specify the name of the container 2
 echo   -fstop the container if it is running (rather than abort) 2
+echo   -yrequired to actually remove the container 2
 }
 
 usage_err() {
@@ -53,6 +54,7 @@
 
 . /usr/share/lxc/lxc.functions
 force=0
+really=0
 
 while [ $# -gt 0 ]; do
 opt=$1
@@ -70,6 +72,9 @@
 -f)
 force=1
 ;;
+-y)
+really=1
+;;
 --)
 break
 ;;
@@ -103,6 +108,11 @@
 exit 1
 fi
 
+if [ ! $really -eq 1 ]; then
+echo $(basename $0): -y is required to actually delete the container
+exit 1
+fi
+
 # make sure the container is stopped
 if ! lxc-info -n $lxc_name --state-is STOPPED; then
 if [ $force -eq 1 ]; then


Bug#728750: add a mandatory option to lxc-detroy to really remove the container

2013-11-04 Thread Daniel Baumann
close 728750
thanks

On 11/05/2013 01:26 AM, Gianluigi Tiesi wrote:
 It would be nice to actually requiring something like -y
 to really remove the container.

upstream has several times commented on this and has the stance that
people should just 'learn' it.

if you feel you want to discuss this once again, feel free to do so by
discussing this on lxc-de...@lists.sourceforge.net.

-- 
Address:Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:  daniel.baum...@progress-technologies.net
Internet:   http://people.progress-technologies.net/~daniel.baumann/


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org