From: Travis Rhoden Date: Wed, 15 Jul 2015 21:28:12 +0000 (+0000) Subject: [RM-12259] Pass full distro module to uninstall() X-Git-Tag: v1.5.26~3^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5468bf93ed54bd8feaaaa4908486b64efdf59975;p=ceph-deploy.git [RM-12259] Pass full distro module to uninstall() Not having the distro modules be objects shows it's limitations here, as there is no easy way for a module to reference itself. Technically you could reference itself by name (e.g. have the fedora module use ceph_deploy.hosts.fedora.packager), but that is pretty ugly and continues to rely on global vars. For now, just pass the full distro module instead of distro.conn so that we can easily access distro.* attributes. Signed-off-by: Travis Rhoden --- diff --git a/ceph_deploy/hosts/centos/uninstall.py b/ceph_deploy/hosts/centos/uninstall.py index 463892b..6fdd9c6 100644 --- a/ceph_deploy/hosts/centos/uninstall.py +++ b/ceph_deploy/hosts/centos/uninstall.py @@ -1,7 +1,7 @@ from ceph_deploy.util import pkg_managers -def uninstall(conn, purge=False): +def uninstall(distro, purge=False): packages = [ 'ceph', 'ceph-release', @@ -10,8 +10,8 @@ def uninstall(conn, purge=False): ] pkg_managers.yum_remove( - conn, + distro.conn, packages, ) - pkg_managers.yum_clean(conn) + pkg_managers.yum_clean(distro.conn) diff --git a/ceph_deploy/hosts/debian/uninstall.py b/ceph_deploy/hosts/debian/uninstall.py index ce2013f..6e55586 100644 --- a/ceph_deploy/hosts/debian/uninstall.py +++ b/ceph_deploy/hosts/debian/uninstall.py @@ -1,7 +1,7 @@ from ceph_deploy.util import pkg_managers -def uninstall(conn, purge=False): +def uninstall(distro, purge=False): packages = [ 'ceph', 'ceph-mds', @@ -10,7 +10,7 @@ def uninstall(conn, purge=False): 'radosgw', ] pkg_managers.apt_remove( - conn, + distro.conn, packages, purge=purge, ) diff --git a/ceph_deploy/hosts/fedora/uninstall.py b/ceph_deploy/hosts/fedora/uninstall.py index 1b032c8..b70ac70 100644 --- a/ceph_deploy/hosts/fedora/uninstall.py +++ b/ceph_deploy/hosts/fedora/uninstall.py @@ -1,7 +1,7 @@ from ceph_deploy.util import pkg_managers -def uninstall(conn, purge=False): +def uninstall(distro, purge=False): packages = [ 'ceph', 'ceph-common', @@ -9,7 +9,7 @@ def uninstall(conn, purge=False): ] pkg_managers.yum_remove( - conn, + distro.conn, packages, ) diff --git a/ceph_deploy/hosts/rhel/uninstall.py b/ceph_deploy/hosts/rhel/uninstall.py index 8660505..daf2cf6 100644 --- a/ceph_deploy/hosts/rhel/uninstall.py +++ b/ceph_deploy/hosts/rhel/uninstall.py @@ -1,7 +1,7 @@ from ceph_deploy.util import pkg_managers -def uninstall(conn, purge=False): +def uninstall(distro, purge=False): packages = [ 'ceph', 'ceph-common', @@ -11,8 +11,8 @@ def uninstall(conn, purge=False): ] pkg_managers.yum_remove( - conn, + distro.conn, packages, ) - pkg_managers.yum_clean(conn) + pkg_managers.yum_clean(distro.conn) diff --git a/ceph_deploy/hosts/suse/uninstall.py b/ceph_deploy/hosts/suse/uninstall.py index fa85dec..5128c09 100644 --- a/ceph_deploy/hosts/suse/uninstall.py +++ b/ceph_deploy/hosts/suse/uninstall.py @@ -1,7 +1,7 @@ from ceph_deploy.util import pkg_managers -def uninstall(conn, purge=False): +def uninstall(distro, purge=False): packages = [ 'ceph', 'ceph-common', @@ -10,4 +10,4 @@ def uninstall(conn, purge=False): 'librbd1', 'ceph-radosgw', ] - pkg_managers.zypper_remove(conn, packages) + pkg_managers.zypper_remove(distro.conn, packages) diff --git a/ceph_deploy/install.py b/ceph_deploy/install.py index 19ccea8..10cec3b 100644 --- a/ceph_deploy/install.py +++ b/ceph_deploy/install.py @@ -312,7 +312,7 @@ def uninstall(args): LOG.info('Distro info: %s %s %s', distro.name, distro.release, distro.codename) rlogger = logging.getLogger(hostname) rlogger.info('uninstalling ceph on %s' % hostname) - distro.uninstall(distro.conn) + distro.uninstall(distro) distro.conn.exit() @@ -337,7 +337,7 @@ def purge(args): LOG.info('Distro info: %s %s %s', distro.name, distro.release, distro.codename) rlogger = logging.getLogger(hostname) rlogger.info('purging host ... %s' % hostname) - distro.uninstall(distro.conn, purge=True) + distro.uninstall(distro, purge=True) distro.conn.exit()