lsb_release_path, _ = process.communicate()
return process.wait()
-def install_suse(release, codename, version_kind, version):
- import platform
- import subprocess
-
- if version_kind in ['stable', 'testing']:
- key = 'release'
- else:
- key = 'autobuild'
-
- if codename == 'Mantis':
- distro='opensuse12'
- else:
- distro='sles-11sp2'
-
- subprocess.check_call(
- args='su -c \'rpm --import "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc"\''.format(key=key),
- shell=True,
- )
-
- if version_kind == 'stable':
- url = 'http://ceph.com/rpm-{version}/{distro}/'.format(
- version=version,
- distro=distro,
- )
- elif version_kind == 'testing':
- url = 'http://ceph.com/rpm-testing/{distro}'.format(distro=distro)
- elif version_kind == 'dev':
- url = 'http://gitbuilder.ceph.com/ceph-rpm-{distro}{release}-{machine}-basic/ref/{version}/'.format(
- distro=distro,
- release=release.split(".",1)[0],
- machine=platform.machine(),
- version=version,
- )
-
- subprocess.check_call(
- args=[
- 'rpm',
- '-Uvh',
- '--replacepkgs',
- '--force',
- '--quiet',
- '{url}noarch/ceph-release-1-0.noarch.rpm'.format(
- url=url,
- ),
- ]
- )
-
- subprocess.check_call(
- args=[
- 'zypper',
- '--non-interactive',
- '--quiet',
- 'install',
- 'ceph',
- ],
- )
def uninstall_suse(arg_purge=False):
import subprocess
args.extend(packages)
subprocess.check_call(args=args)
-def install_fedora(release, codename, version_kind, version):
- import platform
- import subprocess
-
- if version_kind in ['stable', 'testing']:
- key = 'release'
- else:
- key = 'autobuild'
-
- subprocess.check_call(
- args='su -c \'rpm --import "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc"\''.format(key=key),
- shell=True,
- )
-
- if version_kind == 'stable':
- url = 'http://ceph.com/rpm-{version}/fc{release}/'.format(
- version=version,
- release=release,
- )
- elif version_kind == 'testing':
- url = 'http://ceph.com/rpm-testing/fc{release}'.format(
- release=release,
- )
- elif version_kind == 'dev':
- url = 'http://gitbuilder.ceph.com/ceph-rpm-fc{release}-{machine}-basic/ref/{version}/'.format(
- release=release.split(".",1)[0],
- machine=platform.machine(),
- version=version,
- )
-
- subprocess.check_call(
- args=[
- 'rpm',
- '-Uvh',
- '--replacepkgs',
- '--force',
- '--quiet',
- '{url}noarch/ceph-release-1-0.fc{release}.noarch.rpm'.format(
- url=url,
- release=release,
- ),
- ]
- )
-
- subprocess.check_call(
- args=[
- 'yum',
- '-y',
- '-q',
- 'install',
- 'ceph',
- ],
- )
def uninstall_fedora(arg_purge=False):
import subprocess
args.extend(packages)
subprocess.check_call(args=args)
-def install_centos(release, codename, version_kind, version):
- import platform
- import subprocess
-
- if version_kind in ['stable', 'testing']:
- key = 'release'
- else:
- key = 'autobuild'
-
- subprocess.check_call(
- args='su -c \'rpm --import "https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc"\''.format(key=key),
- shell=True,
- )
-
- 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=platform.machine(),
- version=version,
- )
-
- subprocess.check_call(
- args=[
- 'rpm',
- '-Uvh',
- '--replacepkgs',
- '--force',
- '--quiet',
- '{url}noarch/ceph-release-1-0.el6.noarch.rpm'.format(
- url=url,
- ),
- ]
- )
-
- subprocess.check_call(
- args=[
- 'yum',
- '-y',
- '-q',
- 'install',
- 'ceph',
- ],
- )
def uninstall_centos(arg_purge=False):
import subprocess
args.extend(packages)
subprocess.check_call(args=args)
-def install_debian(release, codename, version_kind, version):
- import platform
- import subprocess
-
- if version_kind in ['stable', 'testing']:
- key = 'release'
- else:
- key = 'autobuild'
-
- subprocess.check_call(
- args='wget -q -O- \'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/{key}.asc\' | apt-key add -'.format(key=key),
- shell=True,
- )
-
- if version_kind == 'stable':
- url = 'http://ceph.com/debian-{version}/'.format(
- version=version,
- )
- elif version_kind == 'testing':
- url = 'http://ceph.com/debian-testing/'
- elif version_kind == 'dev':
- url = 'http://gitbuilder.ceph.com/ceph-deb-{codename}-{machine}-basic/ref/{version}'.format(
- codename=codename,
- machine=platform.machine(),
- version=version,
- )
- else:
- raise RuntimeError('Unknown version kind: %r' % version_kind)
-
- with file('/etc/apt/sources.list.d/ceph.list', 'w') as f:
- f.write('deb {url} {codename} main\n'.format(
- url=url,
- codename=codename,
- ))
-
- subprocess.check_call(
- args=[
- 'apt-get',
- '-q',
- 'update',
- ],
- )
-
- # TODO this does not downgrade -- should it?
- subprocess.check_call(
- args=[
- 'env',
- 'DEBIAN_FRONTEND=noninteractive',
- 'DEBIAN_PRIORITY=critical',
- 'apt-get',
- '-q',
- '-o', 'Dpkg::Options::=--force-confnew',
- 'install',
- '--no-install-recommends',
- '--assume-yes',
- '--',
- 'ceph',
- 'ceph-mds',
- 'ceph-common',
- 'ceph-fs-common',
- # ceph only recommends gdisk, make sure we actually have
- # it; only really needed for osds, but minimal collateral
- 'gdisk',
- ],
- )
def purge_data_any():
import subprocess