Skip to content

Instantly share code, notes, and snippets.

@cholcombe973
Last active July 14, 2016 19:36
Show Gist options
  • Save cholcombe973/6c828e322080454063dd1decc7d7ad25 to your computer and use it in GitHub Desktop.
Save cholcombe973/6c828e322080454063dd1decc7d7ad25 to your computer and use it in GitHub Desktop.
VERSION_TABLE = {
0.80: 'firefly', # LTS
0.87: 'giant',
0.94: 'hammer', # LTS
9.2: 'infernalis',
10.2: 'jewel', # LTS
}
def import_ceph_api():
"""
This will import the correct ceph_api version that matches the
running ceph version.
"""
ceph_version = get_version()
if ceph_version in VERSION_TABLE:
version = VERSION_TABLE[ceph_version]
log("Importing module ceph_api.{version}.ceph_command".format(
version=version), level=DEBUG)
importlib.import_module(
"ceph_api.{version}.ceph_command".format(version=version))
else:
log("Unable to import ceph_api library for version: {}".format(
ceph_version), level=ERROR)
raise ImportError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment