VirtualBox

Ignore:
Timestamp:
Jun 8, 2016 8:10:20 PM (8 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.

File:
1 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);
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