diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-03-23 22:47:19 +0000 |
---|---|---|
committer | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-03-23 23:04:18 +0000 |
commit | 8f39784c847801c0b766a0c9289da0976ffd0604 (patch) | |
tree | f99c84bbf2a78aa3e9278f276a18336cad047520 | |
parent | 71561a27a0338cba7c54ea8ae9bf14b75006ddbd (diff) | |
download | vyos-1x-8f39784c847801c0b766a0c9289da0976ffd0604.tar.gz vyos-1x-8f39784c847801c0b766a0c9289da0976ffd0604.zip |
ifconfig: T2154: fixing failure to start-stop-daemon
-rw-r--r-- | python/vyos/ifconfig/ethernet.py | 2 | ||||
-rw-r--r-- | python/vyos/ifconfig/interface.py | 20 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-openvpn.py | 10 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-wireless.py | 10 | ||||
-rwxr-xr-x | src/conf_mode/vpn_sstp.py | 10 | ||||
-rwxr-xr-x | src/etc/init.d/isc-dhcpv4-server | 4 | ||||
-rwxr-xr-x | src/etc/init.d/isc-dhcpv6-relay | 4 | ||||
-rwxr-xr-x | src/etc/init.d/isc-dhcpv6-server | 4 | ||||
-rwxr-xr-x | src/op_mode/reset_openvpn.py | 10 |
9 files changed, 54 insertions, 20 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py index 8b6b6d9db..30e3a3bef 100644 --- a/python/vyos/ifconfig/ethernet.py +++ b/python/vyos/ifconfig/ethernet.py @@ -120,7 +120,7 @@ class EthernetIf(VLANIf): try: # An exception will be thrown if the settings are not changed return self._cmd(cmd) - except CalledProcessError: + except RuntimeError: pass def set_speed_duplex(self, speed, duplex): diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index 18256cf99..4f72271c9 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -680,8 +680,11 @@ class Interface(Control): with open(self._dhcp_cfg_file, 'w') as f: f.write(dhcp_text) - cmd = 'start-stop-daemon --start --quiet --pidfile ' + \ - self._dhcp_pid_file + cmd = 'start-stop-daemon' + cmd += ' --start ' + cmd += ' --quiet' + cmd += ' --oknodo' + cmd += ' --pidfile ' + self._dhcp_pid_file cmd += ' --exec /sbin/dhclient --' # now pass arguments to dhclient binary cmd += ' -4 -nw -cf {} -pf {} -lf {} {}'.format( @@ -765,8 +768,11 @@ class Interface(Control): .format(self.config['ifname']), 0) # assemble command-line to start DHCPv6 client (dhclient) - cmd = 'start-stop-daemon --start --quiet --pidfile ' + \ - self._dhcpv6_pid_file + cmd = 'start-stop-daemon' + cmd += ' --start ' + cmd += ' --quiet' + cmd += ' --oknodo' + cmd += ' --pidfile ' + self._dhcpv6_pid_file cmd += ' --exec /sbin/dhclient --' # now pass arguments to dhclient binary cmd += ' -6 -nw -cf {} -pf {} -lf {}'.format( @@ -802,7 +808,11 @@ class Interface(Control): return None # stop dhclient - cmd = 'start-stop-daemon --stop --quiet --pidfile {}'.format(self._dhcpv6_pid_file) + cmd = 'start-stop-daemon' + cmd += ' --stop' + cmd += ' --oknodo' + cmd += ' --quiet' + cmd += ' --pidfile ' + self._dhcpv6_pid_file self._cmd(cmd) # accept router announcements on this interface diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py index 463ae9fd7..3a3c69e37 100755 --- a/src/conf_mode/interfaces-openvpn.py +++ b/src/conf_mode/interfaces-openvpn.py @@ -958,7 +958,10 @@ def apply(openvpn): # service as the configuration is not re-read. Stop daemon only if it's # running - it could have died or killed by someone evil if pid_exists(pid): - cmd = 'start-stop-daemon --stop --quiet' + cmd = 'start-stop-daemon' + cmd += ' --stop ' + cmd += ' --quiet' + cmd += ' --oknodo' cmd += ' --pidfile ' + pidfile subprocess_cmd(cmd) @@ -990,7 +993,10 @@ def apply(openvpn): # No matching OpenVPN process running - maybe it got killed or none # existed - nevertheless, spawn new OpenVPN process - cmd = 'start-stop-daemon --start --quiet' + cmd = 'start-stop-daemon' + cmd += ' --start ' + cmd += ' --quiet' + cmd += ' --oknodo' cmd += ' --pidfile ' + pidfile cmd += ' --exec /usr/sbin/openvpn' # now pass arguments to openvpn binary diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py index 54299b609..43455196c 100755 --- a/src/conf_mode/interfaces-wireless.py +++ b/src/conf_mode/interfaces-wireless.py @@ -1353,7 +1353,10 @@ def generate(wifi): pid = int(f.read()) if pid_exists(pid): - cmd = 'start-stop-daemon --stop --quiet' + cmd = 'start-stop-daemon' + cmd += ' --stop ' + cmd += ' --quiet' + cmd += ' --oknodo' cmd += ' --pidfile ' + pidfile subprocess_cmd(cmd) @@ -1365,7 +1368,10 @@ def generate(wifi): pid = int(f.read()) if pid_exists(pid): - cmd = 'start-stop-daemon --stop --quiet' + cmd = 'start-stop-daemon' + cmd += ' --stop ' + cmd += ' --quiet' + cmd += ' --oknodo' cmd += ' --pidfile ' + pidfile subprocess_cmd(cmd) diff --git a/src/conf_mode/vpn_sstp.py b/src/conf_mode/vpn_sstp.py index 8583ece74..8e5c7587c 100755 --- a/src/conf_mode/vpn_sstp.py +++ b/src/conf_mode/vpn_sstp.py @@ -497,7 +497,10 @@ def apply(sstp): if sstp is None: if pid_exists(pid): - cmd = 'start-stop-daemon --stop --quiet' + cmd = 'start-stop-daemon' + cmd += ' --stop ' + cmd += ' --quiet' + cmd += ' --oknodo' cmd += ' --pidfile ' + pidfile subprocess_cmd(cmd) @@ -510,7 +513,10 @@ def apply(sstp): if os.path.exists(pidfile): os.remove(pidfile) - cmd = 'start-stop-daemon --start --quiet' + cmd = 'start-stop-daemon' + cmd += ' --start ' + cmd += ' --quiet' + cmd += ' --oknodo' cmd += ' --pidfile ' + pidfile cmd += ' --exec /usr/sbin/accel-pppd' # now pass arguments to accel-pppd binary diff --git a/src/etc/init.d/isc-dhcpv4-server b/src/etc/init.d/isc-dhcpv4-server index 377634a13..94a1020ac 100755 --- a/src/etc/init.d/isc-dhcpv4-server +++ b/src/etc/init.d/isc-dhcpv4-server @@ -72,7 +72,7 @@ case "$1" in start) test_config log_daemon_msg "Starting $DESC" "$NAME" - start-stop-daemon --start --quiet --pidfile "$DHCPD_PID" \ + start-stop-daemon --start --oknodo --quiet --pidfile "$DHCPD_PID" \ --exec /usr/sbin/dhcpd -- \ -q $OPTIONS -cf "$DHCPD_CONF" -pf "$DHCPD_PID" $INTERFACES sleep 2 @@ -87,7 +87,7 @@ case "$1" in ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" - start-stop-daemon --stop --quiet --pidfile "$DHCPD_PID" + start-stop-daemon --stop --oknodo --quiet --pidfile "$DHCPD_PID" log_end_msg $? rm -f "$DHCPD_PID" ;; diff --git a/src/etc/init.d/isc-dhcpv6-relay b/src/etc/init.d/isc-dhcpv6-relay index 5a8ce620c..e553eafd1 100755 --- a/src/etc/init.d/isc-dhcpv6-relay +++ b/src/etc/init.d/isc-dhcpv6-relay @@ -31,11 +31,11 @@ DHCRELAYPID=/var/run/dhcv6relay.pid case "$1" in start) - start-stop-daemon --start --quiet --pidfile $DHCRELAYPID \ + start-stop-daemon --start --oknodo --quiet --pidfile $DHCRELAYPID \ --exec /usr/sbin/dhcrelay -- -q $OPTIONS -pf $DHCRELAYPID ;; stop) - start-stop-daemon --stop --quiet --pidfile $DHCRELAYPID + start-stop-daemon --stop --oknodo --quiet --pidfile $DHCRELAYPID ;; restart | force-reload) $0 stop diff --git a/src/etc/init.d/isc-dhcpv6-server b/src/etc/init.d/isc-dhcpv6-server index 55f59b68e..f6b27cb4a 100755 --- a/src/etc/init.d/isc-dhcpv6-server +++ b/src/etc/init.d/isc-dhcpv6-server @@ -72,7 +72,7 @@ case "$1" in start) test_config log_daemon_msg "Starting $DESC" "$NAME" - start-stop-daemon --start --quiet --pidfile "$DHCPD_PID" \ + start-stop-daemon --start --oknodo --quiet --pidfile "$DHCPD_PID" \ --exec /usr/sbin/dhcpd -- \ -q $OPTIONS -cf "$DHCPD_CONF" -pf "$DHCPD_PID" $INTERFACES sleep 2 @@ -87,7 +87,7 @@ case "$1" in ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" - start-stop-daemon --stop --quiet --pidfile "$DHCPD_PID" + start-stop-daemon --stop --oknodo --quiet --pidfile "$DHCPD_PID" log_end_msg $? rm -f "$DHCPD_PID" ;; diff --git a/src/op_mode/reset_openvpn.py b/src/op_mode/reset_openvpn.py index 38eca53cc..176cd51cf 100755 --- a/src/op_mode/reset_openvpn.py +++ b/src/op_mode/reset_openvpn.py @@ -48,7 +48,10 @@ if __name__ == '__main__': pid = int(f.read()) if pid_exists(pid): - cmd = 'start-stop-daemon --stop --quiet' + cmd = 'start-stop-daemon' + cmd += ' --stop' + cmd += ' --oknodo' + cmd += ' --quiet' cmd += ' --pidfile ' + pidfile subprocess_cmd(cmd) @@ -59,7 +62,10 @@ if __name__ == '__main__': sleep(0.250) # 250ms # re-start OpenVPN process - cmd = 'start-stop-daemon --start --quiet' + cmd = 'start-stop-daemon' + cmd += ' --start' + cmd += ' --oknodo' + cmd += ' --quiet' cmd += ' --pidfile ' + get_pid_file(interface) cmd += ' --exec /usr/sbin/openvpn' # now pass arguments to openvpn binary |