From 088a41f1675d937b717fdc14ca8be21c0a7e88c5 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 25 Jul 2013 11:07:23 -0400 Subject: [PATCH] create the install module for CentOS Signed-off-by: Alfredo Deza --- ceph_deploy/hosts/centos/__init__.py | 4 ++- ceph_deploy/hosts/centos/install.py | 51 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 ceph_deploy/hosts/centos/install.py diff --git a/ceph_deploy/hosts/centos/__init__.py b/ceph_deploy/hosts/centos/__init__.py index f23a899..416e3af 100644 --- a/ceph_deploy/hosts/centos/__init__.py +++ b/ceph_deploy/hosts/centos/__init__.py @@ -1,6 +1,8 @@ +from install import install + # Allow to set some information about this distro # -name = None +distro = None release = None codename = None diff --git a/ceph_deploy/hosts/centos/install.py b/ceph_deploy/hosts/centos/install.py new file mode 100644 index 0000000..b79d7aa --- /dev/null +++ b/ceph_deploy/hosts/centos/install.py @@ -0,0 +1,51 @@ + + +def install(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', + ], + ) -- 2.47.3