]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
install: functions "uninstall" and "purge" merged to function "remove" 359/head
authorOwen Synge <osynge@suse.com>
Thu, 24 Sep 2015 11:45:40 +0000 (13:45 +0200)
committerOwen Synge <osynge@suse.com>
Wed, 30 Sep 2015 09:35:25 +0000 (11:35 +0200)
Before this patch functions "uninstall" and "purge" are almost identical.
Since the only difference is the logging messages, and when the
distro.uninstall() function is called a boolean parameter set both these
functions are merged into a single command "remove" with the parameter
purge.

Signed-off-by: Owen Synge <osynge@suse.com>
foo

ceph_deploy/install.py

index 7758af97e8105f4e28ba1202d528262b59d20175..8b1f545f86c78c49554af20e90bdc590889632f1 100644 (file)
@@ -293,12 +293,15 @@ def install_repo(args):
 
         custom_repo(distro, args, cd_conf, rlogger, install_ceph=False)
 
-
-def uninstall(args):
+def remove(args, purge):
     LOG.info('note that some dependencies *will not* be removed because they can cause issues with qemu-kvm')
     LOG.info('like: librbd1 and librados2')
+    remove_action = 'Uninstalling'
+    if purge:
+        remove_action = 'Purging'
     LOG.debug(
-        'Uninstalling on cluster %s hosts %s',
+        '%s on cluster %s hosts %s',
+        remove_action,
         args.cluster,
         ' '.join(args.host),
         )
@@ -312,35 +315,15 @@ def uninstall(args):
             use_rhceph=True)
         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)
+        rlogger.info('%s Ceph on %s' % (remove_action, hostname))
+        distro.uninstall(distro, purge=purge)
         distro.conn.exit()
 
+def uninstall(args):
+    remove(args, False)
 
 def purge(args):
-    LOG.info('note that some dependencies *will not* be removed because they can cause issues with qemu-kvm')
-    LOG.info('like: librbd1 and librados2')
-
-    LOG.debug(
-        'Purging from cluster %s hosts %s',
-        args.cluster,
-        ' '.join(args.host),
-        )
-
-    for hostname in args.host:
-        LOG.debug('Detecting platform for host %s ...', hostname)
-
-        distro = hosts.get(
-            hostname,
-            username=args.username,
-            use_rhceph=True
-        )
-        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, purge=True)
-        distro.conn.exit()
-
+    remove(args, True)
 
 def purgedata(args):
     LOG.debug(