Browse code

salt3: update to 2019.2.4

Change-Id: I4c2d002634ce1567f9a21d7513c0ee119c2e4d2d
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/10047
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

Keerthana K authored on 2020/05/12 19:50:42
Showing 12 changed files
... ...
@@ -1,8 +1,11 @@
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
5
-Release:        2%{?dist}
8
+Release:        3%{?dist}
6 9
 Summary:        A backport of recent additions to the 'collections.abc' module.
7 10
 License:        PSFL
8 11
 Group:          Development/Languages/Python
... ...
@@ -24,14 +27,30 @@ 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
 %check
37 53
 python2 tests.py
... ...
@@ -40,8 +59,16 @@ python2 tests.py
40 40
 %defattr(-,root,root,-)
41 41
 %{python2_sitelib}/*
42 42
 
43
+%files -n python3-backports_abc
44
+%defattr(-,root,root)
45
+%{python3_sitelib}/*
46
+
43 47
 %changelog
48
+
49
+*   Tue Dec 17 2019 Vinothkumar D <vinothkumard@vmware.com> 0.5-3
50
+-   To build python2 and python3 backports_abc packages.
44 51
 *   Tue Dec 04 2018 Ashwin H <ashwinh@vmware.com> 0.5-2
45 52
 -   Add %check
46 53
 *   Wed Nov 29 2017 Padmini Thirumalachar <pthirumalachar@vmware.com> 0.5-1
47 54
 -   Initial version of python backports_abc for PhotonOS.
55
+
48 56
new file mode 100644
... ...
@@ -0,0 +1,39 @@
0
+/var/log/salt/master {
1
+    weekly
2
+    missingok
3
+    rotate 5
4
+    compress
5
+    notifempty
6
+}
7
+
8
+/var/log/salt/minion {
9
+    weekly
10
+    missingok
11
+    rotate 5
12
+    compress
13
+    notifempty
14
+}
15
+
16
+/var/log/salt/key {
17
+    weekly
18
+    missingok
19
+    rotate 5
20
+    compress
21
+    notifempty
22
+}
23
+
24
+/var/log/salt/cloud {
25
+    weekly
26
+    missingok
27
+    rotate 5
28
+    compress
29
+    notifempty
30
+}
31
+
32
+/var/log/salt/ssh {
33
+    weekly
34
+    missingok
35
+    rotate 5
36
+    compress
37
+    notifempty
38
+}
0 39
new file mode 100644
... ...
@@ -0,0 +1,154 @@
0
+#!/bin/sh
1
+#
2
+# Salt API
3
+###################################
4
+
5
+# LSB header
6
+
7
+### BEGIN INIT INFO
8
+# Provides:          salt-api
9
+# Required-Start:    $local_fs $remote_fs $network $named $time
10
+# Should-Start:		 $time ypbind smtp
11
+# Required-Stop:	 $local_fs $remote_fs $network $named $time
12
+# Should-Stop:		 ypbind smtp
13
+# Default-Start:     3 5
14
+# Default-Stop:      0 1 2 6
15
+# Short-Description: Salt API control daemon
16
+# Description:       This is a daemon that controls the Salt API.
17
+### END INIT INFO
18
+
19
+
20
+# chkconfig header
21
+
22
+# chkconfig: 345 99 99
23
+# description:  This is a daemon that controls the Salt API.
24
+#
25
+# processname: /usr/bin/salt-api
26
+
27
+
28
+if [ -f /etc/default/salt ]; then
29
+    . /etc/default/salt
30
+else
31
+    SALTAPI=/usr/bin/salt-api
32
+    PYTHON=/usr/bin/python
33
+fi
34
+
35
+# Sanity checks.
36
+[ -x $SALTAPI ] || exit 0
37
+
38
+DEBIAN_VERSION=/etc/debian_version
39
+SUSE_RELEASE=/etc/SuSE-release
40
+# Source function library.
41
+if [ -f $DEBIAN_VERSION ]; then
42
+   break
43
+elif [ -f $SUSE_RELEASE -a -r /etc/rc.status ]; then
44
+    . /etc/rc.status
45
+else
46
+    . /etc/rc.d/init.d/functions
47
+fi
48
+
49
+SERVICE=salt-api
50
+PROCESS=salt-api
51
+CONFIG_ARGS="-d"
52
+PID_FILE="/var/run/salt-api.pid"
53
+
54
+RETVAL=0
55
+
56
+start() {
57
+    echo -n $"Starting salt-api daemon: "
58
+    if [ -f $SUSE_RELEASE ]; then
59
+        startproc -f -p /var/run/$SERVICE.pid $SALTAPI $CONFIG_ARGS
60
+        rc_status -v
61
+    elif [ -e $DEBIAN_VERSION ]; then
62
+        if [ -f $LOCKFILE ]; then
63
+            echo -n "already started, lock file found"
64
+            RETVAL=1
65
+        elif $PYTHON $SALTAPI; then
66
+            echo -n "OK"
67
+            RETVAL=0
68
+        fi
69
+    else
70
+        if status $PROCESS &> /dev/null; then
71
+            failure "Already running."
72
+            RETVAL=1
73
+        else
74
+            daemon --pidfile=$PID_FILE --check $SERVICE $SALTAPI $CONFIG_ARGS
75
+            RETVAL=$?
76
+            [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE
77
+            echo
78
+            return $RETVAL
79
+        fi
80
+    fi
81
+    RETVAL=$?
82
+    echo
83
+    return $RETVAL
84
+}
85
+
86
+stop() {
87
+    echo -n $"Stopping salt-api daemon: "
88
+    if [ -f $SUSE_RELEASE ]; then
89
+        killproc -TERM $SALTAPI
90
+        rc_status -v
91
+    elif [ -f $DEBIAN_VERSION ]; then
92
+        # Added this since Debian's start-stop-daemon doesn't support spawned processes
93
+        if ps -ef | grep "$PYTHON $SALTAPI" | grep -v grep | awk '{print $2}' | xargs kill &> /dev/null; then
94
+            echo -n "OK"
95
+            RETVAL=0
96
+        else
97
+            echo -n "Daemon is not started"
98
+            RETVAL=1
99
+        fi
100
+    else
101
+        killproc $PROCESS
102
+        RETVAL=$?
103
+        echo
104
+        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE
105
+        return $RETVAL
106
+    fi
107
+    RETVAL=$?
108
+    echo
109
+    return $RETVAL
110
+}
111
+
112
+restart() {
113
+   stop
114
+   start
115
+}
116
+
117
+# See how we were called.
118
+case "$1" in
119
+    start|stop|restart)
120
+        $1
121
+        ;;
122
+    status)
123
+        if [ -f $SUSE_RELEASE ]; then
124
+            echo -n "Checking for service salt-api "
125
+            checkproc $SALTAPI
126
+            rc_status -v
127
+            RETVAL=$?
128
+        elif [ -f $DEBIAN_VERSION ]; then
129
+            if [ -f $LOCKFILE ]; then
130
+                RETVAL=0
131
+                echo "salt-api is running."
132
+            else
133
+                RETVAL=1
134
+                echo "salt-api is stopped."
135
+            fi
136
+        else
137
+            status $PROCESS
138
+            RETVAL=$?
139
+        fi
140
+        ;;
141
+    condrestart|try-restart)
142
+        [ -f $LOCKFILE ] && restart || :
143
+        ;;
144
+    reload)
145
+        echo "can't reload configuration, you have to restart it"
146
+        RETVAL=1
147
+        ;;
148
+    *)
149
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload}"
150
+        exit 1
151
+        ;;
152
+esac
153
+exit $RETVAL
0 154
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+[Unit]
1
+Description=The Salt API
2
+Documentation=man:salt-api(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltstack.com/en/latest/contents.html
3
+After=network.target
4
+
5
+[Service]
6
+Type=notify
7
+NotifyAccess=all
8
+LimitNOFILE=8192
9
+ExecStart=/usr/bin/salt-api
10
+TimeoutStopSec=3
11
+
12
+[Install]
13
+WantedBy=multi-user.target
0 14
new file mode 100644
... ...
@@ -0,0 +1,142 @@
0
+#!/bin/sh
1
+#
2
+# Salt master
3
+###################################
4
+
5
+# LSB header
6
+
7
+### BEGIN INIT INFO
8
+# Provides:          salt-master
9
+# Required-Start:    $all
10
+# Required-Stop:
11
+# Default-Start:     2 3 4 5
12
+# Default-Stop:      0 1 6
13
+# Short-Description: Salt master control daemon
14
+# Description:       This is a daemon that controls the Salt minions.
15
+### END INIT INFO
16
+
17
+
18
+# chkconfig header
19
+
20
+# chkconfig: 345 96 05
21
+# description:  This is a daemon that controls the Salt minions
22
+#
23
+# processname: /usr/bin/salt-master
24
+
25
+
26
+DEBIAN_VERSION=/etc/debian_version
27
+SUSE_RELEASE=/etc/SuSE-release
28
+# Source function library.
29
+if [ -f $DEBIAN_VERSION ]; then
30
+   break
31
+elif [ -f $SUSE_RELEASE -a -r /etc/rc.status ]; then
32
+    . /etc/rc.status
33
+else
34
+    . /etc/rc.d/init.d/functions
35
+fi
36
+
37
+# Default values (can be overridden below)
38
+SALTMASTER=/usr/bin/salt-master
39
+PYTHON=/usr/bin/python
40
+MASTER_ARGS=""
41
+
42
+if [ -f /etc/default/salt ]; then
43
+    . /etc/default/salt
44
+fi
45
+
46
+SERVICE=salt-master
47
+PROCESS=salt-master
48
+
49
+RETVAL=0
50
+
51
+start() {
52
+    echo -n $"Starting salt-master daemon: "
53
+    if [ -f $SUSE_RELEASE ]; then
54
+        startproc -f -p /var/run/$SERVICE.pid $SALTMASTER -d $MASTER_ARGS
55
+        rc_status -v
56
+    elif [ -e $DEBIAN_VERSION ]; then
57
+        if [ -f $LOCKFILE ]; then
58
+            echo -n "already started, lock file found"
59
+            RETVAL=1
60
+        elif $PYTHON $SALTMASTER -d $MASTER_ARGS >& /dev/null; then
61
+            echo -n "OK"
62
+            RETVAL=0
63
+        fi
64
+    else
65
+        daemon --check $SERVICE $SALTMASTER -d $MASTER_ARGS
66
+        RETVAL=$?
67
+        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE
68
+        echo
69
+        return $RETVAL
70
+    fi
71
+    RETVAL=$?
72
+    echo
73
+    return $RETVAL
74
+}
75
+
76
+stop() {
77
+    echo -n $"Stopping salt-master daemon: "
78
+    if [ -f $SUSE_RELEASE ]; then
79
+        killproc -TERM $SALTMASTER
80
+        rc_status -v
81
+    elif [ -f $DEBIAN_VERSION ]; then
82
+        # Added this since Debian's start-stop-daemon doesn't support spawned processes
83
+        if ps -ef | grep "$PYTHON $SALTMASTER" | grep -v grep | awk '{print $2}' | xargs kill &> /dev/null; then
84
+            echo -n "OK"
85
+            RETVAL=0
86
+        else
87
+            echo -n "Daemon is not started"
88
+            RETVAL=1
89
+        fi
90
+    else
91
+        killproc $PROCESS
92
+        RETVAL=$?
93
+        echo
94
+        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE
95
+        return $RETVAL
96
+    fi
97
+    RETVAL=$?
98
+    echo
99
+}
100
+
101
+restart() {
102
+   stop
103
+   start
104
+}
105
+
106
+# See how we were called.
107
+case "$1" in
108
+    start|stop|restart)
109
+        $1
110
+        ;;
111
+    status)
112
+        if [ -f $SUSE_RELEASE ]; then
113
+            echo -n "Checking for service salt-master "
114
+            checkproc $SALTMASTER
115
+            rc_status -v
116
+        elif [ -f $DEBIAN_VERSION ]; then
117
+            if [ -f $LOCKFILE ]; then
118
+                RETVAL=0
119
+                echo "salt-master is running."
120
+            else
121
+                RETVAL=1
122
+                echo "salt-master is stopped."
123
+            fi
124
+        else
125
+            status $PROCESS
126
+            RETVAL=$?
127
+        fi
128
+        ;;
129
+    condrestart)
130
+        [ -f $LOCKFILE ] && restart || :
131
+        ;;
132
+    reload)
133
+        echo "can't reload configuration, you have to restart it"
134
+        RETVAL=1
135
+        ;;
136
+    *)
137
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
138
+        exit 1
139
+        ;;
140
+esac
141
+exit $RETVAL
0 142
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+[Unit]
1
+Description=The Salt Master Server
2
+Documentation=man:salt-master(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltstack.com/en/latest/contents.html
3
+After=network.target
4
+
5
+[Service]
6
+LimitNOFILE=100000
7
+Type=notify
8
+NotifyAccess=all
9
+ExecStart=/usr/bin/salt-master
10
+
11
+[Install]
12
+WantedBy=multi-user.target
0 13
new file mode 100644
... ...
@@ -0,0 +1,325 @@
0
+#!/bin/sh
1
+#
2
+# Salt minion
3
+###################################
4
+
5
+# LSB header
6
+
7
+### BEGIN INIT INFO
8
+# Provides:          salt-minion
9
+# Required-Start:    $all
10
+# Required-Stop:
11
+# Default-Start:     2 3 4 5
12
+# Default-Stop:      0 1 6
13
+# Short-Description: Salt minion daemon
14
+# Description:       This is the Salt minion daemon that can be controlled by the
15
+#                    Salt master.
16
+### END INIT INFO
17
+
18
+
19
+# chkconfig header
20
+
21
+# chkconfig: 345 97 04
22
+# description:  This is the Salt minion daemon that can be controlled by the Salt master.
23
+#
24
+# processname: /usr/bin/salt-minion
25
+
26
+# Allow these to be overridden for tests
27
+: "${SALTMINION_BINDIR:=/usr/bin}"
28
+: "${SALTMINION_SYSCONFDIR:=/etc}"
29
+
30
+# Default values (can be overridden in settings file)
31
+: "${USER:=$(id -nu)}"
32
+SALTMINION="${SALTMINION_BINDIR}/salt-minion"
33
+SALTCALL="${SALTMINION_BINDIR}/salt-call"
34
+# SALTMINION_CONFIGS are newline-separated entries of: MINION_USER CONFIG_DIR
35
+: "${SALTMINION_CONFIGS:="
36
+$USER ${SALTMINION_SYSCONFDIR}/salt
37
+"}"
38
+SALTMINION_ARGS=""
39
+SALTMINION_TIMEOUT=30
40
+SALTMINION_TICK=1
41
+
42
+SERVICE="salt-minion"
43
+
44
+# Read in settings file
45
+if [ -f "${SALTMINION_SYSCONFDIR}/default/salt" ]; then
46
+    . "${SALTMINION_SYSCONFDIR}/default/salt"
47
+elif [ -f "${SALTMINION_SYSCONFDIR}/sysconfig/salt" ]; then
48
+    . "${SALTMINION_SYSCONFDIR}/sysconfig/salt"
49
+fi
50
+
51
+RETVAL=0
52
+NS_NOTRIM="--notrim"
53
+ERROR_TO_DEVNULL="/dev/null"
54
+
55
+
56
+_su_cmd() {
57
+    local user="$1"
58
+    shift
59
+
60
+    if [ "X$USER" = "X$user" ]; then
61
+        eval $1
62
+    else
63
+        su -l -c "$1" "$user"
64
+    fi
65
+}
66
+
67
+
68
+_get_pid() {
69
+    netstat -n $NS_NOTRIM -ap --protocol=unix 2>$ERROR_TO_DEVNULL \
70
+        | sed -r -e "\|\s${SOCK_DIR}/minion_event_${MINION_ID_HASH}_pub\.ipc$|"'!d; s|/.*||; s/.*\s//;' \
71
+        | uniq
72
+}
73
+
74
+
75
+_is_running() {
76
+    [ -n "$(_get_pid)" ]
77
+}
78
+
79
+
80
+_get_salt_config_value() {
81
+    _su_cmd \
82
+        "$MINION_USER" \
83
+        "\
84
+            \"$SALTCALL\" \
85
+            -c \"$CONFIG_DIR\" \
86
+            --no-color \
87
+            --skip-grains \
88
+            --local config.get \
89
+            \"$1\" \
90
+        " \
91
+        2>$ERROR_TO_DEVNULL \
92
+        | sed -r -e '2!d; s/^\s*//;'
93
+}
94
+
95
+
96
+_make_id_hash() {
97
+    # $1 - minion_id
98
+    local hasher=''
99
+
100
+    case "$(_get_salt_config_value hash_type)" in
101
+        (md5) hasher="md5sum";;
102
+        (sha1) hasher="sha1sum";;
103
+        (sha224) hasher="sha224sum";;
104
+        (sha256) hasher="sha256sum";;
105
+        (sha384) hasher="sha384sum";;
106
+        (sha512) hasher="sha512sum";;
107
+        (*) echo "ERROR: No salt hash_type specified";;
108
+    esac
109
+
110
+    if [ -n "$hasher" ]; then
111
+        printf "$1" | "$hasher" | cut -c 1-10
112
+    fi
113
+}
114
+
115
+
116
+start() {
117
+    # $1 - config dir
118
+    local retval=0
119
+
120
+    if _is_running; then
121
+        echo "Service $SERVICE:$MINION_USER:$MINION_ID already running"
122
+        return 0
123
+    fi
124
+
125
+    echo -n "Starting $SERVICE:$MINION_USER:$MINION_ID daemon: "
126
+
127
+    _su_cmd \
128
+        "$MINION_USER" \
129
+        "\
130
+            \"$SALTMINION\" \
131
+            -c \"$CONFIG_DIR\" \
132
+            -d $SALTMINION_ARGS \
133
+            ${SALTMINION_DEBUG:+-l debug} \
134
+        " \
135
+        2>$ERROR_TO_DEVNULL \
136
+        || retval=$?
137
+
138
+    if [ 0 -eq "$retval" ]; then
139
+        local endtime=$(($(date '+%s')+$SALTMINION_TIMEOUT))
140
+        while ! _is_running; do
141
+            if [ "$endtime" -lt "$(date '+%s')" ]; then
142
+                echo -n "TIMEOUT "
143
+                retval=1
144
+                break
145
+            fi
146
+            sleep $SALTMINION_TICK
147
+        done
148
+    fi
149
+
150
+    if [ 0 -eq "$retval" ]; then
151
+        echo -n "OK"
152
+    else
153
+        echo -n "FAIL"
154
+        if [ -n "$SALTMINION_DEBUG" ]; then
155
+            printf "\nPROCESSES:\n" >&2
156
+            ps wwwaxu | grep '[s]alt-minion' >&2
157
+            printf "\nSOCKETS:\n" >&2
158
+            netstat -n $NS_NOTRIM -ap --protocol=unix | grep 'salt.*minion' >&2
159
+            printf "\nLOG_FILE:\n" >&2
160
+            tail -n 20 "$LOG_FILE" >&2
161
+            printf "\nENVIRONMENT:\n" >&2
162
+            env >&2
163
+        fi
164
+    fi
165
+    echo
166
+
167
+    return $retval
168
+}
169
+
170
+
171
+stop() {
172
+    # $1 - config dir
173
+    local retval=0
174
+
175
+    if ! _is_running; then
176
+        echo "Service $SERVICE:$MINION_USER:$MINION_ID is not running"
177
+        return 0
178
+    fi
179
+        
180
+    echo -n "Stopping $SERVICE:$MINION_USER:$MINION_ID daemon: "
181
+    local pid="$(_get_pid)"
182
+
183
+    # pid below is intentionally not quoted in case there are *multiple*
184
+    # minions running with the same configuration.
185
+    _su_cmd "$MINION_USER" "kill -TERM $pid 2>/dev/null" || retval=$?
186
+    if [ 0 -eq "$retval" ]; then 
187
+        local endtime=$(($(date '+%s')+$SALTMINION_TIMEOUT))
188
+        while _is_running; do
189
+            if [ "$endtime" -lt "$(date '+%s')" ]; then
190
+                # Try one more time with a big hammer
191
+                _su_cmd "$MINION_USER" "kill -KILL $pid 2>/dev/null" || :
192
+                sleep $SALTMINION_TICK
193
+                if _is_running; then
194
+                    echo -n "TIMEOUT "
195
+                    retval=1
196
+                fi
197
+                break
198
+            fi
199
+            sleep 1
200
+        done
201
+
202
+    fi
203
+
204
+    if [ 0 -eq "$retval" ]; then
205
+        rm -f "$PID_FILE"
206
+        echo -n "OK"
207
+    else
208
+        echo -n "FAIL"
209
+    fi
210
+
211
+    echo
212
+
213
+    return $retval
214
+}
215
+
216
+
217
+status() {
218
+    local retval=0
219
+    local pid="$(_get_pid)"
220
+
221
+    if [ -n "$pid" ]; then
222
+        # Unquote $pid here to display multiple PIDs in one line
223
+        echo "$SERVICE:$MINION_USER:$MINION_ID is running:" $pid
224
+    else
225
+        retval=3
226
+        echo "$SERVICE:$MINION_USER:$MINION_ID is stopped."
227
+        if [ -e "$PID_FILE" ]; then
228
+            echo "$SERVICE:$MINION_USER:$MINION_ID has orphaned pid file: $PID_FILE."
229
+            retval=1
230
+        fi
231
+    fi
232
+    return $retval
233
+}
234
+
235
+restart() {
236
+    # $1 - config dir
237
+    stop "$1"
238
+    start "$1"
239
+}
240
+
241
+
242
+main() {
243
+    if [ -n "$SALTMINION_DEBUG" ]; then
244
+        set -x
245
+        ERROR_TO_DEVNULL="&2"
246
+    fi
247
+
248
+    # Check to see if --notrim is a valid netstat option
249
+    if ! ( netstat --help 2>&1 | grep -wq '\-\-notrim') ; then
250
+        NS_NOTRIM=''
251
+    fi
252
+
253
+    # Pre-filter for unhandled commands
254
+    case "$1" in
255
+        (start|stop|status|restart|condrestart|try-restart) ;;
256
+        (reload)
257
+            echo "Can't reload $SERVICE - you must restart it"
258
+            exit 3
259
+            ;;
260
+        (*)
261
+            echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload}"
262
+            exit 2
263
+            ;;
264
+    esac
265
+
266
+    while read MINION_USER CONFIG_DIR; do
267
+        if [ -z "$CONFIG_DIR" ]; then
268
+            continue
269
+        fi
270
+
271
+        if ! [ -d "$CONFIG_DIR" ]; then
272
+            echo "ERROR: non-existent $SERVICE config directory: $CONFIG_DIR"
273
+            RETVAL=1
274
+            continue
275
+        fi
276
+
277
+        SOCK_DIR="$(_get_salt_config_value sock_dir)"
278
+        PID_FILE="$(_get_salt_config_value pidfile)"
279
+        LOG_FILE="$(_get_salt_config_value log_file)"
280
+        MINION_ID="$(_get_salt_config_value id)"
281
+        MINION_ID_HASH="$(_make_id_hash "$MINION_ID")"
282
+        if [ \
283
+            -z "$SOCK_DIR" \
284
+            -o -z "$PID_FILE" \
285
+            -o -z "$LOG_FILE" \
286
+            -o -z "$MINION_ID" \
287
+            -o -z "$MINION_ID_HASH" \
288
+        ]; then
289
+            echo "ERROR: Unable to look-up config values for $CONFIG_DIR"
290
+            RETVAL=1
291
+            continue
292
+        fi
293
+
294
+        # See how we were called.
295
+        case "$1" in
296
+            (start|stop|restart|status)
297
+                "$1" || RETVAL=$?
298
+                ;;
299
+            (condrestart|try-restart)
300
+                if ! _is_running; then
301
+                    RETVAL=7
302
+                else
303
+                    stop
304
+                    start || RETVAL=$?
305
+                fi
306
+                ;;
307
+            (*)
308
+                echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload}"
309
+                RETVAL=2
310
+                ;;
311
+        esac
312
+    done <<EOF
313
+$SALTMINION_CONFIGS
314
+EOF
315
+
316
+    exit $RETVAL
317
+}
318
+
319
+
320
+if [ "$#" = 0 ]; then
321
+    main
322
+else
323
+    main "$@"
324
+fi
0 325
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+[Unit]
1
+Description=The Salt Minion
2
+Documentation=man:salt-minion(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltstack.com/en/latest/contents.html
3
+After=network.target salt-master.service
4
+
5
+[Service]
6
+KillMode=process
7
+Type=notify
8
+NotifyAccess=all
9
+LimitNOFILE=8192
10
+ExecStart=/usr/bin/salt-minion
11
+
12
+[Install]
13
+WantedBy=multi-user.target
0 14
new file mode 100644
... ...
@@ -0,0 +1,136 @@
0
+#!/bin/sh
1
+#
2
+# Salt syndic
3
+###################################
4
+
5
+# LSB header
6
+
7
+### BEGIN INIT INFO
8
+# Provides:          salt-syndic
9
+# Required-Start:    $all
10
+# Required-Stop:
11
+# Default-Start:     2 3 4 5
12
+# Default-Stop:      0 1 6
13
+# Short-Description: Salt syndic master-minion passthrough daemon
14
+# Description:       This is a the Salt syndic daemon that enables Salt master-minion
15
+#                    remote control passthrough.
16
+### END INIT INFO
17
+
18
+
19
+# chkconfig header
20
+
21
+# chkconfig: - 99 99
22
+# description:  This is a the Salt syndic daemon that enables Salt master-minion remote control passthrough.
23
+#
24
+# processname: /usr/bin/salt-syndic
25
+
26
+
27
+DEBIAN_VERSION=/etc/debian_version
28
+SUSE_RELEASE=/etc/SuSE-release
29
+# Source function library.
30
+if [ -f $DEBIAN_VERSION ]; then
31
+   break
32
+elif [ -f $SUSE_RELEASE -a -r /etc/rc.status ]; then
33
+    . /etc/rc.status
34
+else
35
+    . /etc/rc.d/init.d/functions
36
+fi
37
+
38
+# Default values (can be overridden below)
39
+SALTSYNDIC=/usr/bin/salt-syndic
40
+PYTHON=/usr/bin/python
41
+SYNDIC_ARGS=""
42
+
43
+if [ -f /etc/default/salt ]; then
44
+    . /etc/default/salt
45
+fi
46
+
47
+SERVICE=salt-syndic
48
+PROCESS=salt-syndic
49
+
50
+RETVAL=0
51
+
52
+start() {
53
+    echo -n $"Starting salt-syndic daemon: "
54
+    if [ -f $SUSE_RELEASE ]; then
55
+        startproc -f -p /var/run/$SERVICE.pid $SALTSYNDIC -d $SYNDIC_ARGS
56
+        rc_status -v
57
+    elif [ -e $DEBIAN_VERSION ]; then
58
+        if [ -f $LOCKFILE ]; then
59
+            echo -n "already started, lock file found"
60
+            RETVAL=1
61
+        elif $PYTHON $SALTSYNDIC -d $SYNDIC_ARGS >& /dev/null; then
62
+            echo -n "OK"
63
+            RETVAL=0
64
+        fi
65
+    else
66
+        daemon --check $SERVICE $SALTSYNDIC -d $SYNDIC_ARGS
67
+        RETVAL=$?
68
+        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE
69
+        echo
70
+        return $RETVAL
71
+    fi
72
+    RETVAL=$?
73
+    echo
74
+    return $RETVAL
75
+}
76
+
77
+stop() {
78
+    echo -n $"Stopping salt-syndic daemon: "
79
+    if [ -f $SUSE_RELEASE ]; then
80
+        killproc -TERM $SALTSYNDIC
81
+        rc_status -v
82
+    elif [ -f $DEBIAN_VERSION ]; then
83
+        # Added this since Debian's start-stop-daemon doesn't support spawned processes
84
+        if ps -ef | grep "$PYTHON $SALTSYNDIC" | grep -v grep | awk '{print $2}' | xargs kill &> /dev/null; then
85
+            echo -n "OK"
86
+            RETVAL=0
87
+        else
88
+            echo -n "Daemon is not started"
89
+            RETVAL=1
90
+        fi
91
+    else
92
+        killproc $PROCESS
93
+        RETVAL=$?
94
+        echo
95
+        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE
96
+        return $RETVAL
97
+    fi
98
+    RETVAL=$?
99
+    echo
100
+}
101
+
102
+restart() {
103
+   stop
104
+   start
105
+}
106
+
107
+# See how we were called.
108
+case "$1" in
109
+    start|stop|restart)
110
+        $1
111
+        ;;
112
+    status)
113
+        if [ -f $SUSE_RELEASE ]; then
114
+            echo -n "Checking for service salt-syndic "
115
+            checkproc $SALTSYNDIC
116
+            rc_status -v
117
+        elif [ -f $DEBIAN_VERSION ]; then
118
+            if [ -f $LOCKFILE ]; then
119
+                RETVAL=0
120
+                echo "salt-syndic is running."
121
+            else
122
+                RETVAL=1
123
+                echo "salt-syndic is stopped."
124
+            fi
125
+        else
126
+            status $PROCESS
127
+            RETVAL=$?
128
+        fi
129
+        ;;
130
+    *)
131
+        echo $"Usage: $0 {start|stop|status|restart}"
132
+        exit 1
133
+        ;;
134
+esac
135
+exit $RETVAL
0 136
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+[Unit]
1
+Description=The Salt Master Server
2
+Documentation=man:salt-syndic(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltstack.com/en/latest/contents.html
3
+After=network.target
4
+PartOf=salt-master.service
5
+
6
+[Service]
7
+Type=notify
8
+NotifyAccess=all
9
+LimitNOFILE=8192
10
+ExecStart=/usr/bin/salt-syndic
11
+
12
+[Install]
13
+WantedBy=multi-user.target
0 14
new file mode 100644
... ...
@@ -0,0 +1,308 @@
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: 2019.2.4
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: https://github.com/saltstack/salt/releases/download/v%{version}/salt/salt-%{version}.tar.gz
19
+%define sha1 salt=44c8337105733cfd3cc3bbef734e22330d2e053f
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 May 12 2020 Keerthana K <keerthanak@vmware.com> 2019.2.4-1
300
+- Update to version 2019.2.4 to fix CVE-2020-11651 CVE-2020-11652.
301
+* Fri Dec 13 2019 Vinothkumar D <vinothkumard@vmware.com> 2019.2.0-1
302
+- Upgrade to version 2019.2.0.
303
+* Mon Jan 21 2019 Vinothkumar D <vinothkumard@vmware.com> 2018.3.2-1
304
+- Downgrade to version 2018.3.2.
305
+* Tue Dec 04 2018 Vinothkumar D <vinothkumard@vmware.com> 2018.3.3-1
306
+- This is an initial version of salt with python3 support for Photon OS
307
+  The source is from https://github.com/saltstack/salt/archive/v2018.3.3.tar.gz
0 308
new file mode 100644
... ...
@@ -0,0 +1,66 @@
0
+%{!?python2_sitelib: %define python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
1
+%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
+
3
+Name:           tornado
4
+Version:        4.5.2
5
+Release:        2%{?dist}
6
+Summary:        Tornado is a Python web framework and asynchronous networking library
7
+License:        PSFL
8
+Group:          Development/Languages/Python
9
+Url:            https://pypi.python.org/pypi/tornado
10
+Source0:        https://pypi.python.org/packages/fa/14/52e2072197dd0e63589e875ebf5984c91a027121262aa08f71a49b958359/tornado-4.5.2.tar.gz
11
+%define sha1 tornado=27a7690aae925c6ec6450830befccc11fe3dfecf
12
+
13
+Vendor:         VMware, Inc.
14
+Distribution:   Photon
15
+
16
+BuildRequires:  python2
17
+BuildRequires:  python2-libs
18
+BuildRequires:  python-setuptools
19
+Requires:       python2
20
+Requires:       python2-libs
21
+
22
+%description
23
+
24
+%package -n     python3-tornado
25
+Summary:        python3 version 
26
+BuildRequires:  python3
27
+BuildRequires:  python3-devel
28
+BuildRequires:  python3-libs
29
+Requires:       python3
30
+Requires:       python3-libs
31
+
32
+%description -n python3-tornado
33
+Python 3 version.
34
+
35
+%prep
36
+%setup -n tornado-%{version}
37
+rm -rf ../p3dir
38
+cp -a . ../p3dir
39
+
40
+%build
41
+python2 setup.py build
42
+pushd ../p3dir
43
+python3 setup.py build
44
+popd
45
+
46
+%install
47
+python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
48
+pushd ../p3dir
49
+python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
50
+popd
51
+
52
+%files
53
+%defattr(-,root,root,-)
54
+%{python2_sitelib}/*
55
+
56
+%files -n python3-tornado
57
+%defattr(-,root,root)
58
+%{python3_sitelib}/*
59
+
60
+%changelog
61
+*   Tue Dec 17 2019 Padmini Thirumalachar <pthirumalachar@vmware.com> 4.5.2-2
62
+-   To build python2 and python3 tornado packages
63
+-   To remove buildArch
64
+*   Mon Dec 11 2017 Padmini Thirumalachar <pthirumalachar@vmware.com> 4.5.2-1
65
+-   Initial version of python tornado for PhotonOS.