summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-11-26 16:11:46 -0500
committerMichael DeHaan <mdehaan@redhat.com>2007-11-26 16:11:46 -0500
commit9d7497cdced1fad271839c00804156e8a0794ac3 (patch)
tree4ebd77afcf41f07b926f4c976a5893bd87fcc784
parent3739ae458fbfe5698307c46524041e6114ad28c5 (diff)
downloadthird_party-cobbler-9d7497cdced1fad271839c00804156e8a0794ac3.tar.gz
third_party-cobbler-9d7497cdced1fad271839c00804156e8a0794ac3.tar.xz
third_party-cobbler-9d7497cdced1fad271839c00804156e8a0794ac3.zip
Work on CLI functions for manipulating objects, including adding the delete code back.
-rw-r--r--cobbler/commands.py4
-rw-r--r--cobbler/modules/cli_distro.py6
-rw-r--r--cobbler/modules/cli_misc.py4
-rw-r--r--cobbler/modules/cli_profile.py8
-rw-r--r--cobbler/modules/cli_repo.py6
-rw-r--r--cobbler/modules/cli_system.py13
6 files changed, 23 insertions, 18 deletions
diff --git a/cobbler/commands.py b/cobbler/commands.py
index e5eb2de..b2186f1 100644
--- a/cobbler/commands.py
+++ b/cobbler/commands.py
@@ -152,6 +152,10 @@ class CobblerFunction:
Boilerplate for objects that offer add/edit/delete/remove/copy functionality.
"""
+ if "remove" in self.args:
+ collect_fn().remove(self.options.name,with_delete=True)
+ return None # signal that we want no further processing on the object
+
if "add" in self.args:
obj = new_fn(is_subobject=subobject)
else:
diff --git a/cobbler/modules/cli_distro.py b/cobbler/modules/cli_distro.py
index 860df90..094961b 100644
--- a/cobbler/modules/cli_distro.py
+++ b/cobbler/modules/cli_distro.py
@@ -27,16 +27,16 @@ import cexceptions
class DistroFunction(commands.CobblerFunction):
def help_me(self):
- return commands.HELP_FORMAT % ("cobbler distro", "<add|edit|copy|rename|delete> [ARGS|--help]")
+ return commands.HELP_FORMAT % ("cobbler distro", "<add|edit|copy|rename|remove> [ARGS|--help]")
def command_name(self):
return "distro"
def subcommands(self):
- return [ "add", "edit", "copy", "rename", "delete" ]
+ return [ "add", "edit", "copy", "rename", "remove" ]
def add_options(self, p, args):
- if not "delete" in args:
+ if not "remove" in args:
p.add_option("--arch", dest="arch", help="ex: x86, x86_64, ia64")
p.add_option("--breed", dest="breed", help="ex: redhat, debian, suse")
p.add_option("--initrd", dest="initrd", help="absolute path to initrd.img (REQUIRED)")
diff --git a/cobbler/modules/cli_misc.py b/cobbler/modules/cli_misc.py
index b71a84c..0ab25bb 100644
--- a/cobbler/modules/cli_misc.py
+++ b/cobbler/modules/cli_misc.py
@@ -160,7 +160,7 @@ class ReportFunction(commands.CobblerFunction):
return "report"
def add_options(self, p, args):
- p.add_option("--what", dest="what", default="all", help="distros/profiles/systems/repos (REQUIRED)")
+ p.add_option("--what", dest="what", default="all", help="distros/profiles/systems/repos")
p.add_option("--name", dest="name", help="report on just this object")
def __list_names2(self, collection, name):
@@ -205,7 +205,7 @@ class ReportFunction(commands.CobblerFunction):
if self.options.name:
self.__list_names2(self.api.systems(),self.options.name)
else:
- self.__print_sorted(self.api.sytems())
+ self.__print_sorted(self.api.systems())
if self.options.what in [ "all", "repos" ]:
if self.options.name:
diff --git a/cobbler/modules/cli_profile.py b/cobbler/modules/cli_profile.py
index a733534..63c4270 100644
--- a/cobbler/modules/cli_profile.py
+++ b/cobbler/modules/cli_profile.py
@@ -27,16 +27,16 @@ import cexceptions
class ProfileFunction(commands.CobblerFunction):
def help_me(self):
- return commands.HELP_FORMAT % ("cobbler profile","<add|edit|copy|rename|delete> [ARGS|--help]")
+ return commands.HELP_FORMAT % ("cobbler profile","<add|edit|copy|rename|remove> [ARGS|--help]")
def command_name(self):
return "profile"
def subcommands(self):
- return [ "add", "edit", "copy", "rename", "delete" ]
+ return [ "add", "edit", "copy", "rename", "remove" ]
def add_options(self, p, args):
- if not "delete" in args:
+ if not "remove" in args:
p.add_option("--distro", dest="distro", help="ex: 'RHEL-5-i386' (REQUIRED)")
p.add_option("--dhcp-tag", dest="dhcp_tag", help="for use in advanced DHCP configuration")
p.add_option("--inherit", dest="inherit", help="inherit from this profile name, defaults to no")
@@ -46,7 +46,7 @@ class ProfileFunction(commands.CobblerFunction):
p.add_option("--name", dest="name", help="a name for the profile (REQUIRED)")
if "copy" in args or "rename" in args:
p.add_option("--newname", dest="newname")
- if not "delete" in args:
+ if not "remove" in args:
p.add_option("--repos", dest="repos", help="names of cobbler repos")
p.add_option("--server-override", dest="server_override", help="overrides value in settings file")
p.add_option("--virt-bridge", dest="virt_bridge", help="ex: 'virbr0'")
diff --git a/cobbler/modules/cli_repo.py b/cobbler/modules/cli_repo.py
index 555b76a..3dd8f64 100644
--- a/cobbler/modules/cli_repo.py
+++ b/cobbler/modules/cli_repo.py
@@ -27,16 +27,16 @@ import cexceptions
class RepoFunction(commands.CobblerFunction):
def help_me(self):
- return commands.HELP_FORMAT % ("cobbler repo","<add|edit|copy|rename|delete> [ARGS|--help]")
+ return commands.HELP_FORMAT % ("cobbler repo","<add|edit|copy|rename|remove> [ARGS|--help]")
def command_name(self):
return "repo"
def subcommands(self):
- return [ "add", "edit", "copy", "rename", "delete" ]
+ return [ "add", "edit", "copy", "rename", "remove" ]
def add_options(self, p, args):
- if not "delete" in args:
+ if not "remove" in args:
p.add_option("--arch", dest="arch", help="overrides repo arch if required")
p.add_option("--createrepo-flags", dest="createrepo_flags", help="additional flags for createrepo")
p.add_option("--rpm-list", dest="rpm_list", help="just mirror these rpms")
diff --git a/cobbler/modules/cli_system.py b/cobbler/modules/cli_system.py
index 65c0625..1e39669 100644
--- a/cobbler/modules/cli_system.py
+++ b/cobbler/modules/cli_system.py
@@ -27,17 +27,17 @@ import cexceptions
class SystemFunction(commands.CobblerFunction):
def help_me(self):
- return commands.HELP_FORMAT % ("cobbler system","<add|edit|copy|rename|delete> [ARGS|--help]")
+ return commands.HELP_FORMAT % ("cobbler system","<add|edit|copy|rename|remove> [ARGS|--help]")
def command_name(self):
return "system"
def subcommands(self):
- return [ "add", "edit", "copy", "rename", "delete" ]
+ return [ "add", "edit", "copy", "rename", "remove" ]
def add_options(self, p, args):
- if not "delete" in args:
+ if not "remove" in args:
p.add_option("--dhcp-tag", dest="dhcp_tag", help="for use in advanced DHCP configurations")
p.add_option("--gateway", dest="gateway", help="for static IP / templating usage")
p.add_option("--hostname", dest="hostname", help="ex: server.example.org")
@@ -47,15 +47,16 @@ class SystemFunction(commands.CobblerFunction):
p.add_option("--ksmeta", dest="ksmeta", help="ex: 'blippy=7'")
p.add_option("--mac", dest="mac", help="ex: 'AA:BB:CC:DD:EE:FF', (RECOMMENDED)")
p.add_option("--name", dest="name", help="a name for the system (REQUIRED)")
- if not "delete" in args:
+ if not "remove" in args:
p.add_option("--netboot-enabled", dest="netboot_enabled", help="PXE on (1) or off (0)")
if "copy" in args or "rename" in args:
p.add_option("--newname", dest="newname", help="for use with copy/edit")
- if not "delete" in args:
+ if not "remove" in args:
p.add_option("--profile", dest="profile", help="name of cobbler profile (REQUIRED)")
p.add_option("--server-override", dest="server_override", help="overrides server value in settings file")
p.add_option("--subnet", dest="subnet", help="for static IP / templating usage")
p.add_option("--virt-bridge", dest="virt_bridge", help="ex: virbr0")
+ p.add_option("--virt-path", dest="virt_path", help="path, partition, or volume")
p.add_option("--virt-type", dest="virt_type", help="ex: xenpv, qemu")
@@ -81,7 +82,7 @@ class SystemFunction(commands.CobblerFunction):
if self.options.gateway: obj.set_gateway(self.options.gateway, my_interface)
if self.options.dhcp_tag: obj.set_dhcp_tag(self.options.dhcp_tag, my_interface)
- return self.object_manipulator_finish(obj, self.api.profiles)
+ return self.object_manipulator_finish(obj, self.api.systems)