LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File openstack-ceilometer.spec of Package openstack-ceilometer (Project home:sayalilunkad:branches:Cloud:OpenStack:Master)

#
# spec file for package openstack-ceilometer
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2011 B1 Systems GmbH, Vohburg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define component ceilometer
%define groupname %{component}
%define username %{component}

%define version_unconverted 8.0.1.dev9

Name:           openstack-%{component}
Version:        8.0.1~a0~dev9
Release:        0
Summary:        OpenStack Metering (Ceilometer)
License:        Apache-2.0
Group:          System/Management
Url:            https://launchpad.net/ceilometer
Source:         http://tarballs.openstack.org/ceilometer/ceilometer-master.tar.gz
Source2:        %{name}.logrotate
Source4:        %name.conf
Source5:        openstack-ceilometer-polkit.rules
Source6:        openstack-ceilometer-expirer.cron
# systemd service files
Source10:       %{name}-api.service
Source11:       %{name}-collector.service
Source12:       %{name}-polling.service
Source13:       %{name}-agent-central.service
Source14:       %{name}-agent-compute.service
Source15:       %{name}-agent-ipmi.service
Source16:       %{name}-agent-notification.service
Source50:       README.config
BuildRequires:  crudini
BuildRequires:  fdupes
BuildRequires:  openstack-suse-macros
BuildRequires:  python-PasteDeploy
BuildRequires:  python-WSME
BuildRequires:  python-Werkzeug
BuildRequires:  python-base
BuildRequires:  python-cachetools
BuildRequires:  python-cinderclient
BuildRequires:  python-cotyledon
BuildRequires:  python-glanceclient
BuildRequires:  python-gnocchiclient
BuildRequires:  python-happybase
BuildRequires:  python-jsonpath-rw
BuildRequires:  python-jsonpath-rw-ext
BuildRequires:  python-jsonschema
BuildRequires:  python-keystonemiddleware
BuildRequires:  python-lxml
BuildRequires:  python-msgpack-python
BuildRequires:  python-neutronclient
BuildRequires:  python-novaclient
BuildRequires:  python-oslo.config
BuildRequires:  python-oslo.db >= 0.4.0
BuildRequires:  python-oslo.messaging
BuildRequires:  python-oslo.policy
BuildRequires:  python-oslo.reports
BuildRequires:  python-oslo.serialization
BuildRequires:  python-oslo.utils
BuildRequires:  python-oslo.vmware
BuildRequires:  python-pbr >= 0.6
BuildRequires:  python-pecan
BuildRequires:  python-six
BuildRequires:  python-stevedore
BuildRequires:  python-swiftclient
BuildRequires:  python-tooz
# to make orphaned-file-tests happy
BuildRequires:  polkit-default-privs
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
Requires:       polkit-default-privs
# Documentation build requirements:
#BuildRequires:  python-Sphinx
Requires:       logrotate
Requires:       python >= 2.7
Requires:       python-ceilometer = %{version}
Requires:       python-pbr >= 1.6
Requires(pre):  pwdutils
%if 0%{?suse_version}
Recommends:     cron
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
Ceilometer aims to deliver a unique point of contact for billing systems to
aquire all counters they need to establish customer billing, accross all
current and future OpenStack components. The delivery of counters must be
tracable and auditable, the counters must be easily extensible to support new
projects, and agents doing data collections should be independent of the
overall system.

%package -n python-ceilometer
Summary:        OpenStack Metering (Ceilometer) - Python module
Group:          Development/Languages/Python
Requires:       python >= 2.7
Requires:       python-PasteDeploy >= 1.5.0
Requires:       python-PyYAML >= 3.1.0
Requires:       python-SQLAlchemy >= 1.0.10
Requires:       python-WSME >= 0.8
Requires:       python-WebOb >= 1.5.0
Requires:       python-Werkzeug >= 0.7
Requires:       python-cotyledon >= 1.3.0
Requires:       python-debtcollector >= 1.2.0
Requires:       python-futures >= 3.0
Requires:       python-futurist >= 0.11.0
Requires:       python-glanceclient >= 2.0.0
Requires:       python-happybase >= 0.5
Requires:       python-jsonpath-rw
Requires:       python-jsonpath-rw-ext
Requires:       python-jsonschema >= 2.0.0
Requires:       python-kafka-python >= 1.3.1
Requires:       python-keystoneauth1 >= 2.1.0
Requires:       python-keystoneclient >= 1.6.0
Requires:       python-keystonemiddleware >= 4.0.0
Requires:       python-lxml >= 2.3
Requires:       python-msgpack-python >= 0.4.0
Requires:       python-neutronclient >= 4.2.0
Requires:       python-novaclient >= 2.29.0
Requires:       python-oslo.cache >= 1.5.0
Requires:       python-oslo.concurrency >= 3.5.0
Requires:       python-oslo.config >= 3.9.0
Requires:       python-oslo.db >= 4.1.0
Requires:       python-oslo.i18n >= 2.1.0
Requires:       python-oslo.log >= 1.14.0
Requires:       python-oslo.messaging >= 5.2.0
Requires:       python-oslo.middleware >= 3.0.0
Requires:       python-oslo.policy >= 0.5.0
Requires:       python-oslo.reports >= 0.6.0
Requires:       python-oslo.rootwrap >= 2.0.0
Requires:       python-oslo.serialization >= 1.10.0
Requires:       python-oslo.utils >= 3.5.0
Requires:       python-oslo.vmware >= 1.16.0
Requires:       python-pecan >= 1.0.0
Requires:       python-pymongo >= 3.0.2
Requires:       python-pysnmp >= 4.2.3
Requires:       python-python-dateutil >= 2.4.2
Requires:       python-requests >= 2.8.1
Requires:       python-requests-aws >= 0.1.4
Requires:       python-retrying >= 1.2.3
Requires:       python-six >= 1.9.0
Requires:       python-sqlalchemy-migrate >= 0.9.6
Requires:       python-stevedore >= 1.9.0
Requires:       python-swiftclient >= 2.2.0
Requires:       python-tooz >= 1.28.0

%description -n python-ceilometer
This package contains the core Python module of %{name}.

%package api
Summary:        OpenStack Metering (Ceilometer) - API
Group:          Development/Languages/Python
Requires:       %{name} = %{version}

%description api
This package contains the %{name} API server.

%package collector
Summary:        OpenStack Metering (Ceilometer) - Collector
Group:          Development/Languages/Python
Requires:       %{name} = %{version}

%description collector
This package contains the %{name} collector.

%package polling
Summary:        OpenStack Metering (Ceilometer) - Polling
Group:          Development/Languages/Python
Requires:       %{name} = %{version}

%description polling
This package contains the %{name} polling.

%package agent-central
Summary:        OpenStack Metering (Ceilometer) - Agent Central
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       openstack-ceilometer-polling = %{version}

%description agent-central
This package contains the %{name} central agent.

%package agent-compute
Summary:        OpenStack Metering (Ceilometer) - Agent Compute
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       openstack-ceilometer-polling = %{version}

%description agent-compute
This package contains the %{name} compute agent.

%package agent-ipmi
Summary:        OpenStack Metering (Ceilometer) - Agent IPMI
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       openstack-ceilometer-polling = %{version}

%description agent-ipmi
This package contains the %{name} IPMI agent.

%package agent-notification
Summary:        OpenStack Metering (Ceilometer) - Agent Notification
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       ipmitool

%description agent-notification
This package contains the %{name} notification agent.

%package test
Summary:        OpenStack Metering (Ceilometer) - Testsuite
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       openstack-ceilometer-agent-central = %{version}
Requires:       openstack-ceilometer-agent-compute = %{version}
Requires:       openstack-ceilometer-agent-ipmi = %{version}
Requires:       openstack-ceilometer-api = %{version}
Requires:       openstack-ceilometer-collector = %{version}
Requires:       openstack-ceilometer-polling = %{version}
Requires:       openstack-nova-test >= 12
Requires:       python-WebTest >= 2.0
Requires:       python-contextlib2 >= 0.4.0
Requires:       python-fixtures >= 1.3.1
Requires:       python-gabbi >= 1.30.0
Requires:       python-mock >= 1.2
Requires:       python-os-testr >= 0.4.1
Requires:       python-os-win >= 0.2.3
Requires:       python-oslotest >= 1.10.0
Requires:       python-psycopg2 >= 2.5
Requires:       python-python-subunit >= 0.0.18
Requires:       python-sphinxcontrib-httpdomain
Requires:       python-sphinxcontrib-pecanwsme >= 0.8
Requires:       python-swift
Requires:       python-testrepository >= 0.0.18
Requires:       python-testscenarios >= 0.4
Requires:       python-testtools >= 1.4.0

%description test
This package contains testsuite files for %{name}.

%prep
%setup -q -n %{component}-%{version_unconverted}
%openstack_cleanup_prep

%build
python setup.py build
# Currently there exists only a general man-page with the same content as the
# HTML documenation. Thus we shouldn't build it:
#python setup.py build_sphinx -b man -s doc/source

PYTHONPATH=. oslo-config-generator --config-file etc/ceilometer/ceilometer-config-generator.conf > etc/ceilometer/ceilometer.conf

%install
python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}

### directories
#TODO: Check what we need:
install -d -m 755 %{buildroot}%{_localstatedir}/{lib,log}/%{component}
install -d -m 750 %{buildroot}%{_localstatedir}/{cache}/%{component}
install -d -m 700 %{buildroot}/run/%{component}
install -D -m 644 %{SOURCE4} %{buildroot}/%_tmpfilesdir/%name.conf

### configuration files
install -d -m 0755 %{buildroot}%{_sysconfdir}/%{component}
install -p -D -m 640 %{SOURCE50} %{buildroot}%{_sysconfdir}/%{component}/README.config
# delete the ceilometer.conf - we generated out own with oslo-config-generator
rm %{buildroot}/usr/etc/ceilometer/ceilometer.conf
rm %{buildroot}/usr/etc/ceilometer/ceilometer-config-generator.conf
# for whatever reason, upstream installs config files into usr/etc/...
mv %{buildroot}/usr/%{_sysconfdir}/%{component}/* %{buildroot}%{_sysconfdir}/%{component}/.
mv etc/ceilometer/ceilometer.conf %{buildroot}%{_sysconfdir}/%{component}/.
# TODO: where to put the config examples?
rm -rf %{buildroot}%{_sysconfdir}/%{component}/examples/
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/

# bash-completion/logrotate/etc.
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

# Install systemd unit services
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 444 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-collector.service
install -p -D -m 444 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-polling.service
install -p -D -m 444 %{SOURCE13} %{buildroot}%{_unitdir}/%{name}-agent-central.service
install -p -D -m 444 %{SOURCE14} %{buildroot}%{_unitdir}/%{name}-agent-compute.service
install -p -D -m 444 %{SOURCE15} %{buildroot}%{_unitdir}/%{name}-agent-ipmi.service
install -p -D -m 444 %{SOURCE16} %{buildroot}%{_unitdir}/%{name}-agent-notification.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-api
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-collector
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-polling
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-agent-central
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-agent-compute
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-agent-ipmi
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-agent-notification

### policy kit
install -D -m 644 %{SOURCE5} %{buildroot}%{_datadir}/polkit-1/rules.d/11-openstack-ceilometer.rules

# WSGI app
install -D -p -m 644 %{buildroot}%{python_sitelib}/%{component}/api/app.wsgi %{buildroot}/srv/www/%{component}-api/app.wsgi

### cron jobs
mkdir -p %{buildroot}%{_sysconfdir}/cron.daily
install -p -m 755 %{SOURCE6} %{buildroot}%{_sysconfdir}/cron.daily

### documentation
#install -d %%{buildroot}%%{_mandir}/man1
#install -m 644 doc/build/man/*.1 %%{buildroot}%%{_mandir}/man1

### test subpackage
%openstack_test_package_install

### set default configuration
%define ceilometer_conf %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
crudini --set %{ceilometer_conf} DEFAULT log_dir %{_localstatedir}/log/%{component}
crudini --set %{ceilometer_conf} DEFAULT policy_file %{_sysconfdir}/%{component}/policy.json
crudini --set %{ceilometer_conf} DEFAULT lock_path %{_rundir}/%{component}
crudini --set %{ceilometer_conf} keystone_authtoken signing_dir /var/cache/%component/keystone-signing

### authentication cache dir
mkdir -p %{buildroot}%{_localstatedir}/cache/ceilometer

%pre
%openstack_pre_user_group_create %{username} %{groupname}

%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf

%pre api
%service_add_pre %{name}-api.service

%post api
%service_add_post %{name}-api.service

%preun api
%service_del_preun %{name}-api.service

%postun api
%restart_on_update %{name}-api.service
%service_del_postun %{name}-api.service

%pre collector
%service_add_pre %{name}-collector.service

%post collector
%service_add_post %{name}-collector.service

%preun collector
%service_del_preun %{name}-collector.service

%postun collector
%restart_on_update %{name}-collector.service
%service_del_postun %{name}-collector.service

%pre polling
%service_add_pre %{name}-polling.service

%post polling
%service_add_post %{name}-polling.service

%preun polling
%service_del_preun %{name}-polling.service

%postun polling
%restart_on_update %{name}-polling.service
%service_del_postun %{name}-polling.service

%pre agent-central
%service_add_pre %{name}-agent-central.service

%post agent-central
%service_add_post %{name}-agent-central.service

%preun agent-central
%service_del_preun %{name}-agent-central.service

%postun agent-central
%restart_on_update %{name}-agent-central.service
%service_del_postun %{name}-agent-central.service

%pre agent-compute
%service_add_pre %{name}-agent-compute.service

%post agent-compute
%service_add_post %{name}-agent-compute.service

%preun agent-compute
%service_del_preun %{name}-agent-compute.service

%postun agent-compute
%restart_on_update %{name}-agent-compute.service
%service_del_postun %{name}-agent-compute.service

%pre agent-ipmi
%service_add_pre %{name}-agent-ipmi.service

%post agent-ipmi
%service_add_post %{name}-agent-ipmi.service

%preun agent-ipmi
%service_del_preun %{name}-agent-ipmi.service

%postun agent-ipmi
%restart_on_update %{name}-agent-ipmi.service
%service_del_postun %{name}-agent-ipmi.service

%pre agent-notification
%service_add_pre %{name}-agent-notification.service

%post agent-notification
%service_add_post %{name}-agent-notification.service

%preun agent-notification
%service_del_preun %{name}-agent-notification.service

%postun agent-notification
%restart_on_update %{name}-agent-notification.service
%service_del_postun %{name}-agent-notification.service

%files
%defattr(-,root,root)
%doc LICENSE README.rst
%{_bindir}/ceilometer-upgrade
%{_bindir}/ceilometer-send-sample
%{_bindir}/ceilometer-rootwrap
%{_bindir}/ceilometer-db-legacy-clean
%dir %{_sysconfdir}/%{component}
%dir %{_sysconfdir}/%{component}/%{component}.conf.d/
%{_sysconfdir}/%{component}/README.config
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
%config %{_sysconfdir}/%{component}/event_definitions.yaml
%config %{_sysconfdir}/%{component}/event_pipeline.yaml
%config %{_sysconfdir}/%{component}/pipeline.yaml
%config %{_sysconfdir}/%{component}/polling.yaml
%config %{_sysconfdir}/%{component}/policy.json
%config %{_sysconfdir}/%{component}/api_paste.ini
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config %{_sysconfdir}/%{component}/rootwrap.conf
%dir %{_sysconfdir}/%{component}/rootwrap.d
%config %{_sysconfdir}/%{component}/rootwrap.d/ipmi.filters
%dir %attr(0755, %{username}, %{groupname}) %{_localstatedir}/lib/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/cache/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/log/%{component}
%_tmpfilesdir/%name.conf

%files -n python-ceilometer
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/%{component}-*.egg-info
# Part of test subpackage (except the tempest tests)
%exclude %{python_sitelib}/%{component}/tests/unit/
%exclude %{python_sitelib}/%{component}/tests/functional/
%exclude %{python_sitelib}/%{component}/tests/integration/

%files api
%defattr(-,root,root,-)
/srv/www/%{component}-api
%{_unitdir}/%{name}-api.service
%{_sbindir}/rc%{name}-api
%{_bindir}/%{component}-api

%files collector
%defattr(-,root,root,-)
%{_unitdir}/%{name}-collector.service
%{_sbindir}/rc%{name}-collector
%{_bindir}/%{component}-collector
%{_bindir}/%{component}-expirer
%config(noreplace) %{_sysconfdir}/cron.daily/openstack-ceilometer-expirer.cron

%files polling
%defattr(-,root,root,-)
%{_unitdir}/%{name}-polling.service
%{_sbindir}/rc%{name}-polling
%{_bindir}/%{component}-polling

%files agent-central
%defattr(-,root,root,-)
%{_unitdir}/%{name}-agent-central.service
%{_sbindir}/rc%{name}-agent-central

%files agent-compute
%defattr(-,root,root,-)
%{_unitdir}/%{name}-agent-compute.service
%{_sbindir}/rc%{name}-agent-compute
%{_datadir}/polkit-1/rules.d/11-openstack-ceilometer.rules

%files agent-ipmi
%defattr(-,root,root,-)
%{_unitdir}/%{name}-agent-ipmi.service
%{_sbindir}/rc%{name}-agent-ipmi

%files agent-notification
%defattr(-,root,root,-)
%{_unitdir}/%{name}-agent-notification.service
%{_sbindir}/rc%{name}-agent-notification
%{_bindir}/%{component}-agent-notification

%files test
%defattr(-,root,root)
%{python_sitelib}/%{component}/tests/unit/
%{python_sitelib}/%{component}/tests/functional/
%{python_sitelib}/%{component}/tests/integration/

%{_localstatedir}/lib/%{name}-test/

%changelog