Giter VIP home page Giter VIP logo

sortinghat-openinfra's Introduction

sortinghat-openinfra

SortingHat backend to import identities from OpenInfraID

Requirements

  • Python >= 3.8

You will also need some other libraries for running the tool, you can find the whole list of dependencies in pyproject.toml file.

Installation

There are several ways to install sortinghat-openinfra on your system: packages or source code using Poetry or pip.

PyPI

sortinghat-openinfra can be installed using pip, a tool for installing Python packages. To do it, run the next command:

$ pip install sortinghat-openinfra

Source code

To install from the source code you will need to clone the repository first:

$ git clone https://github.com/bitergia-analytics/sortinghat-openinfra
$ cd sortinghat-openinfra

Then use pip or Poetry to install the package along with its dependencies.

Pip

To install the package from local directory run the following command:

$ pip install .

In case you are a developer, you should install sortinghat-openinfra in editable mode:

$ pip install -e .

Usage

Install this SortingHat backend to import identities from OpenInfraID. You can use this importer using the API or the UI. The name of the backend is OpenInfraID. You need to provide the URL in the importer configuration, typically https://openstackid-resources.openstack.org.

By default, this backend only obtain members from the public API that doesn't contain email information. If you want to obtain members emails you need to define the following configuration variables in your settings file:

  • OPENINFRA_CLIENT_ID: OpenInfraID Oauth2 client ID for private API.
  • OPENINFRA_CLIENT_SECRET: OpenInfraID Oauth2 client secret for private API.

Poetry

We use poetry for dependency management and packaging. You can install it following its documentation. Once you have installed it, you can install sortinghat-openinfra and the dependencies in a project isolated environment using:

$ poetry install

To spaw a new shell within the virtual environment use:

$ poetry shell

License

Licensed under GNU General Public License (GPL), version 3 or later.

sortinghat-openinfra's People

Contributors

dependabot[bot] avatar evamillan avatar jjmerchante avatar sduenas avatar

Watchers

 avatar  avatar  avatar  avatar

sortinghat-openinfra's Issues

Openinfra backend must be a directory in backends

The openinfra backend is a module within the backends directory. However, this setup has an issue as it doesn't allow to have multiple files associated with the package, particularly the version.py file.

To address this issue, we can move the openinfra.py file to a separate directory and import the necessary classes in the __init__.py file. This would allow us to have a version.py file inside the openinfra package.

Error fetching items. Status code <400>

The OpenInfra importer fails after importing identities updated from 2020-10-16. It doesn't fail right away but before importing identities from 2020-10-17.

Traceback (most recent call last):
  File "/opt/venv/lib/python3.9/site-packages/rq/worker.py", line 1075, in perform_job
    rv = job.perform()
  File "/opt/venv/lib/python3.9/site-packages/rq/job.py", line 854, in perform
    self._result = self._execute()
  File "/opt/venv/lib/python3.9/site-packages/rq/job.py", line 877, in _execute
    result = self.func(*self.args, **self.kwargs)
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/decorators.py", line 114, in using_tenant
    return func(*args, **kwargs)
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/jobs.py", line 658, in import_identities
    nidentities = importer.import_identities()
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/importer/backend.py", line 82, in import_identities
    for individual in individuals:
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/importer/backends/openinfra.py", line 111, in individuals
    for member in self.fetch_members(from_date):
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/importer/backends/openinfra.py", line 184, in fetch_members
    for members in raw_members:
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/importer/backends/openinfra.py", line 204, in fetch_items
    raise LoadError(cause=f"Error fetching items. Status code <{r.status_code}>")
sortinghat.core.errors.LoadError: Error fetching items. Status code <400>
Traceback (most recent call last):
  File "/opt/venv/lib/python3.9/site-packages/rq/worker.py", line 1075, in perform_job
    rv = job.perform()
  File "/opt/venv/lib/python3.9/site-packages/rq/job.py", line 854, in perform
    self._result = self._execute()
  File "/opt/venv/lib/python3.9/site-packages/rq/job.py", line 877, in _execute
    result = self.func(*self.args, **self.kwargs)
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/decorators.py", line 114, in using_tenant
    return func(*args, **kwargs)
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/jobs.py", line 658, in import_identities
    nidentities = importer.import_identities()
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/importer/backend.py", line 82, in import_identities
    for individual in individuals:
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/importer/backends/openinfra.py", line 111, in individuals
    for member in self.fetch_members(from_date):
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/importer/backends/openinfra.py", line 184, in fetch_members
    for members in raw_members:
  File "/opt/venv/lib/python3.9/site-packages/sortinghat/core/importer/backends/openinfra.py", line 204, in fetch_items
    raise LoadError(cause=f"Error fetching items. Status code <{r.status_code}>")
sortinghat.core.errors.LoadError: Error fetching items. Status code <400>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.