mirror of
https://github.com/ceph/ceph
synced 2025-03-30 07:19:14 +00:00
Merge pull request #37922 from mgfritch/project-kubic
cephadm: install podman from the Kubic project Reviewed-by: Kiefer Chang <kiefer.chang@suse.com> Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
commit
4dc60e9ece
@ -1,11 +1,12 @@
|
||||
os_type: ubuntu
|
||||
os_version: "18.04"
|
||||
|
||||
# feel free to remove this test, if ppa:projectatomic is no longer maintained.
|
||||
# feel free to remove this test, if Kubic project is no longer maintained.
|
||||
tasks:
|
||||
- exec:
|
||||
all:
|
||||
- sudo apt -y install software-properties-common
|
||||
- sudo add-apt-repository -y ppa:projectatomic/ppa
|
||||
- curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_18.04/Release.key | sudo apt-key add -
|
||||
- echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_18.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
|
||||
- sudo apt update
|
||||
- sudo apt -y install podman
|
||||
- echo -e "[registries.search]\nregistries = ['docker.io']" | sudo tee /etc/containers/registries.conf
|
||||
|
@ -4605,6 +4605,7 @@ class Apt(Packager):
|
||||
branch=branch, commit=commit)
|
||||
self.distro = self.DISTRO_NAMES[distro]
|
||||
self.distro_codename = distro_codename
|
||||
self.distro_version = distro_version
|
||||
|
||||
def repo_path(self):
|
||||
return '/etc/apt/sources.list.d/ceph.list'
|
||||
@ -4646,15 +4647,17 @@ class Apt(Packager):
|
||||
logger.info('Removing repo at %s...' % self.repo_path())
|
||||
os.unlink(self.repo_path())
|
||||
|
||||
if self.distro == 'ubuntu':
|
||||
self.rm_kubic_repo()
|
||||
|
||||
def install(self, ls):
|
||||
logger.info('Installing packages %s...' % ls)
|
||||
call_throws(['apt', 'install', '-y'] + ls)
|
||||
|
||||
def install_podman(self):
|
||||
if self.distro == 'ubuntu':
|
||||
logger.info('Setting up repo for pdoman...')
|
||||
self.install(['software-properties-common'])
|
||||
call_throws(['add-apt-repository', '-y', 'ppa:projectatomic/ppa'])
|
||||
logger.info('Setting up repo for podman...')
|
||||
self.add_kubic_repo()
|
||||
call_throws(['apt', 'update'])
|
||||
|
||||
logger.info('Attempting podman install...')
|
||||
@ -4664,6 +4667,49 @@ class Apt(Packager):
|
||||
logger.info('Podman did not work. Falling back to docker...')
|
||||
self.install(['docker.io'])
|
||||
|
||||
def kubic_repo_url(self):
|
||||
return 'https://download.opensuse.org/repositories/devel:/kubic:/' \
|
||||
'libcontainers:/stable/xUbuntu_%s/' % self.distro_version
|
||||
|
||||
def kubic_repo_path(self):
|
||||
return '/etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list'
|
||||
|
||||
def kubric_repo_gpgkey_url(self):
|
||||
return '%s/Release.key' % self.kubic_repo_url()
|
||||
|
||||
def kubric_repo_gpgkey_path(self):
|
||||
return '/etc/apt/trusted.gpg.d/kubic.release.gpg'
|
||||
|
||||
def add_kubic_repo(self):
|
||||
url = self.kubric_repo_gpgkey_url()
|
||||
logger.info('Installing repo GPG key from %s...' % url)
|
||||
try:
|
||||
response = urlopen(url)
|
||||
except HTTPError as err:
|
||||
logger.error('failed to fetch GPG repo key from %s: %s' % (
|
||||
url, err))
|
||||
raise Error('failed to fetch GPG key')
|
||||
key = response.read().decode('utf-8')
|
||||
tmp_key = write_tmp(key, 0, 0)
|
||||
keyring = self.kubric_repo_gpgkey_path()
|
||||
call_throws(['apt-key', '--keyring', keyring, 'add', tmp_key.name])
|
||||
|
||||
logger.info('Installing repo file at %s...' % self.kubic_repo_path())
|
||||
content = 'deb %s /\n' % self.kubic_repo_url()
|
||||
with open(self.kubic_repo_path(), 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
def rm_kubic_repo(self):
|
||||
keyring = self.kubric_repo_gpgkey_path()
|
||||
if os.path.exists(keyring):
|
||||
logger.info('Removing repo GPG key %s...' % keyring)
|
||||
os.unlink(keyring)
|
||||
|
||||
p = self.kubic_repo_path()
|
||||
if os.path.exists(p):
|
||||
logger.info('Removing repo at %s...' % p)
|
||||
os.unlink(p)
|
||||
|
||||
|
||||
class YumDnf(Packager):
|
||||
DISTRO_NAMES = {
|
||||
|
Loading…
Reference in New Issue
Block a user