def dispiso9660(level, maxs, size): logger.logE( tn, logger.E, _("Compressed filesystem is higher than the iso9660 level ") + level + " spec allows (" + fsutil.sizeTrans({"B": maxs}, "M") + _("MB, size is ") + fsutil.sizeTrans({"B": size}, "M") + "MB).") logger.logE( tn, logger.E, logger.MTab + _("Please try to either reduce the amount of data you are generating, or " ) + _("increase the ISO level"))
def showFileNotFound(files, dirs, tn): logger.logE(tn, logger.E, files + " " + _("not found") + ". " + _("Copy") + " " + files + " " + _("to") + " " + dirs)
def page(self, page_num): if page_num < len(self.pages): return self.pages[page_num] else: logger.logE(tn, _("Page") + " " + str(page_num) + " " + _("does not exist"))
def fillConfiguration(self, configs, widget): # TODO: Clean this mess, or at least comment it l = "l" v = "v" for i in configs.keys(): # If the section is not in the notebook, add it if not i in self.configTab.notebook1.__dict__: self.configTab.notebook1.__dict__[i] = QtGui.QWidget() self.configTab.notebook1.__dict__[ i].vlayout = QtGui.QVBoxLayout( self.configTab.notebook1.__dict__[i]) self.configTab.notebook1.__dict__[i].nbook = QtGui.QTabWidget( self.configTab.notebook1.__dict__[i]) self.configTab.notebook1.__dict__[i].vlayout.addWidget( self.configTab.notebook1.__dict__[i].nbook) self.configTab.notebook1.addTab( self.configTab.notebook1.__dict__[i], i) for c in configutils.getValue(configs[i][configutils.categories]): self.addCategory(i, c) for x in configs[i].keys(): if x == configutils.categories: continue c = configutils.getValueP(configs[i][x], configutils.category) n = configutils.getValueP(configs[i][x], configutils.name) t = configutils.getValueP(configs[i][x], configutils.types) d = configutils.getValueP(configs[i][x], configutils.desc) v_ = configutils.getValue(configs[i][x]) c_ = configutils.getChoices(t) var = (i, x) uw = True # If the category is not in the section's notebook, add it if not c in self.configTab.notebook1.__dict__[i].nbook.__dict__: self.addCategory(i, c) # Add the dictionary self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n] = {} # Add the label self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][l] = QtGui.QLabel() self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][l].setText(n) self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][l].setToolTip(d) # Add the value if t == configutils.yesno: self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v] = ConfigWidget( QtGui.QCheckBox(), var) if v_: self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v].widget.setChecked(True) elif c_ is not None and len(c_) > 0: self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v] = ConfigWidget( QtGui.QComboBox(), var) self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v].widget.clear() c__ = 0 for y in c_: self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v].widget.addItem(y) if y == v_: self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n][ v].widget.setCurrentIndex(c__) c__ += 1 elif t == configutils.multiple: if not isinstance(v_, list): # Wut? logger.logE(self.tn, logger.E, _("Something went wrong")) self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v] = MultipleValues(var) self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v].set(v_) uw = False elif t == configutils.filename: self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v] = FileName(var) self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v].set(v_) uw = False else: self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v] = ConfigWidget( QtGui.QLineEdit(), var) self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v].widget.setText(v_) #self.configTab.notebook1.__dict__[i].nbook.__dict__[c].__dict__[n][v].widget.setSizePolicy( # QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding)) if uw: p = self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v].widget else: p = self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v] p.setToolTip(d) self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].flayout.addRow( self.configTab.notebook1.__dict__[i].nbook.__dict__[c]. __dict__[n][l], p)
def dispiso9660(level, maxs, size): logger.logE(tn, logger.E, _("Compressed filesystem is higher than the iso9660 level ") + level + " spec allows (" + fsutil.sizeTrans({"B": maxs}, "M") + _("MB, size is ") + fsutil.sizeTrans({"B": size}, "M") + "MB).") logger.logE(tn, logger.E, logger.MTab + _("Please try to either reduce the amount of data you are generating, or ") + _("increase the ISO level"))
def fillConfiguration(self, configs, widget): # TODO: Clean this mess, or at least comment it l = "l" v = "v" for i in configs.keys(): # If the section is not in the notebook, add it if not i in self.configTab.notebook1.__dict__: self.configTab.notebook1.__dict__[i] = QtGui.QWidget() self.configTab.notebook1.__dict__[i].vlayout = QtGui.QVBoxLayout( self.configTab.notebook1.__dict__[i]) self.configTab.notebook1.__dict__[i].nbook = QtGui.QTabWidget( self.configTab.notebook1.__dict__[i]) self.configTab.notebook1.__dict__[i].vlayout.addWidget( self.configTab.notebook1.__dict__[i].nbook) self.configTab.notebook1.addTab( self.configTab.notebook1.__dict__[i], i) for c in configutils.getValue(configs[i][configutils.categories]): self.addCategory(i, c) for x in configs[i].keys(): if x == configutils.categories: continue c = configutils.getValueP(configs[i][x], configutils.category) n = configutils.getValueP(configs[i][x], configutils.name) t = configutils.getValueP(configs[i][x], configutils.types) d = configutils.getValueP(configs[i][x], configutils.desc) v_ = configutils.getValue(configs[i][x]) c_ = configutils.getChoices(t) var = (i, x) uw = True # If the category is not in the section's notebook, add it if not c in self.configTab.notebook1.__dict__[i].nbook.__dict__: self.addCategory(i, c) # Add the dictionary self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n] = {} # Add the label self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n][l] = QtGui.QLabel() self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n][l].setText(n) self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n][l].setToolTip(d) # Add the value if t == configutils.yesno: self.configTab.notebook1.__dict__[i].nbook.__dict__[c].__dict__[n][v] = ConfigWidget(QtGui.QCheckBox(), var) if v_: self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v].widget.setChecked(True) elif c_ is not None and len(c_) > 0: self.configTab.notebook1.__dict__[i].nbook.__dict__[c].__dict__[n][v] = ConfigWidget(QtGui.QComboBox(), var) self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n][v].widget.clear() c__ = 0 for y in c_: self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v].widget.addItem(y) if y == v_: self.configTab.notebook1.__dict__[i].nbook.__dict__[c].__dict__[n][v].widget.setCurrentIndex(c__) c__ += 1 elif t == configutils.multiple: if not isinstance(v_, list): # Wut? logger.logE( self.tn, logger.E, _("Something went wrong")) self.configTab.notebook1.__dict__[i].nbook.__dict__[ c].__dict__[n][v] = MultipleValues(var) self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n][v].set(v_) uw = False elif t == configutils.filename: self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n][v] = FileName(var) self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n][v].set(v_) uw = False else: self.configTab.notebook1.__dict__[i].nbook.__dict__[c].__dict__[n][v] = ConfigWidget(QtGui.QLineEdit(), var) self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n][v].widget.setText(v_) #self.configTab.notebook1.__dict__[i].nbook.__dict__[c].__dict__[n][v].widget.setSizePolicy( # QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding)) if uw: p = self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n][v].widget else: p = self.configTab.notebook1.__dict__[ i].nbook.__dict__[c].__dict__[n][v] p.setToolTip(d) self.configTab.notebook1.__dict__[i].nbook.__dict__[c].flayout.addRow( self.configTab.notebook1.__dict__[i].nbook.__dict__[c].__dict__[n][l], p)
def run(self): # Setup the password and group stuff logger.logI(self.tn, _("Removing conflicting users")) passwdf = tmpsys + "etc/passwd" #passwdfile = open(passwdf, "r") #passwdstat = fsutil.getStat(passwdf) #passwdbuffer = configutils.getBuffer(passwdfile) #passwdfile.close() #passwdfile = open(passwdf, "w") buffers = fsutil.ife_getbuffers(passwdf) pe = pwdmanip.parsePasswdEntries(buffers[3]) buffers[3] = pe # Users to "delete" on the live system logger.logV("Gathering users to remove") nobody = "" for x in pe: if x["user"] == "nobody": nobody = x if nobody == "": logger.logE(self.tn, _("User 'nobody' could not be found!")) max_uid = 1999 sysrange = 500 nuid = int(nobody["uid"]) if nuid <= 100: # nobody has been assigned to the conventional system UID range max_uid = 1999 sysrange = 100 elif nuid < 500: # nobody has been assigned to the RHEL system UID range max_uid = 1999 sysrange = 500 elif nuid >= 65530 and nuid <= 65535: # nobody has been assigned to the highest possible unsigned short integer (16 bit) range max_uid = nuid - 1 sysrange = 555 elif nuid >= 32766: # nobody has been assigned to the highest possible signed short integer (16 bit) range max_uid = nuid - 1 sysrange = 500 else: max_uid = 1999 sysrange = 555 usrs = pwdmanip.getPPByUID(numrange.gen_num_range(sysrange, max_uid), pe) if config.VVStatus is False: logger.logV(_("Removing them")) logger.logVV(_("Removing users in /etc/passwd")) fsutil.ife(buffers, lambda line: [True, pwdmanip.PPtoEntry(line)] if not line in usrs else [False, ""]) # Rewrite the password file #for i in ppe: # if not i in usrs: # passwdfile.write(pwdmanip.PPtoEntry(i)) #fsutil.copystat(passwdstat, passwdf) #passwdfile.close() # Now for the group file logger.logVV(self.tn, _("Removing users in /etc/group")) groupf = tmpsys + "etc/group" buffers = fsutil.ife_getbuffers(groupf) pe = pwdmanip.parseGroupEntries(buffers[3]) fsutil.ife(buffers, lambda line: self._parseGroup(line, usrs)) # Work on both shadow files shadowf = tmpsys + "etc/shadow" gshadowf = tmpsys + "etc/gshadow" buffers = fsutil.ife_getbuffers(shadowf) gbuffers = fsutil.ife_getbuffers(gshadowf) pe = pwdmanip.parseShadowEntries(buffers[3]) buffers[3] = pe # If you look carefully (or just do a quick google search :P), you will notice that gshadow files # are very similar to group files, so we can just parse them as if they were group files pe = pwdmanip.parseGroupEntries(gbuffers[3]) gbuffers[3] = pe logger.logVV(self.tn, _("Removing users in /etc/shadow")) fsutil.ife(buffers, lambda line: self._parseShadow(line, usrs)) logger.logVV(self.tn, _("Removing users in /etc/gshadow")) fsutil.ife(gbuffers, lambda line: self._parseGroup(line, usrs)) logger.logI(self.tn, _("Applying permissions to casper scripts"))