forked from brianjmurrell/iml-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
python-iml-agent.spec
183 lines (154 loc) · 6.43 KB
/
python-iml-agent.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
%{?systemd_requires}
BuildRequires: systemd
%define unit_name chroma-agent.service
%global pypi_name iml-agent
%{?!version: %global version 4.1.5}
%{?!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/whamcloud/%{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: 4.1.5
# Release Start
Release: 1%{?dist}
# Release End
Summary: IML Agent
License: MIT
URL: https://pypi.python.org/pypi/%{pypi_name}
Source0: %{source}
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: Whamcloud <[email protected]>
BuildRequires: python2-setuptools
BuildRequires: systemd
%description
This is the Integrated 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: iml_sos_plugin
Requires: python2-iml-common1.4
Requires: systemd-python
Requires: python-tzlocal
Requires: python2-toolz
Requires: iml-device-scanner-proxy < 3
Requires: iml-update-check < 2
Requires: util-linux-ng
Requires(post): selinux-policy
Requires: python-urllib3
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
This is the Integrated 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: libxml2-python
Requires: python-netaddr
Requires: python-ethtool
Requires: python-jinja2
Requires: pcapy
Requires: python-impacket
Requires: system-config-firewall-base
Requires: ed
%description -n python2-%{pypi_name}-management
This package layers on management capabilities for Integrated Manager for Lustre Agent.
If using with pacemaker: pcs, fencing and resource agents should be installed.
RPMS: pcs fence-agents lustre-resource-agents
%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}/device-scanner.target.d/
install -m 644 %{unit_name} %{buildroot}%{_unitdir}/
install -m 644 iml-storage-server.target %{buildroot}%{_unitdir}/iml-storage-server.target
install -m 644 10-device-scanner.target.conf %{buildroot}%{_unitdir}/device-scanner.target.d/10-device-scanner.target.conf
mkdir -p %{buildroot}%{_presetdir}
install -m 644 50-chroma-agent.preset %{buildroot}%{_presetdir}/
mkdir -p $RPM_BUILD_ROOT/etc/{init,logrotate}.d/
install -m 644 logrotate.cfg $RPM_BUILD_ROOT/etc/logrotate.d/chroma-agent
mkdir -p %{buildroot}%{_unitdir}/device-scanner.target.d/
touch management.files
cat <<EndOfList>>management.files
%{python_sitelib}/chroma_agent/action_plugins/manage_*.py*
%{python_sitelib}/chroma_agent/templates/
%{_usr}/lib/ocf/resource.d/chroma/Target
# ZFS is pulled from resource-agents master (see README.md)
%{_usr}/lib/ocf/resource.d/chroma/ZFS
%{_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 $(<management.files); do
if [[ $install_file == $mgmt_pat ]]; then
continue 2
fi
done
echo "${install_file%.py*}.py*" >> base.files
done
%clean
rm -rf %{buildroot}
%post -n python2-%{pypi_name}
# 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
systemctl preset iml-storage-server.target
systemctl preset %{unit_name}
# this will either convert an old (pre-4.1) config or initialize
chroma-agent convert_agent_config
%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
%{_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
* Mon Jan 7 2019 Joe Grund <[email protected]> - 4.1.2.0-1
- Use Docker copr image instead of module-tools
* Mon Jul 16 2018 Joe Grund <[email protected]> - 4.1.1.0-1
- Remove old package update scan from this project.
* Fri Dec 1 2017 Brian J. Murrell <[email protected]> - 4.0.5.0-1
- Initial module
* split out from the intel-manager-for-lustre project