]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
[RM-12439] debian: use Apt Class pkg manager
authorTravis Rhoden <trhoden@redhat.com>
Fri, 31 Jul 2015 23:58:53 +0000 (16:58 -0700)
committerTravis Rhoden <trhoden@redhat.com>
Mon, 3 Aug 2015 22:56:12 +0000 (15:56 -0700)
Refs: #12439

Signed-off-by: Travis Rhoden <trhoden@redhat.com>
ceph_deploy/hosts/__init__.py
ceph_deploy/hosts/debian/__init__.py
ceph_deploy/hosts/debian/install.py
ceph_deploy/hosts/debian/uninstall.py

index e725882c39c1d69d47afa676ff79a0cf822f713d..297f34206f967cba5fa64df59523ae46ccb3f2b6 100644 (file)
@@ -69,7 +69,8 @@ def get(hostname,
     module.conn = conn
     module.machine_type = machine_type
     module.init = module.choose_init()
-    if module.normalized_name in ['fedora', 'centos', 'redhat']:
+    if module.normalized_name in ['fedora', 'centos', 'redhat',
+                                  'ubuntu', 'debian']:
         module.packager = module.get_packager(module)
     return module
 
index 654d838160af7073e308632dfddabb650b666e63..7453b6ba6ef36a1c3661fc38ce7649fcab1dea61 100644 (file)
@@ -2,6 +2,7 @@ import mon  # noqa
 import pkg  # noqa
 from install import install, mirror_install, repo_install  # noqa
 from uninstall import uninstall  # noqa
+from ceph_deploy.util import pkg_managers
 
 # Allow to set some information about this distro
 #
@@ -19,3 +20,7 @@ def choose_init():
     if distro.lower() == 'ubuntu':
         return 'upstart'
     return 'sysvinit'
+
+
+def get_packager(module):
+    return pkg_managers.Apt(module)
index 69447582cad706b419f39c53f1865d77f596f0fe..58d755f8a783ca5845d75c8cd7979c5bf88e1e84 100644 (file)
@@ -1,7 +1,6 @@
 from urlparse import urlparse
 
 from ceph_deploy.lib import remoto
-from ceph_deploy.util import pkg_managers
 from ceph_deploy.util.paths import gpg
 from ceph_deploy.hosts.common import map_components
 
@@ -22,19 +21,7 @@ def install(distro, version_kind, version, adjust_repos, **kw):
     else:
         key = 'autobuild'
 
-    # Make sure ca-certificates is installed
-    remoto.process.run(
-        distro.conn,
-        [
-            'env',
-            'DEBIAN_FRONTEND=noninteractive',
-            'apt-get',
-            '-q',
-            'install',
-            '--assume-yes',
-            'ca-certificates',
-        ]
-    )
+    distro.packager.install('ca-certificates')
 
     if adjust_repos:
         # Wheezy does not like the git.ceph.com SSL cert
@@ -81,30 +68,11 @@ def install(distro, version_kind, version, adjust_repos, **kw):
         distro.conn.remote_module.set_apt_priority(fqdn)
         distro.conn.remote_module.write_sources_list(url, codename)
 
-    remoto.process.run(
-        distro.conn,
-        ['apt-get', '-q', 'update'],
-        )
+    distro.packager.clean()
 
     # TODO this does not downgrade -- should it?
-    if len(packages):
-        cmd = [
-            'env',
-            'DEBIAN_FRONTEND=noninteractive',
-            'DEBIAN_PRIORITY=critical',
-            'apt-get',
-            '-q',
-            '-o', 'Dpkg::Options::=--force-confnew',
-            '--no-install-recommends',
-            '--assume-yes',
-            'install',
-            '--',
-        ]
-        cmd.extend(packages)
-        remoto.process.run(
-            distro.conn,
-            cmd
-        )
+    if packages:
+        distro.packager.install(packages, force_confnew=True)
 
 
 def mirror_install(distro, repo_url, gpg_url, adjust_repos, **kw):
@@ -144,8 +112,9 @@ def mirror_install(distro, repo_url, gpg_url, adjust_repos, **kw):
 
         distro.conn.remote_module.write_sources_list(repo_url, distro.codename)
 
-    pkg_managers.apt_update(distro.conn)
-    pkg_managers.apt(distro.conn, packages)
+    if packages:
+        distro.packager.clean()
+        distro.packager.install(packages)
 
 
 def repo_install(distro, repo_name, baseurl, gpgkey, **kw):
@@ -190,7 +159,7 @@ def repo_install(distro, repo_name, baseurl, gpgkey, **kw):
     distro.conn.remote_module.set_apt_priority(fqdn)
 
     # repo is not operable until an update
-    pkg_managers.apt_update(distro.conn)
+    distro.packager.clean()
 
-    if install_ceph:
-        pkg_managers.apt(distro.conn, packages)
+    if install_ceph and packages:
+        distro.packager.install(packages)
index 6e55586322899516b6bc843c82374163eee7b1fd..42d0ce42e46d8061bb3cc78488c5d6be6e1d49a8 100644 (file)
@@ -1,6 +1,3 @@
-from ceph_deploy.util import pkg_managers
-
-
 def uninstall(distro, purge=False):
     packages = [
         'ceph',
@@ -9,8 +6,7 @@ def uninstall(distro, purge=False):
         'ceph-fs-common',
         'radosgw',
         ]
-    pkg_managers.apt_remove(
-        distro.conn,
+    distro.packager.remove(
         packages,
         purge=purge,
     )