1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-03-13 08:58:35 +03:00

Merge remote-tracking branch 'origin/v3.6'

This commit is contained in:
Adolfo Gómez García 2022-11-10 14:05:41 +01:00
commit 57013ed1e1
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
3 changed files with 21 additions and 9 deletions

View File

@ -11,7 +11,7 @@ Release: %{release}
Summary: Actor for Universal Desktop Services (UDS) Broker
License: BSD3
Group: Admin
Requires: python3-six python3-requests python3-qt5 libXScrnSaver
Requires: python3-six python3-requests python3-qt5 libXScrnSaver xset
Vendor: Virtual Cable S.L.U.
URL: http://www.udsenterprise.com
Provides: udsactor

View File

@ -41,6 +41,8 @@ import typing
from .. import types
from udsactor.log import logger
from .renamer import rename
from . import xss
@ -165,14 +167,19 @@ def reboot(flags: int = 0):
'''
Simple reboot using os command
'''
subprocess.call(['/sbin/shutdown', 'now', '-r']) # nosec: Fine, all under control
try:
subprocess.call(['/sbin/shutdown', 'now', '-r']) # nosec: fixed params
except Exception as e:
logger.error('Error rebooting: %s', e)
def loggoff() -> None:
'''
Right now restarts the machine...
'''
subprocess.call(['/usr/bin/pkill', '-u', os.environ['USER']]) # nosec: Fine, all under control
try:
subprocess.call(['/usr/bin/pkill', '-u', os.environ['USER']]) # nosec: Fixed params
except Exception as e:
logger.error('Error killing user processes: %s', e)
# subprocess.call(['/sbin/shutdown', 'now', '-r'])
# subprocess.call(['/usr/bin/systemctl', 'reboot', '-i'])

View File

@ -33,6 +33,10 @@ import ctypes
import ctypes.util
import subprocess # nosec
from udsactor.log import logger
xlib = None
xss = None
display = None
@ -116,11 +120,12 @@ def _ensureInitialized():
def initIdleDuration(atLeastSeconds: int) -> None:
_ensureInitialized()
if atLeastSeconds:
subprocess.call( # nosec, controlled params
['/usr/bin/xset', 's', '{}'.format(atLeastSeconds + 30)]
)
# And now reset it
subprocess.call(['/usr/bin/xset', 's', 'reset']) # nosec: fixed command
try:
subprocess.call(['/usr/bin/xset', 's', '{}'.format(atLeastSeconds + 30)]) # nosec
# And now reset it
subprocess.call(['/usr/bin/xset', 's', 'reset']) # nosec
except Exception as e:
logger.error('Error setting screensaver time: %s', e)
def getIdleDuration() -> float: