VirtualBox

Changeset 61592 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 8, 2016 8:10:20 PM (9 years ago)
Author:
vboxsync
Message:

testmanager: attempt to fix broken testbox list actions. unfortuantely, the scheduling group migration had to go since it's now ambigious wrt multiple scheduling group participation of testboxes.

Location:
trunk/src/VBox/ValidationKit/testmanager
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/core/testbox.py

    r61510 r61592  
    826826        """
    827827        Data edit update, web UI is the primary user.
     828
     829        oData is either TestBoxDataEx or TestBoxData.
    828830        Returns the new generation ID and effective date.
    829831        """
     
    862864            tsEffective  = oOldData.tsEffective;
    863865
    864         # Calc in-group changes.
    865         aoRemoved = list(oOldData.aoInSchedGroups);
    866         aoNew     = [];
    867         aoUpdated = [];
    868         for oNewInGroup in oData.aoInSchedGroups:
    869             oOldInGroup = None;
    870             for iCur, oCur in enumerate(aoRemoved):
    871                 if oCur.idSchedGroup == oNewInGroup.idSchedGroup:
    872                     oOldInGroup = aoRemoved.pop(iCur);
    873                     break;
    874             if oOldInGroup is None:
    875                 aoNew.append(oNewInGroup);
    876             elif oNewInGroup.iSchedPriority != oOldInGroup.iSchedPriority:
    877                 aoUpdated.append(oNewInGroup);
    878 
    879         # Remove in-groups.
    880         for oInGroup in aoRemoved:
    881             self._oDb.callProc('TestBoxLogic_removeGroupEntry', (uidAuthor, oData.idTestBox, oInGroup.idSchedGroup, ));
    882 
    883         # Add new ones.
    884         for oInGroup in aoNew:
    885             self._oDb.callProc('TestBoxLogic_addGroupEntry',
    886                                ( uidAuthor, oData.idTestBox, oInGroup.idSchedGroup, oInGroup.iSchedPriority, ) );
    887 
    888         # Edit existing ones.
    889         for oInGroup in aoUpdated:
    890             self._oDb.callProc('TestBoxLogic_editGroupEntry',
    891                                ( uidAuthor, oData.idTestBox, oInGroup.idSchedGroup, oInGroup.iSchedPriority, ) );
     866        if isinstance(oData, TestBoxDataEx):
     867            # Calc in-group changes.
     868            aoRemoved = list(oOldData.aoInSchedGroups);
     869            aoNew     = [];
     870            aoUpdated = [];
     871            for oNewInGroup in oData.aoInSchedGroups:
     872                oOldInGroup = None;
     873                for iCur, oCur in enumerate(aoRemoved):
     874                    if oCur.idSchedGroup == oNewInGroup.idSchedGroup:
     875                        oOldInGroup = aoRemoved.pop(iCur);
     876                        break;
     877                if oOldInGroup is None:
     878                    aoNew.append(oNewInGroup);
     879                elif oNewInGroup.iSchedPriority != oOldInGroup.iSchedPriority:
     880                    aoUpdated.append(oNewInGroup);
     881
     882            # Remove in-groups.
     883            for oInGroup in aoRemoved:
     884                self._oDb.callProc('TestBoxLogic_removeGroupEntry', (uidAuthor, oData.idTestBox, oInGroup.idSchedGroup, ));
     885
     886            # Add new ones.
     887            for oInGroup in aoNew:
     888                self._oDb.callProc('TestBoxLogic_addGroupEntry',
     889                                   ( uidAuthor, oData.idTestBox, oInGroup.idSchedGroup, oInGroup.iSchedPriority, ) );
     890
     891            # Edit existing ones.
     892            for oInGroup in aoUpdated:
     893                self._oDb.callProc('TestBoxLogic_editGroupEntry',
     894                                   ( uidAuthor, oData.idTestBox, oInGroup.idSchedGroup, oInGroup.iSchedPriority, ) );
     895        else:
     896            assert isinstance(oData, TestBoxData);
    892897
    893898        self._oDb.maybeCommit(fCommit);
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmin.py

    r61502 r61592  
    506506                        oTestBox.fEnabled = fEnable;
    507507                        oLogic.editEntry(oTestBox, self._oCurUser.uid, fCommit = False);
    508             elif sListAction == 'setgroup':
    509                 for oTestBox in aoTestBoxes:
    510                     if oTestBox.idSchedGroup != idAction:
    511                         oTestBox.idSchedGroup = idAction;
    512                         oLogic.editEntry(oTestBox, self._oCurUser.uid, fCommit = False);
    513508            else:
    514509                for oTestBox in aoTestBoxes:
    515510                    if oTestBox.enmPendingCmd != sListAction:
    516                         oTestBox.enmPendingCmd = sListAction;
    517                         oLogic.editEntry(oTestBox, self._oCurUser.uid, fCommit = False);
     511                        oLogic.setCommand(idTestBox, oTestBox.enmPendingCmd, sListAction, self._oCurUser.uid, fCommit = False);
    518512            self._oDb.commit();
    519513
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmintestbox.py

    r61502 r61592  
    190190                                       'align="center"' ]);
    191191        self._aoActions     = list(self.kasTestBoxActionDescs);
    192         self._aoSchedGroups = SchedGroupLogic(self._oDisp.getDb()).fetchOrderedByName();
    193         self._dSchedGroups  = dict();
    194         for oSchedGroup in self._aoSchedGroups:
    195             self._aoActions.append([ 'setgroup-%u' % (oSchedGroup.idSchedGroup,),
    196                                      'Migrate to group %s (#%u)' % (oSchedGroup.sName, oSchedGroup.idSchedGroup,),
    197                                      oSchedGroup.sDescription ]);
    198             self._dSchedGroups[oSchedGroup.idSchedGroup] = oSchedGroup;
    199192        self._sAction       = oDisp.ksActionTestBoxListPost;
    200193        self._sCheckboxName = TestBoxData.ksParam_idTestBox;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette