def undo(self, change_record=None): if not change_record: msg = "Skipping Undo: No change record in state file." self.logger.notice(self.module_name, msg) return 1 # check to see if this might be an oldstyle change record, which is a string of entries # of "filename|mode|uid|gid\n" - mode should be interpreted as octal # If so, convert that into the new dictionary style if not change_record[0:200].strip().startswith('{'): new_rec = {} for line in change_record.split('\n'): fspecs = line.split('|') if len(fspecs) != 4: continue new_rec[fspecs[0]] = { 'owner': fspecs[2], 'group': fspecs[3], 'dacs': int(fspecs[1], 8) } change_record = new_rec return GenericPerms.undo(change_record=change_record) return 1
def undo(self, change_record=None): if not change_record: msg = "Skipping Undo: No change record in state file." self.logger.notice(self.module_name, msg) return 1 # Old style change record was simply the permissions to restore, so if we only get a number as the change_record # treat it as such (with DECIMAL perms) and create the newstyle change record if not change_record[0:200].strip().startswith('{'): newperms = int(change_record, 10) change_record = {} change_record[self.__target_file] = {'dacs': newperms} else: change_record = tcs_utils.string_to_dictionary(change_record) return GenericPerms.undo(change_record=change_record)
def undo(self, change_record=None): # Even though we didn't call GenericPerms to *make* the changes, we can still pop the change record back through # that code... return GenericPerms.undo(change_record=change_record)
def undo(self, change_record=None): return GenericPerms.undo(change_record=change_record)
def undo(self, change_record=None): """Undo removal of user/group change of unowned files""" return GenericPerms.undo(change_record=change_record)