-
Notifications
You must be signed in to change notification settings - Fork 1
/
python-saline.spec
144 lines (113 loc) · 4.28 KB
/
python-saline.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
# spec file for package python-saline
%define pythons python3
%{?!python_module:%define python_module() python3-%{**}}
%define salt_formulas_dir %{_datadir}/salt-formulas
Name: python-saline
Version: 0
Release: 0
Summary: The salt events collector and manager python module
License: GPL-2.0+
Group: Development/Languages/Python
URL: https://github.com/vzhestkov/saline
Source0: saline-%{version}.tar.gz
BuildArch: noarch
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: systemd-rpm-macros
BuildRequires: %{python_module base}
Requires: python-CherryPy
Requires: python-python-dateutil
Requires: python-salt
Requires: config(saline) = %{version}-%{release}
Requires(post): update-alternatives
Requires(postun):update-alternatives
Provides: saline(module-python) = %{version}-%{release}
BuildRoot: %{_tmppath}/saline-%{version}
%python_subpackages
%description
Saline python library.
Saline is an extension for Salt providing an extra control of state apply process.
Saline also exposes the metrics from salt events to provide more visible salt monitoring.
%package -n saline
Summary: The salt events collector and manager
Group: System/Management
Requires(pre): salt
Requires: logrotate
Requires: salt-master
Requires: systemd
Requires: saline(module-python) = %{version}-%{release}
%description -n saline
Saline is an extension for Salt providing an extra control of state apply process.
Saline also exposes the metrics from salt events to provide more visible salt monitoring.
%package -n saline-formula
Summary: Saline salt formula for Uyuni/SUSE Manager
Group: System/Management
Requires: grafana-formula
Requires: prometheus-exporters-formula
%description -n saline-formula
Saline salt formula for Uyuni/SUSE Manager with exporters configuration and dashboards.
%prep
%autosetup -n saline-%{version}
%build
%python_build
%install
install -Dpm 0644 salined.service %{buildroot}%{_unitdir}/salined.service
install -Ddm 0755 %{buildroot}%{_sbindir}
ln -sv %{_sbindir}/service %{buildroot}%{_sbindir}/rcsalined
install -Dpm 0755 scripts/saline-setup %{buildroot}%{_sbindir}/
install -Dpm 0644 conf/logrotate.d/saline %{buildroot}%{_sysconfdir}/logrotate.d/saline
install -Ddm 0755 %{buildroot}%{_sysconfdir}/salt/saline.d
install -Dpm 0644 conf/salt/saline %{buildroot}%{_sysconfdir}/salt/saline
install -Dpm 0644 conf/salt/saline.d/*.conf %{buildroot}%{_sysconfdir}/salt/saline.d/
install -Ddm 0755 %{buildroot}%{_sysconfdir}/salt/pki/saline
install -Ddm 0755 %{buildroot}%{_sysconfdir}/alternatives
%{python_expand %$python_install
mv %{buildroot}%{_bindir}/salined %{buildroot}%{_bindir}/salined-%{$python_bin_suffix}
}
%prepare_alternative salined
%{python_expand \
%fdupes %{buildroot}%{$python_sitelib}
}
install -Ddm 0755 %{buildroot}%{salt_formulas_dir}/metadata
install -Ddm 0755 %{buildroot}%{salt_formulas_dir}/states
cp -a formulas/metadata/* %{buildroot}%{salt_formulas_dir}/metadata/
cp -a formulas/states/* %{buildroot}%{salt_formulas_dir}/states/
%pre -n saline
%service_add_pre salined.service
%preun -n saline
%service_del_preun salined.service
%post
%python_install_alternative salined
%post -n saline
%service_add_post salined.service
%postun
%python_uninstall_alternative salined
%postun -n saline
%service_del_postun_with_restart salined.service
%files %python_files
%defattr(-,root,root,-)
%python_alternative %{_bindir}/salined
%{python_sitelib}/saline*
%files -n saline
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/logrotate.d/saline
%dir %{_sysconfdir}/salt/saline.d
%config %{_sysconfdir}/salt/saline
%config %{_sysconfdir}/salt/saline.d/*.conf
%dir %{_sysconfdir}/salt/pki/saline
%ghost %config %{_sysconfdir}/salt/pki/saline/uyuni.crt
%ghost %config %{_sysconfdir}/salt/pki/saline/uyuni.key
%{_sbindir}/saline-setup
%{_sbindir}/rcsalined
%{_unitdir}/salined.service
%ghost %dir /var/log/salt
%ghost /var/log/salt/saline
%ghost /var/log/salt/saline-api-access.log
%ghost /var/log/salt/saline-api-error.log
%files -n saline-formula
%dir %{salt_formulas_dir}
%dir %{salt_formulas_dir}/metadata
%dir %{salt_formulas_dir}/states
%{salt_formulas_dir}/metadata/saline-*
%{salt_formulas_dir}/states/saline-*
%changelog