Trees | Indices | Help |
---|
|
1 # 2 # Copyright (c) 2008--2016 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 16 import os 17 18 #Base class for all modes. 47 48 #Contains the directory and file manipulation stuff52 53 #Set the rhn_root variable. 56 57 #Creates the self.rhn_root directories if they don't already exist. This allows subclasses to implement modes in different locations. 61 62 #Create the file if it doesn't already exist.85 86 87 #Stuff that's common to the Mode subclasses.64 self._create_rhnconfig_path() 65 if not self.check_for_file(filename): 66 try: 67 f = open(os.path.join(self.rhn_root, filename), "w") 68 f.close() 69 except Exception: 70 raise71 72 #remove the file if it's present.74 self._create_rhnconfig_path() 75 if self.check_for_file(filename): 76 try: 77 os.remove(os.path.join(self.rhn_root, filename)) 78 except Exception: 79 raise80 81 #Returns True if filename exists in /etc/sysconfig/rhn/allowed-actions/configfiles93 97 101 102 #Could probably just check the value of state... 105111107 if self.ph.check_for_file(self.name): 108 return False 109 elif not self.ph.check_for_file(self.name): 110 return True117114 ConfigFilesBaseMode.__init__(self) 115 self.name = "run" 116 self.ph.set_rhn_root("/etc/sysconfig/rhn/allowed-actions/script")123 128 133 138 143 148 149 #Solaris Specific Modes120 ConfigFilesBaseMode.__init__(self) 121 self.name = "all" 122 self.ph.set_rhn_root("/etc/sysconfig/rhn/allowed-actions/script")155152 ConfigFilesBaseMode.__init__(self) 153 self.name = "run" 154 self.ph.set_rhn_root("/opt/redhat/rhn/solaris/etc/sysconfig/rhn/allowed-actions/script")161158 ConfigFilesBaseMode.__init__(self) 159 self.name = "all" 160 self.ph.set_rhn_root("/opt/redhat/rhn/solaris/etc/sysconfig/rhn/allowed-actions/script")167164 ConfigFilesBaseMode.__init__(self) 165 self.name = "all" 166 self.ph.set_rhn_root("/opt/redhat/rhn/solaris/etc/sysconfig/rhn/allowed-actions/configfiles")173170 ConfigFilesBaseMode.__init__(self) 171 self.name = "deploy" 172 self.ph.set_rhn_root("/opt/redhat/rhn/solaris/etc/sysconfig/rhn/allowed-actions/configfiles")179176 ConfigFilesBaseMode.__init__(self) 177 self.name = "diff" 178 self.ph.set_rhn_root("/opt/redhat/rhn/solaris/etc/sysconfig/rhn/allowed-actions/configfiles")185182 ConfigFilesBaseMode.__init__(self) 183 self.name = "upload" 184 self.ph.set_rhn_root("/opt/redhat/rhn/solaris/etc/sysconfig/rhn/allowed-actions/configfiles")191188 ConfigFilesBaseMode.__init__(self) 189 self.name = "mtime_upload" 190 self.ph.set_rhn_root("/opt/redhat/rhn/solaris/etc/sysconfig/rhn/allowed-actions/configfiles")
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Wed Mar 4 07:37:49 2020 | http://epydoc.sourceforge.net |