Changeset 519 for trunk/packages/sipb-xen-remote-server/files
- Timestamp:
- May 10, 2008, 8:46:43 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-remote-server/files/usr/sbin/sipb-xen-remconffs
r518 r519 105 105 '']) 106 106 107 def getconf(self, machine_name): 108 """Build the command file for a machine 109 """ 110 return ("control %s /usr/sbin/sipb-xen-remote-proxy-control" 111 " /etc/remctl/sipb-xen-auto/acl/%s\n" 112 % (machine_name, machine_name)) 113 114 def getfile(self, dir, machine_name): 115 """Build the ACL or command file for a machine 116 """ 117 if dir == 'acl': return self.getacl(machine_name) 118 if dir == 'conf.d': return self.getconf(machine_name) 119 raise "this shouldn't happen" 107 def getconf(self): 108 """Build the master conf file, with all machines 109 """ 110 return '\n'.join("control %s /usr/sbin/sipb-xen-remote-proxy-control" 111 " /etc/remctl/remconffs/acl/%s" 112 % (machine_name, machine_name) 113 for machine_name in self.getMachines())+'\n' 120 114 121 115 def userToPrinc(self, user): … … 156 150 st.st_nlink = 2 157 151 elif depth == 1: 158 if parts[0] not in ('acl', 'conf.d'): 159 return -errno.ENOENT 160 st.st_mode = stat.S_IFDIR | 0755 161 st.st_nlink = 2 152 if parts[0] == 'acl': 153 st.st_mode = stat.S_IFDIR | 0755 154 st.st_nlink = 2 155 elif parts[0] == 'conf': 156 st.st_mode = stat.S_IFREG | 0444 157 st.st_nlink = 1 158 st.st_size = len(self.getconf()) 159 else: 160 return -errno.ENOENT 162 161 elif depth == 2: 163 if parts[0] not in ('acl', 'conf.d'):162 if parts[0] != 'acl': 164 163 return -errno.ENOENT 165 164 if parts[1] not in self.getMachines(): … … 167 166 st.st_mode = stat.S_IFREG | 0444 168 167 st.st_nlink = 1 169 st.st_size = len(self.get file(parts[0],parts[1]))168 st.st_size = len(self.getacl(parts[1])) 170 169 171 170 return st.toTuple() … … 191 190 192 191 if depth == 0: 193 contents = ('acl', 'conf .d')192 contents = ('acl', 'conf') 194 193 elif depth == 1: 195 if parts[0] in ('acl', 'conf.d'):194 if parts[0] == 'acl': 196 195 contents = self.getMachines() 197 196 else: … … 212 211 parts, depth = parse(path) 213 212 214 # If the depth is not 2, then either it's a directory or the file 215 # doesn't exist 216 # (realistically this doesn't appear to ever happen) 217 if getDepth(path) != 2: 218 return -errno.ENOENT 219 elif parts[1] in self.getMachines(): 220 if parts[0] == 'acl': 213 if depth == 0: 214 return -errno.EISDIR 215 elif parts[0] == 'conf': 216 return self.getconf()[offset:offset+length] 217 elif parts[0] == 'acl': 218 if depth == 1: 219 return -errno.EISDIR 220 if parts[1] in self.getMachines(): 221 221 return self.getacl(parts[1])[offset:offset+length] 222 if parts[0] == 'conf.d':223 return self.getconf(parts[1])[offset:offset+length]224 222 return -errno.ENOENT 225 223
Note: See TracChangeset
for help on using the changeset viewer.