From 90666a4a0a3c918a31f7cdfd9fa9fd2a6ad48705 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 16 May 2008 14:42:37 -0400 Subject: The settings file is now /etc/cobbler/settings, and cobbler's command line will warn the user the old file is no longer in use and ask them to delete it before proceeding. --- cobbler/action_check.py | 10 +++++----- cobbler/api.py | 2 +- cobbler/cobbler.py | 11 +++++++++++ cobbler/item_system.py | 2 +- cobbler/pxegen.py | 2 +- cobbler/remote.py | 2 +- cobbler/settings.py | 8 -------- 7 files changed, 20 insertions(+), 17 deletions(-) (limited to 'cobbler') diff --git a/cobbler/action_check.py b/cobbler/action_check.py index f5f86f0..d38603b 100644 --- a/cobbler/action_check.py +++ b/cobbler/action_check.py @@ -106,9 +106,9 @@ class BootCheck: parameters. """ if self.settings.server == "127.0.0.1": - status.append(_("The 'server' field in /var/lib/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.")) + status.append(_("The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.")) if self.settings.next_server == "127.0.0.1": - status.append(_("For PXE to be functional, the 'next_server' field in /var/lib/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.")) + status.append(_("For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.")) def check_selinux(self,status): prc = sub_process.Popen("/usr/sbin/getenforce",shell=True,stdout=sub_process.PIPE) @@ -175,21 +175,21 @@ class BootCheck: Check if dhcpd is installed """ if not os.path.exists(self.settings.dhcpd_bin): - status.append(_("dhcpd isn't installed, but management is enabled in /var/lib/cobbler/settings")) + status.append(_("dhcpd isn't installed, but management is enabled in /etc/cobbler/settings")) def check_dnsmasq_bin(self,status): """ Check if dnsmasq is installed """ if not os.path.exists(self.settings.dnsmasq_bin): - status.append(_("dnsmasq isn't installed, but management is enabled in /var/lib/cobbler/settings")) + status.append(_("dnsmasq isn't installed, but management is enabled in /etc/cobbler/settings")) def check_bind_bin(self,status): """ Check if bind is installed. """ if not os.path.exists(self.settings.bind_bin): - status.append(_("bind isn't installed, but management is enabled in /var/lib/cobbler/settings")) + status.append(_("bind isn't installed, but management is enabled in /etc/cobbler/settings")) def check_bootloaders(self,status): diff --git a/cobbler/api.py b/cobbler/api.py index cafc216..9f4a636 100644 --- a/cobbler/api.py +++ b/cobbler/api.py @@ -41,7 +41,7 @@ DEBUG = 5 # notes on locking: # BootAPI is a singleton object # the XMLRPC variants allow 1 simultaneous request -# therefore we flock on /var/lib/cobbler/settings for now +# therefore we flock on /etc/cobbler/settings for now # on a request by request basis. class BootAPI: diff --git a/cobbler/cobbler.py b/cobbler/cobbler.py index 970a06a..2aed672 100755 --- a/cobbler/cobbler.py +++ b/cobbler/cobbler.py @@ -45,12 +45,23 @@ class BootCLI: #################################################### +def run_upgrade_checks(): + """ + Cobbler tries to make manual upgrade steps unneeded, though + this function serves to inform users of manual steps when they /are/ + needed. + """ + # for users running pre-1.0 upgrading to 1.0 + if os.path.exists("/var/lib/cobbler/settings"): + raise CX(_("/var/lib/cobbler/settings is no longer in use, remove this file to acknowledge you have migrated your configuration to /etc/cobbler/settings. Do not simply copy the file over or you will lose new configuration entries. Run 'cobbler check' and then 'cobbler sync' after making changes.")) + def main(): """ CLI entry point """ exitcode = 0 try: + run_upgrade_checks() return BootCLI().run(sys.argv) except SystemExit, ex: return 1 diff --git a/cobbler/item_system.py b/cobbler/item_system.py index 2318ced..09f169d 100644 --- a/cobbler/item_system.py +++ b/cobbler/item_system.py @@ -249,7 +249,7 @@ class System(item.Item): def set_ip_address(self,address,interface="intf0"): """ Assign a IP or hostname in DHCP when this MAC boots. - Only works if manage_dhcp is set in /var/lib/cobbler/settings + Only works if manage_dhcp is set in /etc/cobbler/settings """ intf = self.__get_interface(interface) if address == "" or utils.is_ip(address): diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py index d847569..a438583 100644 --- a/cobbler/pxegen.py +++ b/cobbler/pxegen.py @@ -58,7 +58,7 @@ class PXEGen: """ Copy bootloaders to the configured tftpboot directory NOTE: we support different arch's if defined in - /var/lib/cobbler/settings. + /etc/cobbler/settings. """ for loader in self.settings.bootloaders.keys(): path = self.settings.bootloaders[loader] diff --git a/cobbler/remote.py b/cobbler/remote.py index 69754a3..1a414f3 100644 --- a/cobbler/remote.py +++ b/cobbler/remote.py @@ -193,7 +193,7 @@ class CobblerXMLRPCInterface: def get_settings(self,token=None): """ - Return the contents of /var/lib/cobbler/settings, which is a hash. + Return the contents of /etc/cobbler/settings, which is a hash. """ self.log("get_settings",token=token) return self.__get_all("settings") diff --git a/cobbler/settings.py b/cobbler/settings.py index d147d4b..4670ab0 100644 --- a/cobbler/settings.py +++ b/cobbler/settings.py @@ -140,11 +140,3 @@ class Settings(serializable.Serializable): else: raise AttributeError, name -if __name__ == "__main__": - # used to save a settings file to /var/lib/cobbler/settings, for purposes of - # including a new updated settings file in the RPM without remembering how - # to format lots of YAML. - import yaml - print yaml.dump(DEFAULTS) - - -- cgit