]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: install podman from the Kubic project 37922/head
authorMichael Fritch <mfritch@suse.com>
Mon, 2 Nov 2020 15:54:53 +0000 (08:54 -0700)
committerMichael Fritch <mfritch@suse.com>
Mon, 9 Nov 2020 17:54:14 +0000 (10:54 -0700)
ppa:projectatomic is no longer maintained, updates are now provided via
the Kubic project

Fixes: https://tracker.ceph.com/issues/48072
Signed-off-by: Michael Fritch <mfritch@suse.com>
src/cephadm/cephadm

index f19d8ae03fe8e0d86b31e877a87f34fad8f9b3a7..72af1ae0b1e0ba9475378b5aa8dd4673e325dfa2 100755 (executable)
@@ -4584,6 +4584,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'
@@ -4625,15 +4626,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...')
@@ -4643,6 +4646,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 = {