summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-07-05 16:28:50 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-07-05 16:28:50 -0400
commitde404ad9b7c4d477bbec58d8ae67fb3797e6e0c3 (patch)
tree14c6829f82db386e4e8f2a0c3db110e82f9b6f19
parentc1ca313dea45dbc59ee4794b688a80ce11279652 (diff)
downloadcobbler-de404ad9b7c4d477bbec58d8ae67fb3797e6e0c3.tar.gz
cobbler-de404ad9b7c4d477bbec58d8ae67fb3797e6e0c3.tar.xz
cobbler-de404ad9b7c4d477bbec58d8ae67fb3797e6e0c3.zip
Modifying argument usage for the autodetect patch
-rw-r--r--koan.pod4
-rwxr-xr-xkoan/app.py42
2 files changed, 19 insertions, 27 deletions
diff --git a/koan.pod b/koan.pod
index 36c051e9..6b7e5ee2 100644
--- a/koan.pod
+++ b/koan.pod
@@ -16,13 +16,15 @@ koan --replace-self --server=<host> --profile=<name>
koan --replace-self --server=<host> --system=<name>
+koan --replace-self --server=<host>
+
=head1 DESCRIPTION
When invoked, koan requests profile information from a remote boot server that has been configured with cobbler. What koan does with the profile data depends on whether it was invoked with --virt or --replace-self.
For --virt, cobbler will create new virtualized guests on a machine in accordance to the orders from cobbler. You can then, once finished, use "virsh" and "xm" commands on the guest. Cobbler automatically names domains based on their mac addresses. To install using a more descriptive name, specify one with --virtname.
-For re-kickstarting ('--replace-self'), cobbler will reprovisioning the system, blowing away any current data and replacing it with the results of a network install.
+For re-kickstarting ('--replace-self'), cobbler will reprovisioning the system, blowing away any current data and replacing it with the results of a network install. Specify a specific item from cobbler with --system or --profile, otherwise cobbler will try to see if there is a cobbler system record that matches a MAC address on the system.
=head1 NOTES FOR USERS OF COBBLER TEMPLATING
diff --git a/koan/app.py b/koan/app.py
index 78a1d2e9..a7f92343 100755
--- a/koan/app.py
+++ b/koan/app.py
@@ -60,7 +60,7 @@ def main():
dest="virtname",
help="force the virtual domain to use this name")
p.add_option("-r", "--replace-self",
- dest="is_auto_kickstart",
+ dest="is_replace",
action="store_true",
help="requests re-provisioning of this host")
p.add_option("-p", "--profile",
@@ -79,10 +79,6 @@ def main():
p.add_option("-t", "--port",
dest="port",
help="cobbler xmlrpc port (default 25151)")
- p.add_option("-a", "--autodetect-system",
- dest="autodetect",
- action="store_true",
- help="autodetect system from MAC address")
(options, args) = p.parse_args()
@@ -101,11 +97,10 @@ def main():
k.list_profiles = options.list_profiles
k.server = options.server
k.is_virt = options.is_virt
- k.is_auto_kickstart = options.is_auto_kickstart
+ k.is_replace = options.is_replace
k.profile = options.profile
k.system = options.system
k.verbose = options.verbose
- k.autodetect = options.autodetect
if options.virtname is not None:
k.virtname = options.virtname
if options.port is not None:
@@ -145,11 +140,10 @@ class Koan:
self.list_systems = None
self.verbose = None
self.is_virt = None
- self.is_auto_kickstart = None
+ self.is_replace = None
self.dryrun = None
self.port = 25151
self.virtname = None
- self.autodetect = None
def run(self):
if self.server is None:
@@ -162,30 +156,25 @@ class Koan:
self.do_list_profiles()
if (self.list_systems or self.list_profiles):
return
- if self.autodetect and self.system:
- raise InfoException, "--autodetect-system and --system are exclusive"
- if self.autodetect and self.profile:
- raise InfoException, "--autodetect-system and --profile are exclusive"
- if self.autodetect:
- self.system = self.autodetectsystem()
- if not self.is_virt and not self.is_auto_kickstart:
- raise InfoException, "must use either --virt or --replace-self"
- if self.is_virt and self.is_auto_kickstart:
- raise InfoException, "must use either --virt or --replace-self"
+ if not self.is_virt and not self.is_replace:
+ raise InfoException, "--virt or --replace-self is required"
+ if self.is_virt and self.is_replace:
+ raise InfoException, "--virt or --replace-self is required"
+ if self.is_virt and not self.profile and not self.system:
+ raise InfoException, "--profile or --system is required"
if self.verbose is None:
self.verbose = True
- if (not self.profile and not self.system and not self.autodetect):
- raise InfoException, "must specify --profile or --system or --autodetect-system"
+ if (not self.profile and not self.system):
+ self.system = self.autodetect_system()
if self.profile and self.system:
raise InfoException, "--profile and --system are exclusive"
-
if self.is_virt:
self.do_virt()
else:
- self.do_auto_kickstart()
+ self.do_replace()
- def autodetectsystem(self):
+ def autodetect_system(self):
fd = os.popen("/sbin/ifconfig")
mac = [line.strip() for line in fd.readlines()][0].split()[-1] #this needs to be replaced
fd.close()
@@ -198,7 +187,8 @@ class Koan:
elif len(detectedsystem) == 0:
raise InfoException, "No system matching MAC address %s found" % mac
elif len(detectedsystem) == 1:
- return detectedsystem[0]
+ print "- Auto detected: %s" % detectedsystem[0]
+ return detectedsystem[0]
def urlread(self,url):
"""
@@ -325,7 +315,7 @@ class Koan:
self.do_virt_net_install(profile_data)
return self.do_net_install("/var/lib/xen",after_download)
- def do_auto_kickstart(self):
+ def do_replace(self):
"""
Handle morphing an existing system through downloading new
kernel, new initrd, and installing a kickstart in the initrd,