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
-from ceph_deploy.util import templates
+from ceph_deploy.util import templates, pkg_managers
from ceph_deploy.lib.remoto import process
'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')