def interactive_source_verification(repos, label): cap_label = ' '.join(map(lambda a: a.capitalize(), label.split())) errors = [] pd = tui.progress.initProgressDialog("Verifying %s Source" % cap_label, "Initializing...", len(repos) * 100) tui.progress.displayProgressDialog(0, pd) for i in range(len(repos)): r = repos[i] def progress(x): #print i * 100 + x tui.progress.displayProgressDialog(i * 100 + x, pd, "Checking %s..." % r.name()) errors.extend(r.check(progress)) tui.progress.clearModelessDialog() if len(errors) != 0: errtxt = generalui.makeHumanList([x.name for x in errors]) ButtonChoiceWindow( tui.screen, "Problems Found", "Some packages appeared damaged. These were: %s" % errtxt, ['Ok']) return False else: repo_names = generalui.makeHumanList( ['"%s"' % x.name() for x in repos]) ButtonChoiceWindow( tui.screen, "Verification Successful", "Verification of your %s(s) %s completed successfully: no problems were found." % (label, repo_names), ['Ok']) return True
def interactive_source_verification(repos, label): cap_label = ' '.join(map(lambda a: a.capitalize(), label.split())) errors = [] pd = tui.progress.initProgressDialog( "Verifying %s Source" % cap_label, "Initializing...", len(repos) * 100 ) tui.progress.displayProgressDialog(0, pd) for i in range(len(repos)): r = repos[i] def progress(x): #print i * 100 + x tui.progress.displayProgressDialog(i*100 + x, pd, "Checking %s..." % r._name) errors.extend(r.check(progress)) tui.progress.clearModelessDialog() if len(errors) != 0: errtxt = generalui.makeHumanList([x.name for x in errors]) ButtonChoiceWindow( tui.screen, "Problems Found", "Some packages appeared damaged. These were: %s" % errtxt, ['Ok'] ) return False else: repo_names = generalui.makeHumanList( ['"%s"' %x.name() for x in repos]) ButtonChoiceWindow( tui.screen, "Verification Successful", "Verification of your %s(s) %s completed successfully: no problems were found." % (label, repo_names), ['Ok'] ) return True
def confirm_installation(answers): if answers['install-type'] == constants.INSTALL_TYPE_RESTORE: backup = answers['backup-to-restore'] label = "Confirm Restore" text = "Are you sure you want to restore your installation with the backup on %s?\n\nYour existing installation will be overwritten with the backup (though VMs will still be intact).\n\nTHIS OPERATION CANNOT BE UNDONE." % diskutil.getHumanDiskName(backup.partition) ok = 'Restore %s' % MY_PRODUCT_BRAND else: label = "Confirm Installation" text1 = "We have collected all the information required to install %s. " % MY_PRODUCT_BRAND if answers['install-type'] == constants.INSTALL_TYPE_FRESH: disks = map(diskutil.getHumanDiskName, answers['guest-disks']) if diskutil.getHumanDiskName(answers['primary-disk']) not in disks: disks.append(diskutil.getHumanDiskName(answers['primary-disk'])) disks.sort() if len(disks) == 1: term = 'disk' else: term = 'disks' disks_used = generalui.makeHumanList(disks) text2 = "Please confirm you wish to proceed: all data on %s %s will be destroyed!" % (term, disks_used) elif answers['install-type'] == constants.INSTALL_TYPE_REINSTALL: if answers['primary-disk'] == answers['installation-to-overwrite'].primary_disk: text2 = "The installation will be performed over %s" % str(answers['installation-to-overwrite']) else: text2 = "Setup will migrate the %s installation from %s to %s" % (str(answers['installation-to-overwrite']), diskutil.getHumanDiskName(answers['installation-to-overwrite'].primary_disk), diskutil.getHumanDiskName(answers['primary-disk'])) text2 += ", preserving existing %s in your storage repository." % BRAND_GUESTS text = text1 + "\n\n" + text2 ok = 'Install %s' % MY_PRODUCT_BRAND button = snackutil.ButtonChoiceWindowEx( tui.screen, label, text, [ok, 'Back'], default = 1, width = 50, help = 'confirm' ) if button == None or button == 'back': return LEFT_BACKWARDS return RIGHT_FORWARDS
def confirm_erase_volume_groups(answers): problems = diskutil.findProblematicVGs(answers['guest-disks']) if len(problems) == 0: return SKIP_SCREEN if len(problems) == 1: xelogging.log("Problematic VGs: %s" % problems) affected = "The volume group affected is %s. Are you sure you wish to continue?" % problems[0] elif len(problems) > 1: affected = "The volume groups affected are %s. Are you sure you wish to continue?" % generalui.makeHumanList(problems) button = ButtonChoiceWindow(tui.screen, "Conflicting LVM Volume Groups", """Some or all of the disks you selected to install %s onto contain parts of LVM volume groups. Proceeding with the installation will cause these volume groups to be deleted. %s""" % (MY_PRODUCT_BRAND, affected), ['Continue', 'Back'], width=60, help = 'erasevg') if button == 'back': return LEFT_BACKWARDS return RIGHT_FORWARDS