Update cmd_rm.py : Ask user to confirm and add more exception handler 42/89042/1
authorDonghoon Shin <dhs.shin@samsung.com>
Wed, 21 Sep 2016 23:49:03 +0000 (08:49 +0900)
committerDonghoon Shin <dhs.shin@samsung.com>
Wed, 21 Sep 2016 23:49:03 +0000 (08:49 +0900)
Change-Id: I5fcab6d7547ff370525d3fd8404f2dffb838d3a8

CHANGES.txt
README.md
debian/changelog
litmus/__init__.py
litmus/cmds/cmd_rm.py

index 7b1efa5df415e22df3661c330ec42ddcfccb96f9..d5af636e15b8ebd681cef76b85075431f54e58ec 100644 (file)
@@ -31,3 +31,7 @@ Version 0.3.0   21 Sep 2016
 - Add projects/topology param at command prompt
 - Support multiple mock devices in topology
 - Add global lock for mock device type
+
+Version 0.3.1   22 Sep 2016
+---------------------------
+- Update cmd_rm handler
index 1abbb1af4d4370465267bb183f7d6e6d404bc5dc..614c979169fa4d5748b401685253a8039c623985 100644 (file)
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Buliding & installing
 
    $ mv litmus litmus-0.3.0
    
-   $ tar cvfz litmus-0.3.0.orig.tar.gz litmus-0.3.0
+   $ tar cvfz litmus_0.3.0.orig.tar.gz litmus-0.3.0
 
 1. Build a deb package with debuild
 
index 1cdce254e3f1a7781ba3c77cec83d80d54752796..6c83b990b7248a87ba1a6bf0bb0926df09d8c1f2 100644 (file)
@@ -1,3 +1,9 @@
+litmus (0.3.1-1) unstable; urgency=low
+
+  * Update cmd_rm handler
+
+ -- Donghoon Shin <dhs.shin@samsung.com>  Thu, 22 Sep 2016 07:42:00 +0900
+
 litmus (0.3.0-1) unstable; urgency=low
 
   * Update projects/topology file location
index 724e4752dcdb5647365c405341eff190312a6afb..3cb3ccd35a525100342c8c322d21d628074e0391 100644 (file)
@@ -14,7 +14,7 @@
 # limitations under the License.
 import os
 
-__version__ = '0.3.0'
+__version__ = '0.3.1'
 _homedir_ = os.path.expanduser('~')
 _confdir_ = os.path.join(_homedir_, '.litmus')
 _duts_ = os.path.join(_confdir_, 'topology')
index 1321f9d1b5cceec622b0536edd1f6b46842fae63..ca0d6364c4694209fa176ca8ccf1aeaa2e0f3554 100755 (executable)
@@ -24,8 +24,17 @@ def main(args):
     configparser.read(args.projects)
 
     if args.project in configparser.sections():
+
+        yn = input('Do you really want to remove {0}? (y/N) '
+                   .format(args.project))
+        if not yn or yn.capitalize().startswith('N'):
+            return
+
         path = configparser.get(args.project, 'path')
-        shutil.rmtree(path)
+        try:
+            shutil.rmtree(path)
+        except FileNotFoundError:
+            logging.debug('{0} does not exists'.format(path))
 
         configparser.remove_section(args.project)
         with open(args.projects, 'w') as f: