Skip to content

Instantly share code, notes, and snippets.

View rhoerbe's full-sized avatar

Rainer Hörbe rhoerbe

  • Identinetics
  • Tulln, Austria
View GitHub Profile
@rhoerbe
rhoerbe / gist:3ecb0dae5aadd5bce1691f5e9b44fed9
Created June 2, 2017 18:08
ldap tree diff (pseudo code)
# not correct:
read tree1 into list1
read tree2 into list2
for each entry1 in list1 {
compare entry1 with corresponding entry in list 2 // how to do this efficiently?
}
# better approach
"I think we need to create cron management command (say, once per hour) or sync in a background task while login as you suggested to import data from git to django db. Also, we need to check for git conflicts while MDstatement is saving (pre_save signal) (return an error to a user if local git repo is outdated)."
>>So we need effectively an idempotent sync, that will be triggered by cron, login, and after save conflicts. Correct?
"'that we will need an API to add/modify/delete a MDstatement.'
Also, we need API for checkout status in this way."
>>Please explain. I thought, that an API-transaction (add/replace/delete) will be stateless, not requiring a checkout, only throwing an error if a lock exists.
ChangeView signal / API checkout method (create a new CheckOut status)
Checking out git https://github.com/rhoerbe/d-openldap-django into /var/lib/jenkins/workspace/ldap/openldap-django@script to read Jenkinsfile
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/rhoerbe/d-openldap-django # timeout=10
Fetching upstream changes from https://github.com/rhoerbe/d-openldap-django
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress https://github.com/rhoerbe/d-openldap-django +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10