From: Loic Dachary Date: Thu, 24 Mar 2016 10:59:33 +0000 (+0100) Subject: script: subscription-manager support (part 2) X-Git-Tag: v10.1.1~91^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F8293%2Fhead;p=ceph.git script: subscription-manager support (part 2) Strip the .py suffix so that no pyc / pyo files are generated. Do not install on CentOS. http://tracker.ceph.com/issues/14972 Fixes: #14972 Signed-off-by: Loic Dachary --- diff --git a/ceph.spec.in b/ceph.spec.in index ac2b32b7b968..1fdeff6951be 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -685,7 +685,7 @@ export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed -e 's/i386/i486/'` --libexecdir=%{_libexecdir} \ --localstatedir=/var \ --sysconfdir=/etc \ -%if 0%{?rhel} +%if 0%{?rhel} && ! 0%{?centos} --enable-subman \ %endif %if 0%{?_with_systemd} @@ -1189,8 +1189,8 @@ fi %{_mandir}/man8/ceph-clsinfo.8* %{_mandir}/man8/ceph-disk.8* %{_mandir}/man8/ceph-osd.8* -%if 0%{?rhel} -/etc/cron.hourly/subman.py +%if 0%{?rhel} && ! 0%{?centos} +/etc/cron.hourly/subman %endif %if 0%{?_with_systemd} %{_unitdir}/ceph-osd@.service diff --git a/configure.ac b/configure.ac index 20d50f3f50ea..48a7fc2bf60b 100644 --- a/configure.ac +++ b/configure.ac @@ -211,8 +211,8 @@ AM_CONDITIONAL(ENABLE_SERVER, test "$enable_server" = "yes") AC_ARG_ENABLE([subman], [AS_HELP_STRING([--enable-subman], [enable subman])], [], - [enable_subman=yes]) -AM_CONDITIONAL([ENABLE_SUBMAN], test "$enable_subman" = "yes") + [enable_subman=no]) +AM_CONDITIONAL([ENABLE_SUBMAN], test "x$enable_subman" != "xno") # cython is required to build python bindings for libraries if test x"$with_cython" = xyes; then diff --git a/src/Makefile.am b/src/Makefile.am index 528a74994a6e..1d8f8bbe36e8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -107,7 +107,7 @@ EXTRA_DIST += \ $(srcdir)/.git_version \ $(srcdir)/ceph-rbdnamer \ $(srcdir)/tools/ceph-monstore-update-crush.sh \ - $(srcdir)/script/subman.py \ + $(srcdir)/script/subman \ $(srcdir)/upstart/ceph-all.conf \ $(srcdir)/upstart/ceph-disk.conf \ $(srcdir)/upstart/ceph-mon.conf \ @@ -155,7 +155,7 @@ ceph_libexec_SCRIPTS = ceph_common.sh ceph-osd-prestart.sh if ENABLE_SUBMAN submandir = /etc/cron.hourly -subman_SCRIPTS = script/subman.py +subman_SCRIPTS = script/subman endif # tests to actually run on "make check"; if you need extra, non-test, diff --git a/src/script/subman b/src/script/subman new file mode 100755 index 000000000000..9bd69c585bfa --- /dev/null +++ b/src/script/subman @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import json +import re +import subprocess + +disks = json.loads(subprocess.check_output("ceph-disk list --format json", shell=True)) +used = 0 + +for disk in disks: + for partition in disk.get('partition', []): + if partition.get('type') == 'data': + df = subprocess.check_output("df --output=used " + partition['path'], shell=True) + used += int(re.findall('\d+', df)[0]) + +open("/etc/rhsm/facts/ceph_usage.facts", 'w').write(""" +{ +"band.storage.usage": {used} +} +""".format(used=used/(1024*1024*1024))) diff --git a/src/script/subman.py b/src/script/subman.py deleted file mode 100755 index 9bd69c585bfa..000000000000 --- a/src/script/subman.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python - -import json -import re -import subprocess - -disks = json.loads(subprocess.check_output("ceph-disk list --format json", shell=True)) -used = 0 - -for disk in disks: - for partition in disk.get('partition', []): - if partition.get('type') == 'data': - df = subprocess.check_output("df --output=used " + partition['path'], shell=True) - used += int(re.findall('\d+', df)[0]) - -open("/etc/rhsm/facts/ceph_usage.facts", 'w').write(""" -{ -"band.storage.usage": {used} -} -""".format(used=used/(1024*1024*1024)))