[prev in list] [next in list] [prev in thread] [next in thread]
List: cobbler-devel
Subject: [PATCH] Add --force-path option to force overwrite of virt-path
From: James Pryor <pryor () bnl ! gov>
Date: 2010-11-29 23:17:52
Message-ID: 4CF434A0.7070909 () bnl ! gov
[Download RAW message or body]
Hello list,
Been learning cobbler/koan and really fond of it.
In koan, I added a '--force-path' option to have it overwrite the
virt-path file location so I can have koan instantiate a VM & use
pre-existing VM image files. Koan's default behavior remains unchanged
and I present the user with a more friendly error message:
"The location %s is an existing file. Consider '--force-path' to
overwrite it."
Thanks,
James
--
James Pryor - pryor@bnl.gov
RHIC/USATLAS Computing Facility
Brookhaven National Laboratory
Physics Dept. - Bldg. 510M
Upton, New York 11973
Tel. : +1 (631) 344 2288
Fax. : +1 (631) 344 7616
https://www.racf.bnl.gov
["0001-Add-force-path-option-to-force-overwrite-of-virt-pat.patch" (text/x-patch)]
> From d96a247f4bea449b0145ac396fb8e4a9510c3e81 Mon Sep 17 00:00:00 2001
From: James Pryor <pryor@bnl.gov>
Date: Mon, 29 Nov 2010 16:25:12 -0500
Subject: [PATCH] Add --force-path option to force overwrite of virt-path location
---
CHANGELOG | 2 ++
koan/app.py | 11 ++++++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 7fa90e8..33e9d46 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
Cobbler CHANGELOG
+- Nov 29 2010
+- (FEAT) --force-path to overwrite virt-path file location
- Apr 27 2010 - 2.0.4
- (BUGF) fetch extra metadata from upstream repositories more safely
diff --git a/koan/app.py b/koan/app.py
index efcfe42..aa33654 100755
--- a/koan/app.py
+++ b/koan/app.py
@@ -152,6 +152,10 @@ def main():
p.add_option("-P", "--virt-path",
dest="virt_path",
help="override virt install location")
+ p.add_option("", "--force-path",
+ dest="force_path",
+ action="store_true",
+ help="Force overwrite of virt install location")
p.add_option("-T", "--virt-type",
dest="virt_type",
help="override virt install type")
@@ -202,6 +206,7 @@ def main():
k.image = options.image
k.live_cd = options.live_cd
k.virt_path = options.virt_path
+ k.force_path = options.force_path
k.virt_type = options.virt_type
k.virt_bridge = options.virt_bridge
k.no_gfx = options.no_gfx
@@ -266,6 +271,7 @@ class Koan:
self.virt_name = None
self.virt_type = None
self.virt_path = None
+ self.force_path = None
self.qemu_disk_type = None
self.virt_auto_boot = None
@@ -1457,7 +1463,10 @@ class Koan:
elif not os.path.exists(location) and \
os.path.isdir(os.path.dirname(location)): return location
else:
- raise InfoException, "invalid location: %s" % location \
+ if self.force_path:
+ return location
+ else:
+ raise InfoException, "The location %s is an existing file. Consider \
'--force-path' to overwrite it." % location elif location.startswith("/dev/"):
# partition
if os.path.exists(location):
--
1.7.1
_______________________________________________
cobbler-devel mailing list
cobbler-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic