From: Josh Durgin Date: Wed, 10 Jul 2013 01:52:00 +0000 (-0700) Subject: misc: move system type checking to a generic location X-Git-Tag: 1.1.0~2068^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=42b9ea95dab7ba443fae5f4d7fb98ccc1602e117;p=teuthology.git misc: move system type checking to a generic location Signed-off-by: Josh Durgin --- diff --git a/teuthology/misc.py b/teuthology/misc.py index cef9b7d7b..154456be8 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -867,3 +867,21 @@ def stop_daemons_of_type(ctx, type_): log.exception('Saw exception from %s.%s', daemon.role, daemon.id_) if exc_info != (None, None, None): raise exc_info[0], exc_info[1], exc_info[2] + +def get_system_type(remote): + """ + Return this system type (deb or rpm) + """ + r = remote.run( + args=[ + 'sudo','lsb_release', '-is', + ], + stdout=StringIO(), + ) + system_value = r.stdout.getvalue().strip() + log.debug("System to be installed: %s" % system_value) + if system_value in ['Ubuntu','Debian']: + return "deb" + if system_value in ['CentOS','Fedora','RedHatEnterpriseServer']: + return "rpm" + return system_value diff --git a/teuthology/task/install.py b/teuthology/task/install.py index ad8d81dda..6e1e6d0d9 100644 --- a/teuthology/task/install.py +++ b/teuthology/task/install.py @@ -14,24 +14,6 @@ log = logging.getLogger(__name__) # Should the RELEASE value get extracted from somewhere? RELEASE = "1-0" -def _get_system_type(remote): - """ - Return this system type (for example, deb or rpm) - """ - r = remote.run( - args=[ - 'sudo','lsb_release', '-is', - ], - stdout=StringIO(), - ) - system_value = r.stdout.getvalue().strip() - log.debug("System to be installed: %s" % system_value) - if system_value in ['Ubuntu','Debian']: - return "deb" - if system_value in ['CentOS','Fedora','RedHatEnterpriseServer']: - return "rpm" - return system_value - def _get_baseurlinfo_and_dist(ctx, remote, config): retval = {} relval = None @@ -273,7 +255,7 @@ def install_packages(ctx, pkgs, config): } with parallel() as p: for remote in ctx.cluster.remotes.iterkeys(): - system_type = _get_system_type(remote) + system_type = teuthology.get_system_type(remote) p.spawn( install_pkgs[system_type], ctx, remote, pkgs[system_type], config) @@ -356,7 +338,7 @@ def remove_packages(ctx, config, pkgs): } with parallel() as p: for remote in ctx.cluster.remotes.iterkeys(): - system_type = _get_system_type(remote) + system_type = teuthology.get_system_type(remote) p.spawn(remove_pkgs[system_type], ctx, config, remote, pkgs[system_type]) def _remove_sources_list_deb(remote, proj): @@ -408,7 +390,7 @@ def remove_sources(ctx, config): log.info("Removing {proj} sources lists".format(proj=config.get('project', 'ceph'))) with parallel() as p: for remote in ctx.cluster.remotes.iterkeys(): - system_type = _get_system_type(remote) + system_type = teuthology.get_system_type(remote) p.spawn(remove_sources_pkgs[system_type], remote, config.get('project', 'ceph')) deb_packages = {'ceph': [