Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-4012

FIWARE.Request.Lab.Spain.problem with script to identify invalid users

    Details

    • Type: extRequest
    • Status: Closed
    • Priority: Major
    • Resolution: Done
    • Fix Version/s: 2021
    • Component/s: FIWARE-LAB-HELP
    • Labels:
      None
    • HD-Node:
      Spain

      Description

      Hi,

      I tried to run the script to identify old, invalid users here:

      https://github.com/chemaper/delete_os_tenant_resources

      However, when I ran this, I encountered an error (see below).
      Fernando advised to send the error here.

      BR,
      Seán.


      sean@sean:~/xifi/delete_os_tenant_resources$ ./phase0_generateuserlist.py
      DEBUG:root:Getting expired users
      INFO:utils.log:Admin token requested: <REDACTED>
      INFO:utils.log:Number of Trial users detected: 1214
      INFO:utils.log:Number of expired users found: 1212
      DEBUG:keystoneclient.auth.identity.v3.base:Making authentication request to
      http://cloud.lab.fiware.org:4730/v3/auth/tokens
      DEBUG:root:Building user map
      DEBUG:iso8601.iso8601:Parsed 2015-09-03T13:36:30.070507Z into

      {'tz_sign': None, 'second_fraction': u'070507', 'hour': u'13', 'daydash': u'03', 'tz_hour': None, 'month': None, 'timezone': u'Z', 'second': u'30', 'tz_minute': None, 'year': u'2015', 'separator': u'T', 'monthdash': u'09', 'day': None, 'minute': u'36'}

      with default timezone <iso8601.iso8601.Utc
      object at 0x7fee2a910fd0>
      DEBUG:iso8601.iso8601:Got u'2015' for 'year' with default None
      DEBUG:iso8601.iso8601:Got u'09' for 'monthdash' with default 1
      DEBUG:iso8601.iso8601:Got 9 for 'month' with default 9
      DEBUG:iso8601.iso8601:Got u'03' for 'daydash' with default 1
      DEBUG:iso8601.iso8601:Got 3 for 'day' with default 3
      DEBUG:iso8601.iso8601:Got u'13' for 'hour' with default None
      DEBUG:iso8601.iso8601:Got u'36' for 'minute' with default None
      DEBUG:iso8601.iso8601:Got u'30' for 'second' with default None
      DEBUG:iso8601.iso8601:Parsed 2015-09-03T13:36:30.070507Z into

      {'tz_sign': None, 'second_fraction': u'070507', 'hour': u'13', 'daydash': u'03', 'tz_hour': None, 'month': None, 'timezone': u'Z', 'second': u'30', 'tz_minute': None, 'year': u'2015', 'separator': u'T', 'monthdash': u'09', 'day': None, 'minute': u'36'}

      with default timezone <iso8601.iso8601.Utc
      object at 0x7fee2a910fd0>
      DEBUG:iso8601.iso8601:Got u'2015' for 'year' with default None
      DEBUG:iso8601.iso8601:Got u'09' for 'monthdash' with default 1
      DEBUG:iso8601.iso8601:Got 9 for 'month' with default 9
      DEBUG:iso8601.iso8601:Got u'03' for 'daydash' with default 1
      DEBUG:iso8601.iso8601:Got 3 for 'day' with default 3
      DEBUG:iso8601.iso8601:Got u'13' for 'hour' with default None
      DEBUG:iso8601.iso8601:Got u'36' for 'minute' with default None
      DEBUG:iso8601.iso8601:Got u'30' for 'second' with default None
      DEBUG:keystoneclient.session:REQ: curl -g -i -X GET
      http://172.32.48.1:4731/v3/ -H "Accept: application/json" -H "User-Agent:
      python-keystoneclient"
      WARNING:keystoneclient.auth.identity.base:Failed to contact the endpoint at
      http://172.32.48.1:4731/v3/ for discovery. Fallback to using that endpoint
      as the base url.
      DEBUG:keystoneclient.session:REQ: curl -g -i -X GET
      http://172.32.48.1:4731/v3/users -H "User-Agent: python-keystoneclient" -H
      "Accept: application/json" -H "X-Auth-Token:

      {SHA1}

      <REDACTED>"
      Traceback (most recent call last):
      File "./phase0_generateuserlist.py", line 56, in <module>
      for user in keystone.users.list():
      File "/usr/local/lib/python2.7/dist-packages/keystoneclient/utils.py",
      line 336, in inner
      return func(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/keystoneclient/v3/users.py",
      line 108, in list
      **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/keystoneclient/base.py",
      line 73, in func
      return f(*args, **new_kwargs)
      File "/usr/local/lib/python2.7/dist-packages/keystoneclient/base.py",
      line 366, in list
      self.collection_key)
      File "/usr/local/lib/python2.7/dist-packages/keystoneclient/base.py",
      line 113, in _list
      resp, body = self.client.get(url, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/keystoneclient/adapter.py",
      line 170, in get
      return self.request(url, 'GET', **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/keystoneclient/adapter.py",
      line 206, in request
      resp = super(LegacyJsonAdapter, self).request(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/keystoneclient/adapter.py",
      line 95, in request
      return self.session.request(url, method, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/keystoneclient/utils.py",
      line 336, in inner
      return func(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/keystoneclient/session.py",
      line 382, in request
      resp = send(**kwargs)
      File "/usr/local/lib/python2.7/dist-packages/keystoneclient/session.py",
      line 426, in _send_request
      raise exceptions.ConnectionRefused(msg)
      keystoneclient.openstack.common.apiclient.exceptions.ConnectionRefused:
      Unable to establish connection tohttp://172.32.48.1:4731/v3/users
      sean@sean:~/xifi/delete_os_tenant_resources$

      _______________________________________________
      Fiware-lab-help mailing list
      Fiware-lab-help@lists.fi-ware.org
      https://lists.fi-ware.org/listinfo/fiware-lab-help

        Activity

        Hide
        jmperibanez Jose Maria Peribañez added a comment -

        Hello,

        First at all, please be careful with these scripts; the phase0 script is not dangerous, but some of the other scripts are. For example it is not a good idea to delete resources before notifying users, but the script that notifies users should be run only once, to avoid "spamming" the users.

        A message was already sent to delete resources next Monday, no resources should be deleted before this day, nor new messages that may confuse users be sent.

        Therefore, PLEASE DON'T RUN THE SCRIPTS THESE DAYS.

        About your question. Have you created a virtualenv and installed the requirements as the README indicates?

        Best regards,

        Chema.

        Show
        jmperibanez Jose Maria Peribañez added a comment - Hello, First at all, please be careful with these scripts; the phase0 script is not dangerous, but some of the other scripts are. For example it is not a good idea to delete resources before notifying users, but the script that notifies users should be run only once, to avoid "spamming" the users. A message was already sent to delete resources next Monday, no resources should be deleted before this day, nor new messages that may confuse users be sent. Therefore, PLEASE DON'T RUN THE SCRIPTS THESE DAYS. About your question. Have you created a virtualenv and installed the requirements as the README indicates? Best regards, Chema.
        Hide
        ZHAW Node Helpdesk Zurich Node Helpdesk added a comment -

        Hi Jose,

        Yes, we've a vm with virtualenv and all requirements installed. We're trying to get the phase0 script running to have a list of trial and expired users, but we are getting the error described on the ticket above.

        Best,
        Bruno.

        Show
        ZHAW Node Helpdesk Zurich Node Helpdesk added a comment - Hi Jose, Yes, we've a vm with virtualenv and all requirements installed. We're trying to get the phase0 script running to have a list of trial and expired users, but we are getting the error described on the ticket above. Best, Bruno.
        Hide
        jmperibanez Jose Maria Peribañez added a comment -

        Hi Bruno,

        I think this error occurred with a previous version, perhaps your copy of the project is not updated (you must use the develop branch).

        Anyway, now there is a new version, in the new repository, with improve the code and fixes some other bugs. This is the new code: https://github.com/telefonicaid/fiware-skuld

        Be aware that we run all the process last week, and the previously expired users have now 'basic' type. Their resources in Spain2 node
        were deleted.

        As I said, only the phase0_generateuserlist.py is not dangerous. The other ones should not be invoked without asking first.

        I think that the best approach is running these scripts from a only location to all the regions, because users must be notified before deleting their resources but only once, and not one time per region.

        Best regards,

        Chema.

        Show
        jmperibanez Jose Maria Peribañez added a comment - Hi Bruno, I think this error occurred with a previous version, perhaps your copy of the project is not updated (you must use the develop branch). Anyway, now there is a new version, in the new repository, with improve the code and fixes some other bugs. This is the new code: https://github.com/telefonicaid/fiware-skuld Be aware that we run all the process last week, and the previously expired users have now 'basic' type. Their resources in Spain2 node were deleted. As I said, only the phase0_generateuserlist.py is not dangerous. The other ones should not be invoked without asking first. I think that the best approach is running these scripts from a only location to all the regions, because users must be notified before deleting their resources but only once, and not one time per region. Best regards, Chema.
        Hide
        jmperibanez Jose Maria Peribañez added a comment -

        I'll close the ticket. The problem with that script is solved.

        Anyway, these scripts are intended to be run in a central location, not in each region node, because the operations affect the users globally.

        Show
        jmperibanez Jose Maria Peribañez added a comment - I'll close the ticket. The problem with that script is solved. Anyway, these scripts are intended to be run in a central location, not in each region node, because the operations affect the users globally.

          People

          • Assignee:
            jmperibanez Jose Maria Peribañez
            Reporter:
            ZHAW Node Helpdesk Zurich Node Helpdesk
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: