diff options
author | ramon <ramongomez@us.es> | 2017-10-18 17:18:09 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2017-10-18 17:18:09 +0000 |
commit | ea40e6b08b2d26e5ed0fb916d07737840c3a6e57 (patch) | |
tree | 0dedd5ef4c2a3955bcbe3d70aa939eda60e12a6c /admin | |
parent | dd14ed20d9ab68c3e8f57dd3d940ac1d2096016b (diff) |
#718: Corregir errata en servicio de usuario de OGAgent; usar flag {{{EWX_SHUTDOWN}}} en vez de {{{EWX_POWEROFF}}} al apagar Windows para compatibilidad con Wake-on-Lan.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5470 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin')
-rw-r--r-- | admin/Sources/Clients/ogagent/src/OGAgentUser.py | 3 | ||||
-rw-r--r-- | admin/Sources/Clients/ogagent/src/opengnsys/windows/operations.py | 15 |
2 files changed, 9 insertions, 9 deletions
diff --git a/admin/Sources/Clients/ogagent/src/OGAgentUser.py b/admin/Sources/Clients/ogagent/src/OGAgentUser.py index 363486b3..4ec09cee 100644 --- a/admin/Sources/Clients/ogagent/src/OGAgentUser.py +++ b/admin/Sources/Clients/ogagent/src/OGAgentUser.py @@ -294,7 +294,8 @@ class OGASystemTray(QtGui.QSystemTrayIcon): self.ipc.stop() except Exception: # May we have lost connection with server, simply log and exit in that case - logger.exception("Got an exception processing quit") + logger.exception() + logger.exception("Got an exception, processing quit") try: # operations.logoff() # Uncomment this after testing to logoff user diff --git a/admin/Sources/Clients/ogagent/src/opengnsys/windows/operations.py b/admin/Sources/Clients/ogagent/src/opengnsys/windows/operations.py index 9a3348fc..4ff88c36 100644 --- a/admin/Sources/Clients/ogagent/src/opengnsys/windows/operations.py +++ b/admin/Sources/Clients/ogagent/src/opengnsys/windows/operations.py @@ -31,15 +31,15 @@ ''' from __future__ import unicode_literals +import os +import subprocess +import ctypes +from ctypes.wintypes import DWORD, LPCWSTR import win32com.client # @UnresolvedImport, pylint: disable=import-error import win32net # @UnresolvedImport, pylint: disable=import-error import win32security # @UnresolvedImport, pylint: disable=import-error import win32api # @UnresolvedImport, pylint: disable=import-error import win32con # @UnresolvedImport, pylint: disable=import-error -import ctypes -from ctypes.wintypes import DWORD, LPCWSTR -import os -import subprocess from opengnsys import utils from opengnsys.log import logger @@ -61,7 +61,7 @@ def getNetworkInfo(): name: Name of the interface mac: mac of the interface ip: ip of the interface - ''' + ''' obj = win32com.client.Dispatch("WbemScripting.SWbemLocator") wmobj = obj.ConnectServer("localhost", "root\cimv2") adapters = wmobj.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IpEnabled=True") @@ -119,7 +119,7 @@ def poweroff(flags=0): ''' Simple poweroff command. ''' - reboot(flags=EWX_FORCEIFHUNG | EWX_POWEROFF) + reboot(flags=EWX_FORCEIFHUNG | EWX_SHUTDOWN) def logoff(): win32api.ExitWindowsEx(EWX_LOGOFF) @@ -187,7 +187,7 @@ def joinDomain(domain, ou, account, password, executeInOneStep=False): error = getErrorMessage(res) if res == 1355: error = "DC Is not reachable" - print res, error + print('{} {}'.format(res, error)) raise Exception('Error joining domain {}, with credentials {}/*****{}: {}, {}'.format(domain.value, account.value, ', under OU {}'.format(ou.value) if ou.value is not None else '', res, error)) @@ -239,4 +239,3 @@ def showPopup(title, message): ''' return subprocess.call('mshta "javascript:var sh=new ActiveXObject(\'WScript.Shell\'); sh.Popup( \'{}\', 60, \'{}\', 64); close()"'.format(message, title), shell=True) - |