From 85005517223359b0326045a7add495f77043fecc Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Thu, 11 May 2006 17:24:20 -0400 Subject: Added licensing and RH copyright. Pychecker (once again). Fixed one unit test where I changed a command line syntax. --- cobbler.pod | 4 ++-- cobbler/action_check.py | 8 ++++++++ cobbler/action_sync.py | 10 +++++++++- cobbler/api.py | 12 ++++++++++-- cobbler/cexceptions.py | 8 ++++++++ cobbler/cobbler | 9 +++++++++ cobbler/cobbler.py | 17 ++++++++++++----- cobbler/cobbler_msg.py | 10 +++++++++- cobbler/collection.py | 8 ++++++++ cobbler/collection_distros.py | 10 +++++++++- cobbler/collection_profiles.py | 8 ++++++++ cobbler/collection_systems.py | 8 ++++++++ cobbler/config.py | 10 +++++++++- cobbler/item.py | 8 ++++++++ cobbler/item_distro.py | 8 ++++++++ cobbler/item_profile.py | 11 +++++++++-- cobbler/item_system.py | 8 ++++++++ cobbler/serializable.py | 8 ++++++++ cobbler/serializer.py | 16 ++++++++++++++-- cobbler/settings.py | 8 ++++++++ cobbler/utils.py | 8 ++++++++ tests/tests.py | 4 +--- 22 files changed, 181 insertions(+), 20 deletions(-) diff --git a/cobbler.pod b/cobbler.pod index 9e888ac..949cf20 100644 --- a/cobbler.pod +++ b/cobbler.pod @@ -16,7 +16,7 @@ Cobbler makes these things faster, simpler, and more flexible. It also enables B -An admin should first install dhcpd, tftpd, and httpd. Kickstarts files can also be downloaded over NFS and FTP (meaning installs of an FTP or NFS server may be warranted), but these modes of delivery are optional. NFS is a common way of serving kickstart trees, however. +An admin should first install dhcpd, tftpd, and httpd. Kickstarts files can also be downloaded over NFS and FTP (meaning installs of an FTP or NFS server may be warranted), but these modes of delivery are optional. NFS is a common way of serving kickstart trees, however. yum install dhcp tftp-server syslinux ... @@ -37,7 +37,7 @@ The kernel/initrd pairs used for "distro add" probably should be those that are B --distro= [--kickstart=] [--kopts=] [--xen-name=] [--xen-file-size=] [--xen-ram=] -"cobbler profile add" defines a named provisioning profile, which must reference an already created distribution. Optional parameters can specify kickstart information or Xen parameters. Kickstarts are almost always desired, and can be nfs://, http://, or ftp:// -- or an absolute path. For file paths, cobbler will copy the kickstarts and serve them up as http -- so having servable kickstart paths as parameters to "cobbler profile add" is not required. +"cobbler profile add" defines a named provisioning profile, which must reference an already created distribution. Optional parameters can specify kickstart information or Xen parameters. Kickstarts are almost always desired, and can be nfs://, http://, or ftp:// -- or an absolute path. For file paths, cobbler will copy the kickstarts and serve them up as http -- so having servable kickstart paths as parameters to "cobbler profile add" is not required. In fact, it's probably a good idea to leave the kickstarts as absolute paths to avoid having yet another resource to manage. For Xen parameters, koan may interpret some parameters as hints, not absolutes, if it has to resolve conflicts. All of these Xen parameters are optional, though as many as possible should be specified to avoid the risk koan making it's own decisions when run on the target dom0. See the documentation for koan for more details. diff --git a/cobbler/action_check.py b/cobbler/action_check.py index fdcc5d5..9646818 100644 --- a/cobbler/action_check.py +++ b/cobbler/action_check.py @@ -2,7 +2,15 @@ Validates whether the system is reasonably well configured for serving up content. This is the code behind 'cobbler check'. +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import os diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py index 9e681a6..3334c62 100644 --- a/cobbler/action_sync.py +++ b/cobbler/action_sync.py @@ -2,7 +2,15 @@ Builds out a TFTP/cobbler boot tree based on the object tree. This is the code behind 'cobbler sync'. +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import os @@ -307,7 +315,7 @@ class BootSync: return shutil.copyfile(src,dst) except IOError, ioe: raise cexceptions.CobblerException("need_perms2",src,dst) - + def copy(self,src,dst): """ diff --git a/cobbler/api.py b/cobbler/api.py index d4dfd10..a4f04fe 100644 --- a/cobbler/api.py +++ b/cobbler/api.py @@ -3,7 +3,15 @@ python API module for Cobbler see source for cobbler.py, or pydoc, for example usage. CLI apps and daemons should import api.py, and no other cobbler code. +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import config @@ -19,7 +27,7 @@ class BootAPI: """ The API can be invoked in two ways, depending on how it is constructed. The catch_exceptions mode will cause any API method to return false - if any CobblerExceptions were thrown, along with setting 'last_error'. + if any CobblerExceptions were thrown, along with setting 'last_error'. The other mode just lets the exceptions pass through, and is the way most apps should use the API. catch_exceptions was added for the test hooks, since they are coded to use True/False. @@ -28,7 +36,7 @@ class BootAPI: self.catch_exceptions = catch_exceptions self.last_error = "" self.deserialize() - + def __api_call(self,anonymous): if self.catch_exceptions: diff --git a/cobbler/cexceptions.py b/cobbler/cexceptions.py index 076429b..1052abe 100644 --- a/cobbler/cexceptions.py +++ b/cobbler/cexceptions.py @@ -1,7 +1,15 @@ """ Custom exceptions for Cobbler +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import exceptions diff --git a/cobbler/cobbler b/cobbler/cobbler index d69b50b..6249d69 100755 --- a/cobbler/cobbler +++ b/cobbler/cobbler @@ -2,7 +2,16 @@ """ Wrapper for cobbler + +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import sys diff --git a/cobbler/cobbler.py b/cobbler/cobbler.py index e93d29f..01639ca 100755 --- a/cobbler/cobbler.py +++ b/cobbler/cobbler.py @@ -3,10 +3,17 @@ Command line interface for cobbler, a network provisioning configuration library. Consult 'man cobbler' for general info. This class serves as a good reference on how to drive the API (api.py). +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ -import os import sys import api import syck @@ -67,13 +74,13 @@ class BootCLI: """ Print out abbreviated help if user gives bad syntax """ - raise cexception.CobblerException("usage") + raise cexceptions.CobblerException("usage") def list(self,args): - all = [ self.api.settings(), self.api.distros(), + all = [ self.api.settings(), self.api.distros(), self.api.profiles(), self.api.systems() ] for item in all: - print item.printable() + print item.printable() def system_remove(self,args): """ @@ -181,7 +188,7 @@ class BootCLI: key, value = x.split("=",1) value = value.replace('"','').replace("'",'') except: - raise cexpceptions.CobblerException("bad_arg",x) + raise cexceptions.CobblerException("bad_arg",x) if input_routines.has_key(key): input_routines[key](value) else: diff --git a/cobbler/cobbler_msg.py b/cobbler/cobbler_msg.py index cd2be93..a85b570 100644 --- a/cobbler/cobbler_msg.py +++ b/cobbler/cobbler_msg.py @@ -3,7 +3,15 @@ Messages used by cobbler. This module encapsulates strings so they can be reused and potentially translated. +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ _msg_table = { @@ -58,7 +66,7 @@ _msg_table = { "exc_xen_name" : "invalid Xen name", "exc_xen_file" : "invalid Xen file size", "exc_xen_mac" : "invalid Xen mac address", - "exc_xen_para" : "invalid Xen paravirtualization setting", + "exc_xen_para" : "invalid Xen paravirtualization setting", "exc_profile" : "invalid profile name", "exc_profile2" : "profile name not set", "check_ok" : """ diff --git a/cobbler/collection.py b/cobbler/collection.py index 937c528..ad1ed27 100644 --- a/cobbler/collection.py +++ b/cobbler/collection.py @@ -1,7 +1,15 @@ """ Base class for any serializable list of things... +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import exceptions diff --git a/cobbler/collection_distros.py b/cobbler/collection_distros.py index d5fda8c..9625b58 100644 --- a/cobbler/collection_distros.py +++ b/cobbler/collection_distros.py @@ -2,7 +2,15 @@ A distro represents a network bootable matched set of kernels and initrd files -Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import utils diff --git a/cobbler/collection_profiles.py b/cobbler/collection_profiles.py index 837b0e6..152e1f8 100644 --- a/cobbler/collection_profiles.py +++ b/cobbler/collection_profiles.py @@ -4,7 +4,15 @@ For instance, FC5 with a kickstart file specifying OpenOffice might represent a 'desktop' profile. For Xen, there are many additional options, with client-side defaults (not kept here). +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import item_profile as profile diff --git a/cobbler/collection_systems.py b/cobbler/collection_systems.py index aa26571..39b3119 100644 --- a/cobbler/collection_systems.py +++ b/cobbler/collection_systems.py @@ -2,7 +2,15 @@ Systems are hostnames/MACs/IP names and the associated profile they belong to. +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import item_system as system diff --git a/cobbler/config.py b/cobbler/config.py index cf259a2..4bcc31e 100644 --- a/cobbler/config.py +++ b/cobbler/config.py @@ -1,7 +1,15 @@ """ Config.py is a repository of the Cobbler object model +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import os @@ -97,7 +105,7 @@ class Config: if not serializer.serialize(x): return False return True - + def serialize(self): """ diff --git a/cobbler/item.py b/cobbler/item.py index b1f5b93..9e8a5ba 100644 --- a/cobbler/item.py +++ b/cobbler/item.py @@ -1,7 +1,15 @@ """ An Item is a serializable thing that can appear in a Collection +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import exceptions diff --git a/cobbler/item_distro.py b/cobbler/item_distro.py index f42663f..7491a98 100644 --- a/cobbler/item_distro.py +++ b/cobbler/item_distro.py @@ -2,7 +2,15 @@ A cobbler distribution. A distribution is a kernel, and initrd, and potentially some kernel options. +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ diff --git a/cobbler/item_profile.py b/cobbler/item_profile.py index 22b56e9..46c7929 100644 --- a/cobbler/item_profile.py +++ b/cobbler/item_profile.py @@ -1,8 +1,15 @@ """ -A Cobbler Profile. A profile is a reference to a distribution, possibly some kernel -options, possibly some Xen options, and some kickstart data. +A Cobbler Profile. A profile is a reference to a distribution, possibly some kernel options, possibly some Xen options, and some kickstart data. +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import utils diff --git a/cobbler/item_system.py b/cobbler/item_system.py index cd25344..ab4b520 100644 --- a/cobbler/item_system.py +++ b/cobbler/item_system.py @@ -1,7 +1,15 @@ """ A Cobbler System. +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import utils diff --git a/cobbler/serializable.py b/cobbler/serializable.py index a55eae9..62dfd01 100644 --- a/cobbler/serializable.py +++ b/cobbler/serializable.py @@ -2,7 +2,15 @@ Serializable interface, for documentation purposes. Collections and Settings both support this interface. +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import exceptions diff --git a/cobbler/serializer.py b/cobbler/serializer.py index bc46125..71781b7 100644 --- a/cobbler/serializer.py +++ b/cobbler/serializer.py @@ -1,4 +1,16 @@ -# Michael DeHaan +""" +Serializer code for cobbler + +Copyright 2006, Red Hat, Inc +Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +""" import syck # PySyck 0.61 or greater, not syck-python 0.55 import errno @@ -61,5 +73,5 @@ def deserialize(obj): fd.close() obj.from_datastruct(datastruct) return True - + diff --git a/cobbler/settings.py b/cobbler/settings.py index 978c1b2..41ddd92 100644 --- a/cobbler/settings.py +++ b/cobbler/settings.py @@ -1,7 +1,15 @@ """ Cobbler app-wide settings +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import serializable diff --git a/cobbler/utils.py b/cobbler/utils.py index 3c82044..144deb3 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -1,7 +1,15 @@ """ Misc heavy lifting functions for cobbler +Copyright 2006, Red Hat, Inc Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. """ import os diff --git a/tests/tests.py b/tests/tests.py index 2a08f99..03fa5f6 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -287,9 +287,7 @@ class TestCLIBasic(BootTest): # is not included (yet) since the API tests hit that fairly throughly # and it would easily double the length of the tests. app = "cobbler/cobbler" - self.assertTrue(subprocess.call([app,"system","list"]) == 0) - self.assertTrue(subprocess.call([app,"distro","list"]) == 0) - self.assertTrue(subprocess.call([app,"profile","list"]) == 0) + self.assertTrue(subprocess.call([app,"list"]) == 0) if __name__ == "__main__": if not os.path.exists("setup.py"): -- cgit