Trees | Indices | Help |
---|
|
1 # 2 # Copyright (c) 2008--2015 Red Hat, Inc. 3 # 4 # This software is licensed to you under the GNU General Public License, 5 # version 2 (GPLv2). There is NO WARRANTY for this software, express or 6 # implied, including the implied warranties of MERCHANTABILITY or FITNESS 7 # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 8 # along with this software; if not, see 9 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 10 # 11 # Red Hat trademarks are not licensed under GPLv2. No permission is 12 # granted to use or replicate Red Hat trademarks that are incorporated 13 # in this software or its documentation. 14 # 15 # this file implements the ServerWrapper class, which takes care 16 # of all the load and save functions for misc tables associated 17 # with a server (such as packages, hardware, history) 18 # 19 # the server.Server class inherits this ServerWrapper class 20 # 21 22 from server_hardware import Hardware 23 from server_packages import Packages 24 from server_history import History 25 26 from rhn.UserDictCase import UserDictCase 27 from spacewalk.server import rhnSQL 28 2931 32 """ This is a middle class that ties all the subclasses together, plus it 33 provides a cleaner way to keep all the wrapper functions in one place. 34 The main Server class is based on this one and it looks a little bit 35 cleaner that way. 36 """ 3710839 self.server = UserDictCase() 40 Packages.__init__(self) 41 History.__init__(self) 42 Hardware.__init__(self)43 4648 """ update a value in self.server """ 49 if name is None or value is None: 50 return -1 51 self.server[name] = value 52 return 053 54 ### 55 # PACKAGES 56 ### 5759 """ Wrappers for the similar functions from Packages class that supplementaly 60 require a valid sysid. 61 """ 62 return Packages.add_package(self, self.server.get("id"), entry)63 66 6971 """ wrapper for the Packages.save_packages_byid() which requires the sysid """ 72 ret = self.save_packages_byid(self.server["id"], schedule=schedule) 73 # this function is primarily called from outside 74 # so we have to commit here 75 rhnSQL.commit() 76 return ret77 78 ### 79 # HARDWARE 80 ### 8183 """ Wrappers for the similar functions from Hardware class """ 84 return Hardware.delete_hardware(self, self.server.get("id"))8587 """ wrapper for the Hardware.save_hardware_byid() which requires the sysid """ 88 ret = self.save_hardware_byid(self.server["id"]) 89 # this function is primarily called from outside 90 # so we have to commit here 91 rhnSQL.commit() 92 return ret9395 """ wrapper for the Hardware.reload_hardware_byid() which requires the sysid """ 96 ret = self.reload_hardware_byid(self.server["id"]) 97 return ret98 99 ### 100 # HISTORY 101 ###103 ret = self.save_history_byid(self.server["id"]) 104 # this function is primarily called from outside 105 # so we have to commit here 106 rhnSQL.commit() 107 return ret
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Wed Mar 4 07:37:43 2020 | http://epydoc.sourceforge.net |