diff options
author | Chris Lumens <clumens@redhat.com> | 2009-02-13 13:13:25 -0500 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2009-02-16 10:59:39 -0500 |
commit | 87bf4551dbd14722f8400b973d9dd6f98b16710c (patch) | |
tree | b70a96d28d000557c31541ea0c4cf00d7f9a9133 /installclasses | |
parent | a395392eca0abb3dfd2d7e66665d0621360c32f0 (diff) | |
download | anaconda-87bf4551dbd14722f8400b973d9dd6f98b16710c.tar.gz anaconda-87bf4551dbd14722f8400b973d9dd6f98b16710c.tar.xz anaconda-87bf4551dbd14722f8400b973d9dd6f98b16710c.zip |
Encode our upgrade policy in productMatches/versionMatches and enforce it.
For Fedora, this means we will not allow upgrades of detected root filesystems
more than two releases old, or "upgrading" a newer install with an older one.
For RHEL, we don't yet know what to do so just allow things to continue as they
always have. Using "upgradeany" still circumvents this check.
Diffstat (limited to 'installclasses')
-rw-r--r-- | installclasses/fedora.py | 32 | ||||
-rw-r--r-- | installclasses/rhel.py | 37 |
2 files changed, 69 insertions, 0 deletions
diff --git a/installclasses/fedora.py b/installclasses/fedora.py index 3e529c501..0eda0b5c8 100644 --- a/installclasses/fedora.py +++ b/installclasses/fedora.py @@ -19,6 +19,7 @@ from installclass import BaseInstallClass from constants import * +from product import * from filer import * from flags import flags import os, types @@ -76,5 +77,36 @@ class InstallClass(BaseInstallClass): else: return yuminstall.YumBackend + def productMatches(self, oldprod): + if oldprod.startswith(productName): + return True + + productUpgrades = { + "Fedora Core": ("Red Hat Linux", ), + "Fedora": ("Fedora Core", ) + } + + if productUpgrades.has_key(productName): + acceptable = productUpgrades[productName] + else: + acceptable = () + + for p in acceptable: + if oldprod.startswith(p): + return True + + return False + + def versionMatches(self, oldver): + try: + oldVer = float(oldver) + newVer = float(productVersion) + except ValueError: + return True + + # This line means we do not support upgrading from anything older + # than two versions ago! + return newVer > oldVer and newVer - oldVer <= 2 + def __init__(self): BaseInstallClass.__init__(self) diff --git a/installclasses/rhel.py b/installclasses/rhel.py index 668e9cb53..ddfb89700 100644 --- a/installclasses/rhel.py +++ b/installclasses/rhel.py @@ -19,6 +19,7 @@ from installclass import BaseInstallClass from constants import * +from product import * from filer import * from flags import flags import os @@ -177,6 +178,42 @@ class InstallClass(BaseInstallClass): def getBackend(self): return yuminstall.YumBackend + def productMatches(self, oldprod): + if oldprod.startswith(productName): + return True + + productUpgrades = { + "Red Hat Enterprise Linux AS": ("Red Hat Linux Advanced Server", ), + "Red Hat Enterprise Linux WS": ("Red Hat Linux Advanced Workstation",), + # FIXME: this probably shouldn't be in a release... + "Red Hat Enterprise Linux": ("Red Hat Linux Advanced Server", + "Red Hat Linux Advanced Workstation", + "Red Hat Enterprise Linux AS", + "Red Hat Enterprise Linux ES", + "Red Hat Enterprise Linux WS"), + "Red Hat Enterprise Linux Server": ("Red Hat Enterprise Linux AS", + "Red Hat Enterprise Linux ES", + "Red Hat Enterprise Linux WS", + "Red Hat Enterprise Linux"), + "Red Hat Enterprise Linux Client": ("Red Hat Enterprise Linux WS", + "Red Hat Enterprise Linux Desktop", + "Red Hat Enterprise Linux"), + } + + if productUpgrades.has_key(productName): + acceptable = productUpgrades[productName] + else: + acceptable = () + + for p in acceptable: + if oldprod.startswith(p): + return True + + return False + + def versionMatches(self, oldver): + return True + def __init__(self): BaseInstallClass.__init__(self) |