Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion answerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def parseReinstall(self):
def parseUpgrade(self):
results = {}

results['install-type'] = INSTALL_TYPE_REINSTALL
results['install-type'] = INSTALL_TYPE_UPGRADE
results['preserve-settings'] = True
results['backup-existing-installation'] = True
results.update(self.parseExistingInstallation())
Expand Down
6 changes: 3 additions & 3 deletions backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def getPrepSequence(ans, interactive):
Task(writeDom0DiskPartitions, A(ans, 'primary-disk', 'boot-partnum', 'primary-partnum', 'backup-partnum', 'logs-partnum', 'swap-partnum', 'storage-partnum', 'sr-at-end'),[]),
]
seq.append(Task(writeGuestDiskPartitions, A(ans,'primary-disk', 'guest-disks'), []))
elif ans['install-type'] == INSTALL_TYPE_REINSTALL:
elif ans['install-type'] == INSTALL_TYPE_UPGRADE:
seq.append(Task(getUpgrader, A(ans, 'installation-to-overwrite'), ['upgrader']))
if 'backup-existing-installation' in ans and ans['backup-existing-installation']:
seq.append(Task(doBackup,
Expand Down Expand Up @@ -211,7 +211,7 @@ def getFinalisationSequence(ans):
if ans['ntp-config-method'] != "none":
seq.append(Task(configureNTP, A(ans, 'mounts', 'ntp-config-method', 'ntp-servers'), []))
# complete upgrade if appropriate:
if ans['install-type'] == constants.INSTALL_TYPE_REINSTALL:
if ans['install-type'] == constants.INSTALL_TYPE_UPGRADE:
seq.append( Task(completeUpgrade, lambda a: [ a['upgrader'] ] + [ a[x] for x in a['upgrader'].completeUpgradeArgs ], []) )

# run the users's scripts
Expand Down Expand Up @@ -1099,7 +1099,7 @@ def installBootLoader(mounts, disk, boot_partnum, primary_partnum, branding,
def setEfiBootEntry(mounts, disk, boot_partnum, install_type, branding):
def check_efibootmgr_err(rc, err, install_type, err_type):
if rc != 0:
if install_type in (INSTALL_TYPE_REINSTALL, INSTALL_TYPE_RESTORE):
if install_type in (INSTALL_TYPE_UPGRADE, INSTALL_TYPE_RESTORE):
logger.error("%s: %s" % (err_type, err))
else:
raise RuntimeError("%s: %s" % (err_type, err))
Expand Down
2 changes: 1 addition & 1 deletion constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# install types:
INSTALL_TYPE_FRESH = "fresh"
INSTALL_TYPE_REINSTALL = "reinstall"
INSTALL_TYPE_UPGRADE = "upgrade"
INSTALL_TYPE_RESTORE = "restore"

# sr types:
Expand Down
14 changes: 7 additions & 7 deletions tui/installer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def only_unupgradeable_products(answers):
len(answers['backups']) == 0

def upgrade_but_no_settings_predicate(answers):
return answers['install-type'] == constants.INSTALL_TYPE_REINSTALL and \
return answers['install-type'] == constants.INSTALL_TYPE_UPGRADE and \
('installation-to-overwrite' not in answers or \
not answers['installation-to-overwrite'].settingsAvailable())

has_multiple_nics = lambda a: len(a['network-hardware'].keys()) > 1

is_reinstall_fn = lambda a: a['install-type'] == constants.INSTALL_TYPE_REINSTALL
is_upgrade_fn = lambda a: a['install-type'] == constants.INSTALL_TYPE_UPGRADE
is_clean_install_fn = lambda a: a['install-type'] == constants.INSTALL_TYPE_FRESH
is_not_restore_fn = lambda a: a['install-type'] != constants.INSTALL_TYPE_RESTORE

Expand Down Expand Up @@ -143,17 +143,17 @@ def has_guest_disks_fn(answers):
Step(uis.upgrade_settings_warning,
predicates=[upgrade_but_no_settings_predicate]),
Step(uis.ha_master_upgrade,
predicates=[is_reinstall_fn, ha_enabled]),
predicates=[is_upgrade_fn, ha_enabled]),
Step(uis.remind_driver_repos,
predicates=[is_reinstall_fn, preserve_settings]),
predicates=[is_upgrade_fn, preserve_settings]),
Step(uis.backup_existing_installation,
predicates=[is_reinstall_fn, optional_backup]),
predicates=[is_upgrade_fn, optional_backup]),
Step(uis.force_backup_screen,
predicates=[is_reinstall_fn, requires_backup]),
predicates=[is_upgrade_fn, requires_backup]),
Step(uis.select_primary_disk,
predicates=[is_clean_install_fn]),
Step(uis.repartition_existing,
predicates=[is_reinstall_fn, requires_repartition]),
predicates=[is_upgrade_fn, requires_repartition]),
Step(uis.select_guest_disks,
predicates=[is_clean_install_fn]),
Step(uis.get_sr_type,
Expand Down
6 changes: 3 additions & 3 deletions tui/installer/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def get_installation_type(answers):
entries.append( ("Perform clean installation", None) )

# default value?
if 'install-type' in answers and answers['install-type'] == constants.INSTALL_TYPE_REINSTALL:
if 'install-type' in answers and answers['install-type'] == constants.INSTALL_TYPE_UPGRADE:
default = selectDefault(answers['installation-to-overwrite'], entries)
elif 'install-type' in answers and answers['install-type'] == constants.INSTALL_TYPE_RESTORE:
default = selectDefault(answers['backup-to-restore'], entries)
Expand Down Expand Up @@ -299,7 +299,7 @@ def more_info(context):
if 'installation-to-overwrite' in answers:
del answers['installation-to-overwrite']
elif isinstance(entry[0], product.ExistingInstallation):
answers['install-type'] = constants.INSTALL_TYPE_REINSTALL
answers['install-type'] = constants.INSTALL_TYPE_UPGRADE
answers['installation-to-overwrite'], preservable = entry
answers['preserve-settings'] = preservable
if 'primary-disk' not in answers:
Expand Down Expand Up @@ -766,7 +766,7 @@ def confirm_installation(answers):
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:
elif answers['install-type'] == constants.INSTALL_TYPE_UPGRADE:
if answers['primary-disk'] == answers['installation-to-overwrite'].primary_disk:
text2 = "The installation will be performed over %s" % str(answers['installation-to-overwrite'])
else:
Expand Down