Ejemplo n.º 1
0
    def deleteStatusElement(self,
                            element,
                            tableType,
                            name=None,
                            statusType=None,
                            status=None,
                            elementType=None,
                            reason=None,
                            dateEffective=None,
                            lastCheckTime=None,
                            tokenOwner=None,
                            tokenExpiration=None,
                            meta=None,
                            vo='all'):
        """
    Deletes from <element><tableType> all rows that match the parameters given.

    :Parameters:
      **element** - `string`
        it has to be a valid element ( ValidElement ), any of the defaults: `Site` \
        | `Resource` | `Node`
      **tableType** - `string`
        it has to be a valid tableType [ 'Status', 'Log', 'History' ]
      **name** - `[, string, list]`
        name of the individual of class element
      **statusType** - `[, string, list]`
        it has to be a valid status type for the element class
      **status** - `[, string, list]`
        it has to be a valid status, any of the defaults: `Active` | `Degraded` | \
        `Probing` | `Banned`
      **elementType** - `[, string, list]`
        column to distinguish between the different elements in the same element
        table.
      **reason** - `[, string, list]`
        decision that triggered the assigned status
      **dateEffective** - `[, datetime, list]`
        time-stamp from which the status & status type are effective
      **lastCheckTime** - `[, datetime, list]`
        time-stamp setting last time the status & status were checked
      **tokenOwner** - `[, string, list]`
        token assigned to the site & status type
      **tokenExpiration** - `[, datetime, list]`
        time-stamp setting validity of token ownership
      **meta** - `dict`
        metadata for the mysql query

    :return: S_OK() || S_ERROR()
    """
        columnNames = [
            "Name", "StatusType", "Status", "ElementType", "Reason",
            "DateEffective", "LastCheckTime", "TokenOwner", "TokenExpiration",
            "Meta", "VO"
        ]
        columnValues = [
            name, statusType, status, elementType, reason, dateEffective,
            lastCheckTime, tokenOwner, tokenExpiration, meta, vo
        ]

        return self._getRPC().delete(element + tableType,
                                     prepareDict(columnNames, columnValues))
Ejemplo n.º 2
0
    def addIfNotThereStatusElement(self,
                                   element,
                                   tableType,
                                   name=None,
                                   statusType=None,
                                   status=None,
                                   elementType=None,
                                   reason=None,
                                   dateEffective=None,
                                   lastCheckTime=None,
                                   tokenOwner=None,
                                   tokenExpiration=None,
                                   vo='all'):
        """
    Adds if-not-duplicated from <element><tableType> and also adds a log if flag
    is active.

    :Parameters:
      **element** - `string`
        it has to be a valid element ( ValidElement ), any of the defaults: `Site` \
        | `Resource` | `Node`
      **tableType** - `string`
        it has to be a valid tableType [ 'Status', 'Log', 'History' ]
      **name** - `string`
        name of the individual of class element
      **statusType** - `string`
        it has to be a valid status type for the element class
      **status** - `string`
        it has to be a valid status, any of the defaults: `Active` | `Degraded` | \
        `Probing` | `Banned`
      **elementType** - `string`
        column to distinguish between the different elements in the same element
        table.
      **reason** - `string`
        decision that triggered the assigned status
      **dateEffective** - `datetime`
        time-stamp from which the status & status type are effective
      **lastCheckTime** - `datetime`
        time-stamp setting last time the status & status were checked
      **tokenOwner** - `string`
        token assigned to the site & status type
      **tokenExpiration** - `datetime`
        time-stamp setting validity of token ownership

    :return: S_OK() || S_ERROR()
    """
        columnNames = [
            "Name", "StatusType", "Status", "ElementType", "Reason",
            "DateEffective", "LastCheckTime", "TokenOwner", "TokenExpiration",
            "VO"
        ]
        columnValues = [
            name, statusType, status, elementType, reason, dateEffective,
            lastCheckTime, tokenOwner, tokenExpiration, vo
        ]

        return self._getRPC().addIfNotThere(
            element + tableType, prepareDict(columnNames, columnValues))