def install_yum_priorities(distro): """ EPEL started packaging Ceph so we need to make sure that the ceph.repo we install has a higher priority than the EPEL repo so that when installing Ceph it will come from the repo file we create. The name of the package changed back and forth (!) since CentOS 4: From the CentOS wiki:: Note: This plugin has carried at least two differing names over time. It is named yum-priorities on CentOS-5 but was named yum-plugin-priorities on CentOS-4. CentOS-6 has reverted to yum-plugin-priorities. """ if distro.normalized_name == 'centos': if distro.release[0] == '6': package_name = 'yum-plugin-priorities' else: package_name = 'yum-priorities' pkg_managers.yum( distro.conn, package_name, )
def install(distro, version_kind, version, adjust_repos): release = distro.release machine = distro.machine_type pkg_managers.yum_clean(distro.conn) # Even before EPEL, make sure we have `wget` pkg_managers.yum(distro.conn, 'wget') # Get EPEL installed before we continue: if adjust_repos: install_epel(distro) if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' if adjust_repos: process.run( distro.conn, [ 'rpm', '--import', "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc".format(key=key) ] ) if version_kind == 'stable': url = 'http://ceph.com/rpm-{version}/el6/'.format( version=version, ) elif version_kind == 'testing': url = 'http://ceph.com/rpm-testing/el6/' elif version_kind == 'dev': url = 'http://gitbuilder.ceph.com/ceph-rpm-centos{release}-{machine}-basic/ref/{version}/'.format( release=release.split(".",1)[0], machine=machine, version=version, ) process.run( distro.conn, [ 'rpm', '-Uvh', '--replacepkgs', '{url}noarch/ceph-release-1-0.el6.noarch.rpm'.format(url=url), ], ) process.run( distro.conn, [ 'yum', '-y', '-q', 'install', 'ceph', ], )
def install(distro, version_kind, version, adjust_repos): release = distro.release machine = distro.machine_type # Even before EPEL, make sure we have `wget` pkg_managers.yum(distro.conn, "wget") # Get EPEL installed before we continue: if adjust_repos: install_epel(distro) if version_kind in ["stable", "testing"]: key = "release" else: key = "autobuild" if adjust_repos: process.run( distro.conn, ["rpm", "--import", "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc".format(key=key)], ) if version_kind == "stable": url = "http://ceph.com/rpm-{version}/el6/".format(version=version) elif version_kind == "testing": url = "http://ceph.com/rpm-testing/" elif version_kind == "dev": url = "http://gitbuilder.ceph.com/ceph-rpm-centos{release}-{machine}-basic/ref/{version}/".format( release=release.split(".", 1)[0], machine=machine, version=version ) process.run( distro.conn, ["rpm", "-Uvh", "--replacepkgs", "{url}noarch/ceph-release-1-0.el6.noarch.rpm".format(url=url)] ) process.run(distro.conn, ["yum", "-y", "-q", "install", "ceph"])
def mirror_install(distro, repo_url, gpg_url, adjust_repos, extra_installs=True): repo_url = repo_url.strip('/') # Remove trailing slashes gpg_url_path = gpg_url.split('file://')[-1] # Remove file if present pkg_managers.yum_clean(distro.conn) if adjust_repos: remoto.process.run( distro.conn, [ 'rpm', '--import', gpg_url_path, ] ) ceph_repo_content = templates.ceph_repo.format( repo_url=repo_url, gpg_url=gpg_url ) distro.conn.remote_module.write_yum_repo(ceph_repo_content) if extra_installs: # Before any install, make sure we have `wget` pkg_managers.yum(distro.conn, 'wget') pkg_managers.yum(distro.conn, 'ceph')
def mirror_install(distro, repo_url, gpg_url, adjust_repos, extra_installs=True, **kw): packages = kw.get('components', []) repo_url = repo_url.strip('/') # Remove trailing slashes gpg_url_path = gpg_url.split('file://')[-1] # Remove file if present pkg_managers.yum_clean(distro.conn) if adjust_repos: remoto.process.run( distro.conn, [ 'rpm', '--import', gpg_url_path, ] ) ceph_repo_content = templates.ceph_repo.format( repo_url=repo_url, gpg_url=gpg_url ) distro.conn.remote_module.write_yum_repo(ceph_repo_content) if extra_installs: pkg_managers.yum(distro.conn, packages)
def test_install_multiple_packages(self): fake_run = Mock() with patch(self.to_patch, fake_run): pkg_managers.yum(Mock(), ['vim', 'zsh']) result = fake_run.call_args_list[-1] assert 'install' in result[0][-1] assert result[0][-1][-2:] == ['vim', 'zsh']
def mirror_install(distro, repo_url, gpg_url, adjust_repos, extra_installs=True): repo_url = repo_url.strip('/') # Remove trailing slashes gpg_url_path = gpg_url.split('file://')[-1] # Remove file if present pkg_managers.yum_clean(distro.conn) if adjust_repos: remoto.process.run( distro.conn, [ 'rpm', '--import', gpg_url_path, ] ) ceph_repo_content = templates.ceph_repo.format( repo_url=repo_url, gpg_url=gpg_url ) distro.conn.remote_module.write_yum_repo(ceph_repo_content) # set the right priority install_yum_priorities(distro) distro.conn.remote_module.set_repo_priority(['Ceph', 'Ceph-noarch', 'ceph-source']) distro.conn.logger.warning('alter.d ceph.repo priorities to contain: priority=1') if extra_installs: pkg_managers.yum(distro.conn, 'ceph')
def repo_install(distro, reponame, baseurl, gpgkey, **kw): # Get some defaults name = kw.get("name", "%s repo" % reponame) enabled = kw.get("enabled", 1) gpgcheck = kw.get("gpgcheck", 1) install_ceph = kw.pop("install_ceph", False) proxy = kw.get("proxy") _type = "repo-md" baseurl = baseurl.strip("/") # Remove trailing slashes pkg_managers.yum_clean(distro.conn) if gpgkey: remoto.process.run(distro.conn, ["rpm", "--import", gpgkey]) repo_content = templates.custom_repo( reponame=reponame, name=name, baseurl=baseurl, enabled=enabled, gpgcheck=gpgcheck, _type=_type, gpgkey=gpgkey, proxy=proxy, ) distro.conn.remote_module.write_yum_repo(repo_content, "%s.repo" % reponame) # Some custom repos do not need to install ceph if install_ceph: # Before any install, make sure we have `wget` pkg_managers.yum(distro.conn, "wget") pkg_managers.yum(distro.conn, "ceph")
def mirror_install(distro, repo_url, gpg_url, adjust_repos, extra_installs=True, **kw): packages = kw.get('components', []) repo_url = repo_url.strip('/') # Remove trailing slashes gpg_url_path = gpg_url.split('file://')[-1] # Remove file if present pkg_managers.yum_clean(distro.conn) if adjust_repos: remoto.process.run(distro.conn, [ 'rpm', '--import', gpg_url_path, ]) ceph_repo_content = templates.ceph_repo.format(repo_url=repo_url, gpg_url=gpg_url) distro.conn.remote_module.write_yum_repo(ceph_repo_content) if extra_installs: pkg_managers.yum(distro.conn, packages)
def test_install_single_package(self): fake_run = Mock() with patch(self.to_patch, fake_run): pkg_managers.yum(Mock(), 'vim') result = fake_run.call_args_list[-1] assert 'install' in result[0][-1] assert result[0][-1][-1] == 'vim'
def install_epel(distro): """ CentOS and Scientific need the EPEL repo, otherwise Ceph cannot be installed. """ if distro.normalized_name in ['centos', 'scientific']: distro.conn.logger.info('adding EPEL repository') pkg_managers.yum(distro.conn, 'epel-release')
def repo_install(distro, reponame, baseurl, gpgkey, **kw): logger = distro.conn.logger # Get some defaults name = kw.pop('name', '%s repo' % reponame) enabled = kw.pop('enabled', 1) gpgcheck = kw.pop('gpgcheck', 1) install_ceph = kw.pop('install_ceph', False) proxy = kw.pop('proxy', '') # will get ignored if empty _type = 'repo-md' baseurl = baseurl.strip('/') # Remove trailing slashes pkg_managers.yum_clean(distro.conn) if gpgkey: remoto.process.run( distro.conn, [ 'rpm', '--import', gpgkey, ] ) repo_content = templates.custom_repo( reponame=reponame, name=name, baseurl=baseurl, enabled=enabled, gpgcheck=gpgcheck, _type=_type, gpgkey=gpgkey, proxy=proxy, **kw ) distro.conn.remote_module.write_yum_repo( repo_content, "%s.repo" % reponame ) repo_path = '/etc/yum.repos.d/{reponame}.repo'.format(reponame=reponame) # set the right priority if kw.get('priority'): install_yum_priorities(distro) logger.warning( 'ensuring that {repo_path} contains a high priority'.format( repo_path=repo_path) ) distro.conn.remote_module.set_repo_priority([reponame], repo_path) logger.warning('altered {reponame}.repo priorities to contain: priority=1'.format( reponame=reponame) ) # Some custom repos do not need to install ceph if install_ceph: pkg_managers.yum(distro.conn, 'ceph')
def mirror_install(distro, repo_url, gpg_url, adjust_repos): repo_url = repo_url.strip("/") # Remove trailing slashes if adjust_repos: process.run(distro.conn, ["rpm", "--import", gpg_url]) ceph_repo_content = templates.ceph_repo.format(repo_url=repo_url, gpg_url=gpg_url) distro.conn.remote_module.write_yum_repo(ceph_repo_content) # Before any install, make sure we have `wget` pkg_managers.yum(distro.conn, "wget") pkg_managers.yum(distro.conn, "ceph")
def repo_install(distro, reponame, baseurl, gpgkey, **kw): # do we have specific components to install? # removed them from `kw` so that we don't mess with other defaults packages = kw.pop('components', []) # Get some defaults name = kw.pop('name', '%s repo' % reponame) enabled = kw.pop('enabled', 1) gpgcheck = kw.pop('gpgcheck', 1) install_ceph = kw.pop('install_ceph', False) proxy = kw.pop('proxy', '') # will get ignored if empty _type = 'repo-md' baseurl = baseurl.strip('/') # Remove trailing slashes pkg_managers.yum_clean(distro.conn) if gpgkey: remoto.process.run( distro.conn, [ 'rpm', '--import', gpgkey, ] ) repo_content = templates.custom_repo( reponame=reponame, name=name, baseurl=baseurl, enabled=enabled, gpgcheck=gpgcheck, _type=_type, gpgkey=gpgkey, proxy=proxy, **kw ) distro.conn.remote_module.write_yum_repo( repo_content, "%s.repo" % reponame ) # Some custom repos do not need to install ceph if install_ceph: pkg_managers.yum(distro.conn, packages)
def repo_install(distro, reponame, baseurl, gpgkey, **kw): # Get some defaults name = kw.get('name', '%s repo' % reponame) enabled = kw.get('enabled', 1) gpgcheck = kw.get('gpgcheck', 1) install_ceph = kw.pop('install_ceph', False) proxy = kw.get('proxy') _type = 'repo-md' baseurl = baseurl.strip('/') # Remove trailing slashes pkg_managers.yum_clean(distro.conn) if gpgkey: remoto.process.run( distro.conn, [ 'rpm', '--import', gpgkey, ] ) repo_content = templates.custom_repo( reponame=reponame, name = name, baseurl = baseurl, enabled = enabled, gpgcheck = gpgcheck, _type = _type, gpgkey = gpgkey, proxy = proxy, ) distro.conn.remote_module.write_yum_repo( repo_content, "%s.repo" % reponame ) # Some custom repos do not need to install ceph if install_ceph: # Before any install, make sure we have `wget` pkg_managers.yum(distro.conn, 'wget') pkg_managers.yum(distro.conn, 'ceph')
def mirror_install(distro, repo_url, gpg_url, adjust_repos): repo_url = repo_url.strip('/') # Remove trailing slashes if adjust_repos: process.run( distro.conn, [ 'rpm', '--import', gpg_url, ] ) ceph_repo_content = templates.ceph_repo.format( repo_url=repo_url, gpg_url=gpg_url ) distro.conn.remote_module.write_yum_repo(ceph_repo_content) pkg_managers.yum(distro.conn, 'ceph')
def repo_install(distro, reponame, baseurl, gpgkey, **kw): # do we have specific components to install? # removed them from `kw` so that we don't mess with other defaults packages = kw.pop('components', []) # Get some defaults name = kw.pop('name', '%s repo' % reponame) enabled = kw.pop('enabled', 1) gpgcheck = kw.pop('gpgcheck', 1) install_ceph = kw.pop('install_ceph', False) proxy = kw.pop('proxy', '') # will get ignored if empty _type = 'repo-md' baseurl = baseurl.strip('/') # Remove trailing slashes pkg_managers.yum_clean(distro.conn) if gpgkey: remoto.process.run(distro.conn, [ 'rpm', '--import', gpgkey, ]) repo_content = templates.custom_repo(reponame=reponame, name=name, baseurl=baseurl, enabled=enabled, gpgcheck=gpgcheck, _type=_type, gpgkey=gpgkey, proxy=proxy, **kw) distro.conn.remote_module.write_yum_repo(repo_content, "%s.repo" % reponame) # Some custom repos do not need to install ceph if install_ceph: pkg_managers.yum(distro.conn, packages)
def install(distro, version_kind, version, adjust_repos): logger = distro.conn.logger release = distro.release machine = distro.machine_type repo_part = repository_url_part(distro) dist = rpm_dist(distro) pkg_managers.yum_clean(distro.conn) # Even before EPEL, make sure we have `wget` pkg_managers.yum(distro.conn, 'wget') # Get EPEL installed before we continue: if adjust_repos: install_epel(distro) install_yum_priorities(distro) if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' if adjust_repos: if version_kind != 'dev': remoto.process.run( distro.conn, [ 'rpm', '--import', "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc".format(key=key) ] ) if version_kind == 'stable': url = 'http://ceph.com/rpm-{version}/{repo}/'.format( version=version, repo=repo_part, ) elif version_kind == 'testing': url = 'http://ceph.com/rpm-testing/{repo}/'.format(repo=repo_part) remoto.process.run( distro.conn, [ 'rpm', '-Uvh', '--replacepkgs', '{url}noarch/ceph-release-1-0.{dist}.noarch.rpm'.format(url=url, dist=dist), ], ) if version_kind == 'dev': logger.info('skipping install of ceph-release package') logger.info('repo file will be created manually') mirror_install( distro, 'http://gitbuilder.ceph.com/ceph-rpm-centos{release}-{machine}-basic/ref/{version}/'.format( release=release.split(".", 1)[0], machine=machine, version=version), "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc".format(key=key), adjust_repos=True, extra_installs=False ) # set the right priority logger.warning('ensuring that /etc/yum.repos.d/ceph.repo contains a high priority') distro.conn.remote_module.set_repo_priority(['Ceph', 'Ceph-noarch', 'ceph-source']) logger.warning('altered ceph.repo priorities to contain: priority=1') remoto.process.run( distro.conn, [ 'yum', '-y', 'install', 'ceph', ], )
def install(distro, version_kind, version, adjust_repos, **kw): packages = kw.get('components', []) pkg_managers.yum_clean(distro.conn) pkg_managers.yum(distro.conn, packages)
def install(distro, packages): return pkg_managers.yum( distro.conn, packages )
def install(distro, version_kind, version, adjust_repos): pkg_managers.yum_clean(distro.conn) pkg_managers.yum(distro.conn, ['ceph', 'ceph-mon', 'ceph-osd'])
def install(distro, version_kind, version, adjust_repos): logger = distro.conn.logger release = distro.release machine = distro.machine_type repo_part = repository_url_part(distro) dist = rpm_dist(distro) pkg_managers.yum_clean(distro.conn) # Even before EPEL, make sure we have `wget` has_wget = distro.conn.remote_module.which('wget') if not has_wget: pkg_managers.yum(distro.conn, 'wget') # Get EPEL installed before we continue: if adjust_repos: install_epel(distro) install_yum_priorities(distro) if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' if adjust_repos: if version_kind != 'dev': remoto.process.run( distro.conn, [ 'rpm', '--import', "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc".format(key=key) ] ) if version_kind == 'stable': url = 'http://ceph.com/rpm-{version}/{repo}/'.format( version=version, repo=repo_part, ) elif version_kind == 'testing': url = 'http://ceph.com/rpm-testing/{repo}/'.format(repo=repo_part) remoto.process.run( distro.conn, [ 'rpm', '-Uvh', '--replacepkgs', '{url}noarch/ceph-release-1-0.{dist}.noarch.rpm'.format(url=url, dist=dist), ], ) if version_kind == 'dev': logger.info('skipping install of ceph-release package') logger.info('repo file will be created manually') mirror_install( distro, 'http://gitbuilder.ceph.com/ceph-rpm-centos{release}-{machine}-basic/ref/{version}/'.format( release=release.split(".", 1)[0], machine=machine, version=version), "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc".format(key=key), adjust_repos=True, extra_installs=False ) # set the right priority logger.warning('ensuring that /etc/yum.repos.d/ceph.repo contains a high priority') distro.conn.remote_module.set_repo_priority(['Ceph', 'Ceph-noarch', 'ceph-source']) logger.warning('altered ceph.repo priorities to contain: priority=1') remoto.process.run( distro.conn, [ 'yum', '-y', 'install', 'ceph', ], )
def install(distro, packages): return pkg_managers.yum(distro.conn, packages)
def install(distro, version_kind, version, adjust_repos): logger = distro.conn.logger release = distro.release machine = distro.machine_type repo_part = repository_url_part(distro) dist = rpm_dist(distro) pkg_managers.yum_clean(distro.conn) # Even before EPEL, make sure we have `wget` has_wget = distro.conn.remote_module.which("wget") if not has_wget: pkg_managers.yum(distro.conn, "wget") # Get EPEL installed before we continue: if adjust_repos: install_epel(distro) install_yum_priorities(distro) if version_kind in ["stable", "testing"]: key = "release" else: key = "autobuild" if adjust_repos: if version_kind != "dev": remoto.process.run( distro.conn, ["rpm", "--import", "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc".format(key=key)], ) if version_kind == "stable": url = "http://ceph.com/rpm-{version}/{repo}/".format(version=version, repo=repo_part) elif version_kind == "testing": url = "http://ceph.com/rpm-testing/{repo}/".format(repo=repo_part) remoto.process.run( distro.conn, [ "rpm", "-Uvh", "--replacepkgs", "{url}noarch/ceph-release-1-0.{dist}.noarch.rpm".format(url=url, dist=dist), ], ) if version_kind == "dev": logger.info("skipping install of ceph-release package") logger.info("repo file will be created manually") mirror_install( distro, "http://gitbuilder.ceph.com/ceph-rpm-centos{release}-{machine}-basic/ref/{version}/".format( release=release.split(".", 1)[0], machine=machine, version=version ), "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc".format(key=key), adjust_repos=True, extra_installs=False, ) # set the right priority logger.warning("ensuring that /etc/yum.repos.d/ceph.repo contains a high priority") distro.conn.remote_module.set_repo_priority(["Ceph", "Ceph-noarch", "ceph-source"]) logger.warning("altered ceph.repo priorities to contain: priority=1") remoto.process.run(distro.conn, ["yum", "-y", "install", "ceph"])