diff options
author | Brenton Leanhardt <bleanhar@redhat.com> | 2015-10-27 15:57:22 -0400 |
---|---|---|
committer | Brenton Leanhardt <bleanhar@redhat.com> | 2015-10-27 15:57:22 -0400 |
commit | 92c2fef6dc571d6568eb46391d1f9f0c8a1bc8b5 (patch) | |
tree | 580b32845b21ad78792c009573b4c4850a7b6f87 /utils/src/ooinstall/variants.py | |
parent | f450c935f69366a15e078ec11b82bfa0c7130f6d (diff) | |
parent | e5a8e1589774130c59b166419543709f40a6766e (diff) | |
download | openshift-92c2fef6dc571d6568eb46391d1f9f0c8a1bc8b5.tar.gz openshift-92c2fef6dc571d6568eb46391d1f9f0c8a1bc8b5.tar.bz2 openshift-92c2fef6dc571d6568eb46391d1f9f0c8a1bc8b5.tar.xz openshift-92c2fef6dc571d6568eb46391d1f9f0c8a1bc8b5.zip |
Merge pull request #741 from tdawson/2015-10-utils
Add atomic-openshift-utils
Diffstat (limited to 'utils/src/ooinstall/variants.py')
-rw-r--r-- | utils/src/ooinstall/variants.py | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/utils/src/ooinstall/variants.py b/utils/src/ooinstall/variants.py new file mode 100644 index 000000000..ed98429fc --- /dev/null +++ b/utils/src/ooinstall/variants.py @@ -0,0 +1,74 @@ +# TODO: Temporarily disabled due to importing old code into openshift-ansible +# repo. We will work on these over time. +# pylint: disable=bad-continuation,missing-docstring,no-self-use,invalid-name,too-few-public-methods + +""" +Defines the supported variants and versions the installer supports, and metadata +required to run Ansible correctly. + +This module needs to be updated for each major release to allow the new version +to be specified by the user, and to point the generic variants to the latest +version. +""" + + +class Version(object): + def __init__(self, name, ansible_key): + self.name = name # i.e. 3.0, 3.1 + + self.ansible_key = ansible_key + + +class Variant(object): + def __init__(self, name, description, versions): + # Supported variant name: + self.name = name + + # Friendly name for the variant: + self.description = description + + self.versions = versions + + +# WARNING: Keep the versions ordered, most recent last: +OSE = Variant('openshift-enterprise', 'OpenShift Enterprise', + [ + Version('3.0', 'enterprise'), + Version('3.1', 'openshift-enterprise') + ] +) + +AEP = Variant('atomic-enterprise', 'Atomic OpenShift Enterprise', + [ + Version('3.1', 'atomic-enterprise') + ] +) + +# Ordered list of variants we can install, first is the default. +SUPPORTED_VARIANTS = (OSE, AEP) + + +def find_variant(name, version=None): + """ + Locate the variant object for the variant given in config file, and + the correct version to use for it. + Return (None, None) if we can't find a match. + """ + prod = None + for prod in SUPPORTED_VARIANTS: + if prod.name == name: + if version is None: + return (prod, prod.versions[-1]) + for v in prod.versions: + if v.name == version: + return (prod, v) + + return (None, None) + +def get_variant_version_combos(): + combos = [] + for variant in SUPPORTED_VARIANTS: + for ver in variant.versions: + combos.append((variant, ver)) + return combos + |