Browse code

Upgrade Salt to version 2018.3.3 and to support python3

Change-Id: Ib98d4e1d85f33eeea9baf89766298ab6a6f0b7ce
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6278
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Keerthana K <keerthanak@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

Vinothkumar D authored on 2018/12/04 15:44:05
Showing 9 changed files
... ...
@@ -1,4 +1,7 @@
1 1
 %{!?python2_sitelib: %define python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
+%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
3
+
4
+
2 5
 
3 6
 Name:           python-backports_abc
4 7
 Version:        0.5
... ...
@@ -24,19 +27,42 @@ BuildArch:      noarch
24 24
 %description
25 25
 
26 26
 
27
+%package -n     python3-backports_abc
28
+Summary:        python3 version A backport of recent additions to the 'collections.abc' module
29
+BuildRequires:  python3-devel
30
+Requires:       python3
31
+
32
+%description -n python3-backports_abc
33
+Python 3 version.
34
+
27 35
 %prep
28 36
 %setup -n backports_abc-%{version}
37
+rm -rf ../p3dir
38
+cp -a . ../p3dir
29 39
 
30 40
 %build
31 41
 python2 setup.py build
42
+pushd ../p3dir
43
+python3 setup.py build
44
+popd
32 45
 
33 46
 %install
34 47
 python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
48
+pushd ../p3dir
49
+python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
50
+popd
35 51
 
36 52
 %files
37 53
 %defattr(-,root,root,-)
38 54
 %{python2_sitelib}/*
39 55
 
56
+%files -n python3-backports_abc
57
+%defattr(-,root,root)
58
+%{python3_sitelib}/*
59
+
40 60
 %changelog
61
+*   Tue Dec 04 2018 Padmini Thirumalachar <pthirumalachar@vmware.com> 0.5-1
62
+-   To build python2 and python3 backports_abc packages.
41 63
 *   Wed Nov 29 2017 Padmini Thirumalachar <pthirumalachar@vmware.com> 0.5-1
42 64
 -   Initial version of python backports_abc for PhotonOS.
65
+
... ...
@@ -1,5 +1,6 @@
1 1
 [Unit]
2 2
 Description=The Salt API
3
+Documentation=man:salt-api(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltstack.com/en/latest/contents.html
3 4
 After=network.target
4 5
 
5 6
 [Service]
... ...
@@ -1,9 +1,10 @@
1 1
 [Unit]
2 2
 Description=The Salt Master Server
3
+Documentation=man:salt-master(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltstack.com/en/latest/contents.html
3 4
 After=network.target
4 5
 
5 6
 [Service]
6
-LimitNOFILE=16384
7
+LimitNOFILE=100000
7 8
 Type=notify
8 9
 NotifyAccess=all
9 10
 ExecStart=/usr/bin/salt-master
... ...
@@ -67,7 +67,7 @@ _su_cmd() {
67 67
 
68 68
 
69 69
 _get_pid() {
70
-    netstat $NS_NOTRIM -ap --protocol=unix 2>$ERROR_TO_DEVNULL \
70
+    netstat -n $NS_NOTRIM -ap --protocol=unix 2>$ERROR_TO_DEVNULL \
71 71
         | sed -r -e "\|\s${SOCK_DIR}/minion_event_${MINION_ID_HASH}_pub\.ipc$|"'!d; s|/.*||; s/.*\s//;' \
72 72
         | uniq
73 73
 }
... ...
@@ -85,6 +85,7 @@ _get_salt_config_value() {
85 85
             \"$SALTCALL\" \
86 86
             -c \"$CONFIG_DIR\" \
87 87
             --no-color \
88
+            --skip-grains \
88 89
             --local config.get \
89 90
             \"$1\" \
90 91
         " \
... ...
@@ -155,7 +156,7 @@ start() {
155 155
             printf "\nPROCESSES:\n" >&2
156 156
             ps wwwaxu | grep '[s]alt-minion' >&2
157 157
             printf "\nSOCKETS:\n" >&2
158
-            netstat $NS_NOTRIM -ap --protocol=unix | grep 'salt.*minion' >&2            
158
+            netstat -n $NS_NOTRIM -ap --protocol=unix | grep 'salt.*minion' >&2
159 159
             printf "\nLOG_FILE:\n" >&2
160 160
             tail -n 20 "$LOG_FILE" >&2
161 161
             printf "\nENVIRONMENT:\n" >&2
... ...
@@ -246,7 +247,7 @@ main() {
246 246
     fi
247 247
 
248 248
     # Check to see if --notrim is a valid netstat option
249
-    if netstat --notrim 2>&1 >/dev/null | grep -q 'unrecognized'; then
249
+    if ! ( netstat --help 2>&1 | grep -wq '\-\-notrim') ; then
250 250
         NS_NOTRIM=''
251 251
     fi
252 252
 
... ...
@@ -1,8 +1,10 @@
1 1
 [Unit]
2 2
 Description=The Salt Minion
3
-After=network.target
3
+Documentation=man:salt-minion(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltstack.com/en/latest/contents.html
4
+After=network.target salt-master.service
4 5
 
5 6
 [Service]
7
+KillMode=process
6 8
 Type=notify
7 9
 NotifyAccess=all
8 10
 LimitNOFILE=8192
... ...
@@ -1,6 +1,8 @@
1 1
 [Unit]
2 2
 Description=The Salt Master Server
3
+Documentation=man:salt-syndic(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltstack.com/en/latest/contents.html
3 4
 After=network.target
5
+PartOf=salt-master.service
4 6
 
5 7
 [Service]
6 8
 Type=notify
... ...
@@ -8,7 +8,7 @@
8 8
 %define _salttesting_ver 2016.5.11
9 9
 
10 10
 Name: salt
11
-Version: 2017.7.2
11
+Version: 2018.3.3
12 12
 Release: 1%{?dist}
13 13
 Summary: A parallel remote execution system
14 14
 
... ...
@@ -18,7 +18,7 @@ URL:     http://saltstack.org/
18 18
 Vendor:         VMware, Inc.
19 19
 Distribution:   Photon
20 20
 Source0: http://pypi.python.org/packages/source/s/%{name}/%{name}-%{version}.tar.gz
21
-%define sha1 salt=c0e7db44328e5400b17c8cd15033991855c6fe2e
21
+%define sha1 salt=18e148c2ef4418efe741c4b84d0ae284ebbf108b
22 22
 Source1: https://pypi.python.org/packages/source/S/SaltTesting/SaltTesting-2016.5.11.tar.gz
23 23
 %define sha1 SaltTesting=474dbd7029e3d48cdb468be3c63b2262e47556c8
24 24
 Source2: %{name}-master.service
... ...
@@ -48,7 +48,8 @@ Requires: PyYAML
48 48
 Requires: python-requests
49 49
 Requires: python-zmq
50 50
 Requires: tornado
51
-
51
+Requires: python-xml
52
+Requires: python-futures
52 53
 
53 54
 %description
54 55
 Salt is a distributed remote execution system used to execute commands and
... ...
@@ -314,6 +315,8 @@ rm -rf %{buildroot}
314 314
 %endif
315 315
 
316 316
 %changelog
317
+* Tue Dec 04 2018 Vinothkumar D <vinothkumard@vmware.com> 2018.3.3-1
318
+- Update to 2018.3.3
317 319
 * Thu Jan 11 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 2017.7.2-1
318 320
 - Update to 2017.7.2
319 321
 - Fixes CVE-2017-5192, CVE-2017-5200, CVE-2017-8109
320 322
new file mode 100644
... ...
@@ -0,0 +1,302 @@
0
+%global include_tests 1
1
+
2
+%{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
3
+%{!?python3_sitearch: %global python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
4
+%{!?pythonpath: %global pythonpath %(python3 -c "import os, sys; print(os.pathsep.join(x for x in sys.path if x))")}
5
+
6
+%define _salttesting SaltTesting
7
+%define _salttesting_ver 2016.5.11
8
+
9
+Name: salt3
10
+Version: 2018.3.3
11
+Release: 1%{?dist}
12
+Summary: A parallel remote execution system with python3
13
+Group:   System Environment/Daemons
14
+License: ASL 2.0
15
+URL:     http://saltstack.org/
16
+Vendor:         VMware, Inc.
17
+Distribution:   Photon
18
+Source0: http://pypi.python.org/packages/source/s/salt/salt-%{version}.tar.gz
19
+%define sha1 salt=18e148c2ef4418efe741c4b84d0ae284ebbf108b
20
+Source1: https://pypi.python.org/packages/source/S/SaltTesting/SaltTesting-2016.5.11.tar.gz
21
+%define sha1 SaltTesting=474dbd7029e3d48cdb468be3c63b2262e47556c8
22
+Source2: salt-master.service
23
+Source3: salt-syndic.service
24
+Source4: salt-minion.service
25
+Source5: salt-api.service
26
+Source6: logrotate.salt
27
+
28
+
29
+BuildRoot: %{_tmppath}/salt-%{version}-%{release}-root-%(%{__id_u} -n)
30
+BuildArch: noarch
31
+%ifarch %{ix86} x86_64
32
+Requires: dmidecode
33
+%endif
34
+
35
+
36
+Requires: pciutils
37
+Requires: python3-backports_abc
38
+BuildRequires: python3-devel
39
+BuildRequires: systemd
40
+Requires: python3-pycrypto
41
+Requires: python3-jinja2
42
+Requires: python3-msgpack
43
+Requires: python3-PyYAML
44
+Requires: python3-requests
45
+Requires: python3-zmq
46
+Requires: python3-tornado
47
+
48
+%description
49
+Salt is a distributed remote execution system used to execute commands and
50
+query data. It was developed in order to bring the best solutions found in
51
+the world of remote execution together and make them better, faster and more
52
+malleable. Salt accomplishes this via its ability to handle larger loads of
53
+information, and not just dozens, but hundreds or even thousands of individual
54
+servers, handle them quickly and through a simple and manageable interface.
55
+
56
+%package master
57
+Summary: Management component for salt, a parallel remote execution system with python3
58
+Group:   System Environment/Daemons
59
+Requires: %{name} = %{version}-%{release}
60
+%description master
61
+The Salt master is the central server to which all minions connect.
62
+
63
+%package minion
64
+Summary: Client component for Salt, a parallel remote execution system
65
+Group:   System Environment/Daemons
66
+Requires: %{name} = %{version}-%{release}
67
+%description minion
68
+The Salt minion is the agent component of Salt. It listens for instructions
69
+from the master, runs jobs, and returns results back to the master.
70
+
71
+%package syndic
72
+Summary: Master-of-master component for Salt, a parallel remote execution system
73
+Group:   System Environment/Daemons
74
+Requires: %{name} = %{version}-%{release}
75
+%description syndic
76
+The Salt syndic is a master daemon which can receive instruction from a
77
+higher-level master, allowing for tiered organization of your Salt
78
+infrastructure.
79
+
80
+%package api
81
+Summary: REST API for Salt, a parallel remote execution system
82
+Group:   System administration tools
83
+Requires: %{name}-master = %{version}-%{release}
84
+%description api
85
+salt-api provides a REST interface to the Salt master.
86
+
87
+%package cloud
88
+Summary: Cloud provisioner for Salt, a parallel remote execution system
89
+Group:   System administration tools
90
+Requires: %{name}-master = %{version}-%{release}
91
+%description cloud
92
+The salt-cloud tool provisions new cloud VMs, installs salt-minion on them, and
93
+adds them to the master's collection of controllable minions.
94
+
95
+%package ssh
96
+Summary: Agentless SSH-based version of Salt, a parallel remote execution system
97
+Group:   System administration tools
98
+Requires: %{name} = %{version}-%{release}
99
+%description ssh
100
+The salt-ssh tool can run remote execution functions and states without the use
101
+of an agent (salt-minion) service.
102
+
103
+%package proxy
104
+Summary: Command Proxy of Salt, a parallel remote execution system
105
+Group:   System administration tools
106
+Requires: %{name} = %{version}-%{release}
107
+%description proxy
108
+Receives commands from a Salt master and proxies these commands to devices 
109
+that are unable to run a full minion.
110
+
111
+%package spm
112
+Summary: Salt Package Manager of Salt, a parallel remote execution system
113
+Group:   System administration tools
114
+Requires: %{name} = %{version}-%{release}
115
+%description spm
116
+Salt Package Manager
117
+
118
+
119
+%prep
120
+%setup -c -n salt-%{version}
121
+cd salt-%{version}
122
+
123
+%build
124
+
125
+%install
126
+rm -rf %{buildroot}
127
+cd $RPM_BUILD_DIR/salt-%{version}/salt-%{version}
128
+python3 setup.py install -O1 --root %{buildroot}
129
+
130
+# Add some directories
131
+install -d -m 0755 %{buildroot}%{_var}/cache/salt
132
+install -d -m 0755 %{buildroot}%{_sysconfdir}/salt
133
+install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.conf.d
134
+install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.deploy.d
135
+install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.maps.d
136
+install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.profiles.d
137
+install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.providers.d
138
+
139
+# Add the config files
140
+install -p -m 0640 conf/minion %{buildroot}%{_sysconfdir}/salt/minion
141
+install -p -m 0640 conf/master %{buildroot}%{_sysconfdir}/salt/master
142
+install -p -m 0640 conf/cloud %{buildroot}%{_sysconfdir}/salt/cloud
143
+install -p -m 0640 conf/roster %{buildroot}%{_sysconfdir}/salt/roster
144
+
145
+mkdir -p %{buildroot}%{_unitdir}
146
+install -p -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/
147
+install -p -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/
148
+install -p -m 0644 %{SOURCE4} %{buildroot}%{_unitdir}/
149
+install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}/
150
+mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d/
151
+install -p -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/logrotate.d/salt
152
+
153
+%clean
154
+rm -rf %{buildroot}
155
+
156
+
157
+%files
158
+%defattr(-,root,root,-)
159
+%doc $RPM_BUILD_DIR/salt-%{version}/salt-%{version}/LICENSE
160
+%{python3_sitelib}/salt/*
161
+%{python3_sitelib}/salt-*-py?.?.egg-info
162
+%{_sysconfdir}/logrotate.d/salt
163
+%{_var}/cache/salt
164
+
165
+
166
+%files master
167
+%defattr(-,root,root)
168
+%doc %{_mandir}/man7/salt.7.*
169
+%doc %{_mandir}/man1/salt-cp.1.*
170
+%doc %{_mandir}/man1/salt-key.1.*
171
+%doc %{_mandir}/man1/salt-master.1.*
172
+%doc %{_mandir}/man1/salt-run.1.*
173
+%doc %{_mandir}/man1/salt-unity.1.*
174
+%doc %{_mandir}/man1/salt.1.*
175
+%{_bindir}/salt
176
+%{_bindir}/salt-cp
177
+%{_bindir}/salt-key
178
+%{_bindir}/salt-master
179
+%{_bindir}/salt-run
180
+%{_bindir}/salt-unity
181
+%config(noreplace) %{_unitdir}/salt-master.service
182
+%config(noreplace) %{_sysconfdir}/salt/master
183
+
184
+%files minion
185
+%defattr(-,root,root)
186
+%doc %{_mandir}/man1/salt-call.1.*
187
+%doc %{_mandir}/man1/salt-minion.1.*
188
+%{_bindir}/salt-minion
189
+%{_bindir}/salt-call
190
+%config(noreplace) %{_unitdir}/salt-minion.service
191
+%config(noreplace) %{_sysconfdir}/salt/minion
192
+
193
+%files syndic
194
+%doc %{_mandir}/man1/salt-syndic.1.*
195
+%{_bindir}/salt-syndic
196
+%config(noreplace) %{_unitdir}/salt-syndic.service
197
+
198
+%files api
199
+%defattr(-,root,root)
200
+%doc %{_mandir}/man1/salt-api.1.*
201
+%{_bindir}/salt-api
202
+%config(noreplace) %{_unitdir}/salt-api.service
203
+
204
+%files cloud
205
+%doc %{_mandir}/man1/salt-cloud.1.*
206
+%{_bindir}/salt-cloud
207
+%{_sysconfdir}/salt/cloud.conf.d
208
+%{_sysconfdir}/salt/cloud.deploy.d
209
+%{_sysconfdir}/salt/cloud.maps.d
210
+%{_sysconfdir}/salt/cloud.profiles.d
211
+%{_sysconfdir}/salt/cloud.providers.d
212
+%config(noreplace) %{_sysconfdir}/salt/cloud
213
+
214
+%files ssh
215
+%doc %{_mandir}/man1/salt-ssh.1.*
216
+%{_bindir}/salt-ssh
217
+%{_sysconfdir}/salt/roster
218
+
219
+%files proxy
220
+%doc %{_mandir}/man1/salt-proxy.1.*
221
+%{_bindir}/salt-proxy
222
+
223
+%files spm
224
+%doc %{_mandir}/man1/spm.1.*
225
+%{_bindir}/spm
226
+
227
+%preun master
228
+%if 0%{?systemd_preun:1}
229
+  %systemd_preun salt-master.service
230
+%else
231
+  if [ $1 -eq 0 ] ; then
232
+    # Package removal, not upgrade
233
+    /bin/systemctl --no-reload disable salt-master.service > /dev/null 2>&1 || :
234
+    /bin/systemctl stop salt-master.service > /dev/null 2>&1 || :
235
+  fi
236
+
237
+%preun syndic
238
+%if 0%{?systemd_preun:1}
239
+  %systemd_preun salt-syndic.service
240
+%else
241
+  if [ $1 -eq 0 ] ; then
242
+    # Package removal, not upgrade
243
+    /bin/systemctl --no-reload disable salt-syndic.service > /dev/null 2>&1 || :
244
+    /bin/systemctl stop salt-syndic.service > /dev/null 2>&1 || :
245
+  fi
246
+%endif
247
+
248
+%preun minion
249
+%if 0%{?systemd_preun:1}
250
+  %systemd_preun salt-minion.service
251
+%else
252
+  if [ $1 -eq 0 ] ; then
253
+    # Package removal, not upgrade
254
+    /bin/systemctl --no-reload disable salt-minion.service > /dev/null 2>&1 || :
255
+    /bin/systemctl stop salt-minion.service > /dev/null 2>&1 || :
256
+  fi
257
+%endif
258
+
259
+%post master
260
+%if 0%{?systemd_post:1}
261
+  %systemd_post salt-master.service
262
+%else
263
+  /bin/systemctl daemon-reload &>/dev/null || :
264
+%endif
265
+
266
+%post minion
267
+%if 0%{?systemd_post:1}
268
+  %systemd_post salt-minion.service
269
+%else
270
+  /bin/systemctl daemon-reload &>/dev/null || :
271
+%endif
272
+
273
+%postun master
274
+%if 0%{?systemd_post:1}
275
+  %systemd_postun salt-master.service
276
+%else
277
+  /bin/systemctl daemon-reload &>/dev/null
278
+  [ $1 -gt 0 ] && /bin/systemctl try-restart salt-master.service &>/dev/null || :
279
+%endif
280
+
281
+%postun syndic
282
+%if 0%{?systemd_post:1}
283
+  %systemd_postun salt-syndic.service
284
+%else
285
+  /bin/systemctl daemon-reload &>/dev/null
286
+  [ $1 -gt 0 ] && /bin/systemctl try-restart salt-syndic.service &>/dev/null || :
287
+%endif
288
+
289
+%postun minion
290
+%if 0%{?systemd_post:1}
291
+  %systemd_postun salt-minion.service
292
+%else
293
+  /bin/systemctl daemon-reload &>/dev/null
294
+  [ $1 -gt 0 ] && /bin/systemctl try-restart salt-minion.service &>/dev/null || :
295
+%endif
296
+%endif
297
+
298
+%changelog
299
+* Tue Dec 04 2018 Vinothkumar D <vinothkumard@vmware.com> 2018.3.3-1
300
+- This is an initial version of salt with python3 support for Photon OS
301
+  The source is from https://github.com/saltstack/salt/archive/v2018.3.3.tar.gz
... ...
@@ -1,4 +1,5 @@
1 1
 %{!?python2_sitelib: %define python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
+%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2 3
 
3 4
 Name:           tornado
4 5
 Version:        4.5.2
... ...
@@ -23,20 +24,47 @@ BuildArch:      x86_64
23 23
 
24 24
 %description
25 25
 
26
+%package -n     python3-tornado
27
+Summary:        python3 version 
28
+BuildRequires:  python3
29
+BuildRequires:  python3-devel
30
+BuildRequires:  python3-libs
31
+Requires:       python3
32
+Requires:       python3-libs
33
+
34
+%description -n python3-tornado
35
+Python 3 version.
36
+
37
+
26 38
 
27 39
 %prep
28 40
 %setup -n tornado-%{version}
41
+rm -rf ../p3dir
42
+cp -a . ../p3dir
29 43
 
30 44
 %build
31 45
 python2 setup.py build
46
+pushd ../p3dir
47
+python3 setup.py build
48
+popd
32 49
 
33 50
 %install
34 51
 python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
52
+pushd ../p3dir
53
+python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
54
+popd
35 55
 
36 56
 %files
37 57
 %defattr(-,root,root,-)
38 58
 %{python2_sitelib}/*
39 59
 
60
+%files -n python3-tornado
61
+%defattr(-,root,root)
62
+%{python3_sitelib}/*
63
+
40 64
 %changelog
65
+*   Tue Dec 04 2018 Padmini Thirumalachar <pthirumalachar@vmware.com> 4.5.2-1
66
+-   To build python2 and python3 tornado packages
41 67
 *   Mon Dec 11 2017 Padmini Thirumalachar <pthirumalachar@vmware.com> 4.5.2-1
42 68
 -   Initial version of python tornado for PhotonOS.
69
+