%{?systemd_requires} BuildRequires: systemd %define unit_name chroma-agent.service %global pypi_name iml-agent %{?!version: %global version 4.1.1} %{?!package_release: %global package_release 551.1.ga4068fe} %{?!python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())")} %{?dist_version: %global source https://github.com/intel-hpdd/%{pypi_name}/archive/%{dist_version}.tar.gz} %{?dist_version: %global archive_version %{dist_version}} %{?!dist_version: %global source https://files.pythonhosted.org/packages/source/i/%{pypi_name}/%{pypi_name}-%{version}.tar.gz} %{?!dist_version: %global archive_version %{version}} Name: python-%{pypi_name} Version: %{version} Release: %{package_release}%{?dist} Summary: IML Agent License: MIT URL: https://pypi.python.org/pypi/%{pypi_name} Source0: %{source} Source1: %{unit_name} Source2: 50-chroma-agent.preset Source3: logrotate.cfg Source4: iml-storage-server.target Source5: 10-device-scanner.target.conf Source6: 10-device-scanner.socket.conf Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArch: noarch Vendor: Intel Corporation BuildRequires: python2-setuptools BuildRequires: systemd %description This is the Intel Manager for Lustre monitoring and adminstration agent %package -n python2-%{pypi_name} Summary: %{summary} Obsoletes: chroma-agent Provides: chroma-agent Requires: ntp Requires: python-argparse Requires: python-daemon Requires: python-setuptools Requires: python-requests >= 2.6.0 Requires: python2-tablib Requires: yum-utils Requires: initscripts Requires: iml_sos_plugin Requires: python2-iml-common1.4 Requires: systemd-python Requires: python-tzlocal Requires: python2-toolz Requires: iml-device-scanner-proxy < 3 Requires: util-linux-ng Requires(post): selinux-policy Requires: dnf Requires: dnf-command(repoquery) Requires: python-urllib3 %{?python_provide:%python_provide python2-%{pypi_name}} %description -n python2-%{pypi_name} This is the Intel Manager for Lustre monitoring and adminstration agent %package -n python2-%{pypi_name}-management Summary: Management functionality layer. Group: System Environment/Daemons Conflicts: sysklogd Obsoletes: chroma-agent-management Provides: chroma-agent-management Requires: python2-%{pypi_name} = %{version}-%{release} Requires: pcs Requires: libxml2-python Requires: python-netaddr Requires: python-ethtool Requires: python-jinja2 Requires: pcapy Requires: python-impacket Requires: system-config-firewall-base Requires: ed Requires: fence-agents Requires: fence-agents-virsh %description -n python2-%{pypi_name}-management This package layers on management capabilities for Intel Manager for Lustre Agent. %prep %if %{?dist_version:1}%{!?dist_version:0} %setup -n %{pypi_name}-%(echo %{archive_version} | sed -Ee '/^v([0-9]+\.)[0-9]+/s/^v(.*)/\1/') %else %setup -n %{pypi_name}-%{version} # Remove bundled egg-info rm -rf %{pypi_name}.egg-info %endif %build %{__python} setup.py build %install rm -rf %{buildroot} %{__python} setup.py install --skip-build --install-lib=%{python_sitelib} --install-scripts=%{_bindir} --root=%{buildroot} mkdir -p $RPM_BUILD_ROOT/usr/sbin/ mv $RPM_BUILD_ROOT/usr/{,s}bin/fence_chroma mv $RPM_BUILD_ROOT/usr/{,s}bin/chroma-copytool-monitor mkdir -p %{buildroot}%{_unitdir}/ mkdir -p %{buildroot}%{_presetdir} install -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/ install -m 644 %{SOURCE2} %{buildroot}%{_presetdir}/ mkdir -p $RPM_BUILD_ROOT/etc/{init,logrotate}.d/ install -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/chroma-agent install -m 644 %{SOURCE4} %{buildroot}%{_unitdir}/iml-storage-server.target mkdir -p %{buildroot}%{_unitdir}/device-scanner.target.d/ install -m 644 %{SOURCE5} %{buildroot}%{_unitdir}/device-scanner.target.d/10-device-scanner.target.conf mkdir -p %{buildroot}%{_unitdir}/device-scanner.socket.d/ install -m 644 %{SOURCE6} %{buildroot}%{_unitdir}/device-scanner.socket.d/10-device-scanner.socket.conf touch management.files cat <>management.files %{python_sitelib}/chroma_agent/action_plugins/manage_*.py* %{python_sitelib}/chroma_agent/templates/ %{_usr}/lib/ocf/resource.d/chroma/Target %{_sbindir}/fence_chroma %{_sbindir}/chroma-copytool-monitor EndOfList touch base.files for base_file in $(find -L $RPM_BUILD_ROOT -type f -name '*.py'); do install_file=${base_file/$RPM_BUILD_ROOT\///} for mgmt_pat in $(> base.files done %clean rm -rf %{buildroot} %post -n python2-%{pypi_name} chkconfig lustre-modules on # disable SELinux -- it prevents both lustre and pacemaker from working sed -ie 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config # the above only disables on the next boot. set to permissive currently, also setenforce 0 rm -f /var/lib/iml/zfs_store.json %systemd_post %{unit_name} if [ $1 -eq 1 ]; then # new install; create default agent config chroma-agent reset_agent_config elif [ $1 -eq 2 ]; then # upgrade; convert any older agent config and then restart chroma-agent convert_agent_config # it's tempting to restart the agent here, but this upgrade # could have been initiated from the running chroma-agent and # so restarting here would pull the rug out from under that # upgrade procedure #systemctl restart %{name} systemctl preset %{unit_name} >/dev/null 2>&1 || : fi %preun %systemd_preun %{unit_name} %triggerin -n python2-%{pypi_name}-management -- kernel # when a kernel is installed, make sure that our kernel is reset back to # being the preferred boot kernel MOST_RECENT_KERNEL_VERSION=$(rpm -q kernel --qf "%{INSTALLTIME} %{VERSION}-%{RELEASE}.%{ARCH}\n" | sort -nr | sed -n -e '/_lustre/{s/.* //p;q}') grubby --set-default=/boot/vmlinuz-$MOST_RECENT_KERNEL_VERSION %files -f base.files -n python2-%{pypi_name} %defattr(-,root,root) %attr(0644,root,root)%{_unitdir}/%{unit_name} %attr(0644,root,root)%{_presetdir}/50-chroma-agent.preset %attr(0644,root,root)%{_unitdir}/iml-storage-server.target %attr(0644,root,root)%{_unitdir}/device-scanner.target.d/10-device-scanner.target.conf %attr(0644,root,root)%{_unitdir}/device-scanner.socket.d/10-device-scanner.socket.conf %{_bindir}/chroma-agent* %{python_sitelib}/%(a=%{pypi_name}; echo ${a//-/_})-*.egg-info/* %attr(0644,root,root)/etc/logrotate.d/chroma-agent %files -f management.files -n python2-%{pypi_name}-management %defattr(-,root,root) %changelog * Fri Dec 1 2017 Brian J. Murrell - 4.0.5.0-1 - Initial module * split out from the intel-manager-for-lustre project