Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 2.83 KB

File metadata and controls

64 lines (45 loc) · 2.83 KB

The keywords "MUST", "SHOULD", and "MAY" in this file are to be interpreted as described in RFC2119.

Project: Integration for bi-directional synchronization of data between OS2mo and LDAP / Active Directory.

Dataflow

The integration SHOULD be configured using environment variables (see mo_ldap_import_export/config.py for details). What to synchronize MAY be configured using Jinja templates (envvar: CONVERSION_MAPPING).

OS2mo -> LDAP

  1. A change MAY happen in OS2mo.
  2. OS2mo SHOULD emit an event on its event system.
  3. FastRAMQPI SHOULD pick up the event and send a HTTP request to the integration.
  4. The integration SHOULD receive the HTTP request and SHOULD call mo_to_ldap_handler or http_process_*.
  5. The handler SHOULD decide the desired state in LDAP (using configured Jinja templates).
  6. The handler SHOULD call ldapapi.ensure_ldap_object with the desired state.

LDAP -> OS2mo

  1. A change MAY happen in LDAP.
  2. The LDAPEventGenerator SHOULD detect the event and emit it on OS2mo's event system.
  3. FastRAMQPI SHOULD pick up the event and send a HTTP request to the integration.
  4. The integration SHOULD receive the HTTP request and SHOULD call http_process_uuid.
  5. The handler SHOULD decide the desired state in MO (using configured Jinja templates).
  6. The handler SHOULD call functions on MOAPI with the desired state.

Development

This project uses docker compose for the development environment. The development stack MAY be started using docker compose up --build --detach

Running tests

  • Tests MUST be run using: docker compose exec mo_ldap_import_export pytest ....
  • Tests MUST NOT be run outside the docker container.
  • Test-targeting MUST be used as the entire test-suite MUST NOT be run at once. Example: docker compose exec mo_ldap_import_export pytest tests/integration/test_employee.py

Writing Tests

  • Tests SHOULD be added for new functionality.
  • Integration-tests SHOULD be preferred over unit-tests.
  • Unit-tests SHOULD only be written for pure functions.
  • Mocks SHOULD be avoided.
  • Unit-tests MAY be eliminated in favor of integration-tests.

Code style

  • Pythonic list comprehensions and generators SHOULD be used instead of map / filter.
  • Use one, only or first from more_itertools instead of [0].

Commit instructions

  • pre-commit run --all-files SHOULD pass before committing.
  • Commits SHOULD adhere to the conventional commits style.
  • Commit title SHOULD include a ticket number: fix(ldap2mo): [#12345] ensure dry-run termination works.
  • Branch names SHOULD include a ticket number: fix_12345_ensure_dry_run_termination
  • Branches SHOULD be rebased instead of merged.

GraphQL Client

  • autogenerated_graphql_client MUST NOT be edited manually.
  • autogenerated_graphql_client MAY be updated using poetry run tools/regen_client.sh if queries/* has changed.