Update astute package

Add systemd unit file for astute

Add sysconfig file for astute with systemd

Upgrade spec file to support CentOS7

Blueprint: master-on-centos7

Is NOT compatible with centos 6 because in our build cases yum-builddep on ubuntu doesn't reveal rhel macros

Change-Id: Iefd9c574499a4f0022f8bbef6dc64fa04d4d2a7a
This commit is contained in:
Ivan Suzdal 2015-11-20 18:04:15 +03:00
parent b60624ee2c
commit 35ff57cf55
3 changed files with 77 additions and 13 deletions

9
astute.service Normal file
View File

@ -0,0 +1,9 @@
[Unit]
Name=Astute daemon
[Service]
EnvironmentFile=-/etc/sysconfig/astute
ExecStart=/usr/bin/astuted $ASTUTE_OPTIONS
[Install]
WantedBy=multi-user.target

1
astute.sysconfig Normal file
View File

@ -0,0 +1 @@
ASTUTE_OPTIONS="--config /etc/astute/astuted.conf --logfile /var/log/astute.log --loglevel info --workers 7"

View File

@ -1,20 +1,33 @@
%define rbname astute
%{!?version: %define version 8.0.0}
%{!?release: %define release 1}
%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%global geminstdir %{gemdir}/gems/%{gemname}-%{version}
%define gembuilddir %{buildroot}%{gemdir}
%if 0%{?rhel} == 6
%global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%endif
%global geminstdir %{gem_dir}/gems/%{gemname}-%{version}
%define gembuilddir %{buildroot}%{gem_dir}
Summary: Orchestrator for OpenStack deployment
Name: ruby21-rubygem-astute
Version: %{version}
%if 0%{?rhel} == 6
Name: ruby21-rubygem-astute
Release: %{release}
Provides: ruby21(Astute) = %{version}
%else
Name: rubygem-astute
Release: %{release}~mos8.0.1
Provides: ruby(Astute) = %{version}
%endif
Group: Development/Ruby
License: Distributable
URL: http://fuel.mirantis.com
Source0: %{rbname}-%{version}.tar.gz
# Make sure the spec template is included in the SRPM
BuildRoot: %{_tmppath}/%{rbname}-%{version}-root
%if 0%{?rhel} == 6
Requires: ruby21 >= 2.1
Requires: ruby21-rubygem-activesupport = 3.0.10
Requires: ruby21-rubygem-mcollective-client = 2.4.1
@ -25,11 +38,31 @@ Requires: ruby21-rubygem-raemon = 0.3.0
Requires: ruby21-rubygem-net-ssh = 2.8.0
Requires: ruby21-rubygem-net-ssh-gateway = 1.2.0
Requires: ruby21-rubygem-net-ssh-multi = 1.2.0
Requires: openssh-clients
BuildRequires: ruby21 >= 2.1
BuildRequires: rubygems21
%else
Requires: ruby
Requires: rubygem-activesupport
Requires: rubygem-mcollective-client
Requires: rubygem-symboltable
Requires: rubygem-rest-client
Requires: rubygem-bunny
Requires: rubygem-raemon
Requires: rubygem-net-ssh
Requires: rubygem-net-ssh-gateway
Requires: rubygem-net-ssh-multi
BuildRequires: ruby
BuildRequires: rubygems-devel
%endif
BuildArch: noarch
Provides: ruby21(Astute) = %{version}
Requires: openssh-clients
%if 0%{?fedora} > 16 || 0%{?rhel} > 6
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
BuildRequires: systemd-units
%endif
%description
Deployment Orchestrator of Puppet via MCollective. Works as a library or from
@ -54,29 +87,49 @@ cat > %{buildroot}%{_bindir}/astuted <<EOF
ruby -r 'rubygems' -e "gem 'astute', '>= 0'; load Gem.bin_path('astute', 'astuted', '>= 0')" -- \$@
EOF
install -d -m 755 %{buildroot}%{_localstatedir}/log/astute
install -D -m644 %{_builddir}/%{rbname}-%{version}/%{rbname}.sysconfig %{buildroot}/%{_sysconfdir}/sysconfig/%{rbname}
#nailgun-mcagents
mkdir -p %{buildroot}/usr/libexec/mcollective/mcollective/agent/
cp -rf %{_builddir}/%{rbname}-%{version}/mcagents/* %{buildroot}/usr/libexec/mcollective/mcollective/agent/
%if %{defined _unitdir}
install -D -m644 %{_builddir}/%{rbname}-%{version}/%{rbname}.service %{buildroot}/%{_unitdir}/%{rbname}.service
%endif
%clean
%{__rm} -rf %{buildroot}
%files
%defattr(-, root, root)
%{gemdir}/gems/%{rbname}-%{version}/bin/*
%{gemdir}/gems/%{rbname}-%{version}/lib/*
%{gemdir}/gems/%{rbname}-%{version}/spec/*
%{gemdir}/gems/%{rbname}-%{version}/examples/*
%{gem_dir}/gems/%{rbname}-%{version}/bin/*
%{gem_dir}/gems/%{rbname}-%{version}/lib/*
%{gem_dir}/gems/%{rbname}-%{version}/spec/*
%{gem_dir}/gems/%{rbname}-%{version}/examples/*
%dir %attr(0750, naily, naily) %{_sysconfdir}/%{rbname}
%dir %attr(0755, naily, naily) %{_localstatedir}/log/%{rbname}
%config(noreplace) %{_bindir}/astuted
%config(noreplace) %{_sysconfdir}/sysconfig/%{rbname}
%doc %{gemdir}/doc/%{rbname}-%{version}
%{gemdir}/cache/%{rbname}-%{version}.gem
%{gemdir}/specifications/%{rbname}-%{version}.gemspec
%doc %{gem_dir}/doc/%{rbname}-%{version}
%{gem_dir}/cache/%{rbname}-%{version}.gem
%{gem_dir}/specifications/%{rbname}-%{version}.gemspec
%if %{defined _unitdir}
/%{_unitdir}/%{rbname}.service
%post
%systemd_post %{rbname}.servive
%preun
%systemd_preun %{rbname}.service
%postun
%systemd_postun_with_restart %{rbname}.service
%endif
%if 0%{?rhel} == 6
%package -n ruby21-nailgun-mcagents
Summary: MCollective Agents
@ -91,6 +144,7 @@ MCollective agents
%files -n ruby21-nailgun-mcagents
/usr/libexec/mcollective/mcollective/agent/*
%endif
%package -n nailgun-mcagents