]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
add repo install to suse
authorAlfredo Deza <alfredo.deza@inktank.com>
Wed, 12 Mar 2014 20:08:37 +0000 (16:08 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Wed, 12 Mar 2014 20:08:37 +0000 (16:08 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/hosts/suse/__init__.py
ceph_deploy/hosts/suse/install.py

index 09c7154b3f16fb5016d7591fb1755479ab1264cb..132d65100001edc23d068553e0ccce114aec24a1 100644 (file)
@@ -1,5 +1,5 @@
 import mon, pkg
-from install import install, mirror_install
+from install import install, mirror_install, repo_install
 from uninstall import uninstall
 
 # Allow to set some information about this distro
index 471a892d7e1469bc55d6a5fb681247474418f271..fc45ac2355ee6545b555cd052f9af035632b55f5 100644 (file)
@@ -1,4 +1,4 @@
-from ceph_deploy.util import templates
+from ceph_deploy.util import templates, pkg_managers
 from ceph_deploy.lib.remoto import process
 
 
@@ -97,3 +97,44 @@ def mirror_install(distro, repo_url, gpg_url, adjust_repos):
             'ceph',
             ],
         )
+
+
+def repo_install(distro, repo_name, baseurl, gpgkey, **kw):
+    # Get some defaults
+    name = kw.get('name', '%s repo' % repo_name)
+    enabled = kw.get('enabled', 1)
+    gpgcheck = kw.get('gpgcheck', 1)
+    install_ceph = kw.pop('install_ceph', False)
+    _type = 'repo-md'
+    baseurl = baseurl.strip('/')  # Remove trailing slashes
+
+    process.run(
+        distro.conn,
+        [
+            'rpm',
+            '--import',
+            gpgkey,
+        ]
+    )
+
+    repo_content = templates.custom_repo.format(
+        repo_name=repo_name,
+        name = name,
+        baseurl = baseurl,
+        enabled = enabled,
+        gpgcheck = gpgcheck,
+        _type = _type,
+        gpgkey = gpgkey,
+    )
+
+    distro.conn.remote_module.write_yum_repo(
+        repo_content,
+        "%s.repo" % repo_name
+    )
+
+    # Some custom repos do not need to install ceph
+    if install_ceph:
+        # Before any install, make sure we have `wget`
+        pkg_managers.zypper(distro.conn, 'wget')
+
+        pkg_managers.zypper(distro.conn, 'ceph')