From: Alfredo Deza Date: Wed, 12 Mar 2014 20:08:37 +0000 (-0400) Subject: add repo install to suse X-Git-Tag: v1.4.0~5^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cff730e705441f1f69f6c556fe7177fd58063cb5;p=ceph-deploy.git add repo install to suse Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/hosts/suse/__init__.py b/ceph_deploy/hosts/suse/__init__.py index 09c7154..132d651 100644 --- a/ceph_deploy/hosts/suse/__init__.py +++ b/ceph_deploy/hosts/suse/__init__.py @@ -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 diff --git a/ceph_deploy/hosts/suse/install.py b/ceph_deploy/hosts/suse/install.py index 471a892..fc45ac2 100644 --- a/ceph_deploy/hosts/suse/install.py +++ b/ceph_deploy/hosts/suse/install.py @@ -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')