1 | # -*- coding: utf-8 -*-
|
---|
2 | # $Id: wuiadminsystemlog.py 76553 2019-01-01 01:45:53Z vboxsync $
|
---|
3 |
|
---|
4 | """
|
---|
5 | Test Manager WUI - Admin - System Log.
|
---|
6 | """
|
---|
7 |
|
---|
8 | __copyright__ = \
|
---|
9 | """
|
---|
10 | Copyright (C) 2012-2019 Oracle Corporation
|
---|
11 |
|
---|
12 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
13 | available from http://www.virtualbox.org. This file is free software;
|
---|
14 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
15 | General Public License (GPL) as published by the Free Software
|
---|
16 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
17 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
18 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
19 |
|
---|
20 | The contents of this file may alternatively be used under the terms
|
---|
21 | of the Common Development and Distribution License Version 1.0
|
---|
22 | (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
23 | VirtualBox OSE distribution, in which case the provisions of the
|
---|
24 | CDDL are applicable instead of those of the GPL.
|
---|
25 |
|
---|
26 | You may elect to license modified versions of this file under the
|
---|
27 | terms and conditions of either the GPL or the CDDL or both.
|
---|
28 | """
|
---|
29 | __version__ = "$Revision: 76553 $"
|
---|
30 |
|
---|
31 |
|
---|
32 | # Validation Kit imports.
|
---|
33 | from testmanager.webui.wuicontentbase import WuiListContentBase, WuiTmLink;
|
---|
34 | from testmanager.core.testbox import TestBoxData;
|
---|
35 | from testmanager.core.systemlog import SystemLogData;
|
---|
36 | from testmanager.core.useraccount import UserAccountData;
|
---|
37 |
|
---|
38 |
|
---|
39 | class WuiAdminSystemLogList(WuiListContentBase):
|
---|
40 | """
|
---|
41 | WUI System Log Content Generator.
|
---|
42 | """
|
---|
43 |
|
---|
44 | def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp, aiSelectedSortColumns = None):
|
---|
45 | WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, 'System Log',
|
---|
46 | fnDPrint = fnDPrint, oDisp = oDisp, aiSelectedSortColumns = aiSelectedSortColumns);
|
---|
47 | self._asColumnHeaders = ['Date', 'Event', 'Message', 'Action'];
|
---|
48 | self._asColumnAttribs = ['', '', '', 'align="center"'];
|
---|
49 |
|
---|
50 | def _formatListEntry(self, iEntry):
|
---|
51 | from testmanager.webui.wuiadmin import WuiAdmin;
|
---|
52 | oEntry = self._aoEntries[iEntry];
|
---|
53 |
|
---|
54 | oAction = None
|
---|
55 |
|
---|
56 | if self._oDisp is None or not self._oDisp.isReadOnlyUser():
|
---|
57 | if oEntry.sEvent == SystemLogData.ksEvent_TestBoxUnknown \
|
---|
58 | and oEntry.sLogText.find('addr=') >= 0 \
|
---|
59 | and oEntry.sLogText.find('uuid=') >= 0:
|
---|
60 | sUuid = (oEntry.sLogText[(oEntry.sLogText.find('uuid=') + 5):])[:36];
|
---|
61 | sAddr = (oEntry.sLogText[(oEntry.sLogText.find('addr=') + 5):]).split(' ')[0];
|
---|
62 | oAction = WuiTmLink('Add TestBox', WuiAdmin.ksScriptName,
|
---|
63 | { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestBoxAdd,
|
---|
64 | TestBoxData.ksParam_uuidSystem: sUuid,
|
---|
65 | TestBoxData.ksParam_ip: sAddr });
|
---|
66 |
|
---|
67 | elif oEntry.sEvent == SystemLogData.ksEvent_UserAccountUnknown:
|
---|
68 | sUserName = oEntry.sLogText[oEntry.sLogText.find('(') + 1:
|
---|
69 | oEntry.sLogText.find(')')]
|
---|
70 | oAction = WuiTmLink('Add User', WuiAdmin.ksScriptName,
|
---|
71 | { WuiAdmin.ksParamAction: WuiAdmin.ksActionUserAdd,
|
---|
72 | UserAccountData.ksParam_sLoginName: sUserName });
|
---|
73 |
|
---|
74 | return [oEntry.tsCreated, oEntry.sEvent, oEntry.sLogText, oAction];
|
---|
75 |
|
---|