Ejemplo n.º 1
0
  def doCache(self):

    if not self.args['site']:
      return S_ERROR('site was not found in args')

    site = self.args['site']

    elements = CSHelpers.getSiteElements(site)

    statusList = []

    if elements['OK']:
      for element in elements['Value']:
        status = self.rssClient.selectStatusElement("Resource", "Status", element, meta={'columns': ['Status']})
        if not status['OK']:
          return status

        if status['Value']:
          statusList.append(status['Value'][0][0])
        else:  # forcing in the case the resource has no status (yet)
          statusList.append('Active')

      if 'Active' in statusList:
        return S_OK({'Status': 'Active', 'Reason': 'An element that belongs to the site is Active'})

      if 'Degraded' in statusList:
        return S_OK({'Status': 'Degraded', 'Reason': 'An element that belongs to the site is Degraded'})

    return S_OK({'Status': 'Banned', 'Reason': 'There is no Active element in the site'})
Ejemplo n.º 2
0
    def doCache(self):

        if not self.args['site']:
            return S_ERROR('site was not found in args')

        site = self.args['site']

        elements = CSHelpers.getSiteElements(site)

        statusList = []

        if elements['OK']:
            for element in elements['Value']:
                status = self.rssClient.selectStatusElement(
                    "Resource",
                    "Status",
                    element,
                    meta={'columns': ['Status']})
                if not status['OK']:
                    return status

                if status['Value']:
                    statusList.append(status['Value'][0][0])
                else:  # forcing in the case the resource has no status (yet)
                    statusList.append('Active')

            if 'Active' in statusList:
                return S_OK({
                    'Status':
                    'Active',
                    'Reason':
                    'An element that belongs to the site is Active'
                })

            if 'Degraded' in statusList:
                return S_OK({
                    'Status':
                    'Degraded',
                    'Reason':
                    'An element that belongs to the site is Degraded'
                })

        return S_OK({
            'Status': 'Banned',
            'Reason': 'There is no Active element in the site'
        })
Ejemplo n.º 3
0
    def doCache(self):

        if not self.args["name"]:
            return S_ERROR("site was not found in args")

        site = self.args["name"]

        elements = CSHelpers.getSiteElements(site)

        statusList = []

        if elements["OK"]:
            for element in elements["Value"]:
                status = self.rssClient.selectStatusElement(
                    "Resource",
                    "Status",
                    element,
                    meta={"columns": ["Status"]})
                if not status["OK"]:
                    return status

                if status["Value"]:
                    statusList.append(status["Value"][0][0])
                else:  # forcing in the case the resource has no status (yet)
                    statusList.append("Active")

            if "Active" in statusList:
                return S_OK({
                    "Status":
                    "Active",
                    "Reason":
                    "An element that belongs to the site is Active"
                })

            if "Degraded" in statusList:
                return S_OK({
                    "Status":
                    "Degraded",
                    "Reason":
                    "An element that belongs to the site is Degraded"
                })

        return S_OK({
            "Status": "Banned",
            "Reason": "There is no Active element in the site"
        })