diff options
author | Donghoon Shin <dhs.shin@samsung.com> | 2016-09-22 08:49:03 +0900 |
---|---|---|
committer | Donghoon Shin <dhs.shin@samsung.com> | 2016-09-22 08:49:03 +0900 |
commit | eea6240fc6ae11b3692dc09a116a8ad7c2e3f269 (patch) | |
tree | 9d54919eb8efd8689b728b686bb9a8ce87be783a | |
parent | bb81eac85eb522da1cc4b53da7691ab2c7427344 (diff) | |
download | litmus-eea6240fc6ae11b3692dc09a116a8ad7c2e3f269.tar.gz litmus-eea6240fc6ae11b3692dc09a116a8ad7c2e3f269.tar.bz2 litmus-eea6240fc6ae11b3692dc09a116a8ad7c2e3f269.zip |
Update cmd_rm.py : Ask user to confirm and add more exception handler
Change-Id: I5fcab6d7547ff370525d3fd8404f2dffb838d3a8
-rw-r--r-- | CHANGES.txt | 4 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | litmus/__init__.py | 2 | ||||
-rwxr-xr-x | litmus/cmds/cmd_rm.py | 11 |
5 files changed, 22 insertions, 3 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 7b1efa5..d5af636 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 @@ -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 diff --git a/debian/changelog b/debian/changelog index 1cdce25..6c83b99 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/litmus/__init__.py b/litmus/__init__.py index 724e475..3cb3ccd 100644 --- a/litmus/__init__.py +++ b/litmus/__init__.py @@ -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') diff --git a/litmus/cmds/cmd_rm.py b/litmus/cmds/cmd_rm.py index 1321f9d..ca0d636 100755 --- a/litmus/cmds/cmd_rm.py +++ b/litmus/cmds/cmd_rm.py @@ -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: |