]> Frank Brehm's Git Trees - pixelpark/ldap-migration.git/commitdiff
Increasing default wait after writes in LDAP
authorFrank Brehm <frank@brehm-online.com>
Thu, 3 Mar 2022 15:58:21 +0000 (16:58 +0100)
committerFrank Brehm <frank@brehm-online.com>
Thu, 3 Mar 2022 15:58:21 +0000 (16:58 +0100)
after-migration.sh
lib/ldap_migration/__init__.py
lib/ldap_migration/config.py

index 8af17a690a0ff31979cfcec74ae34a51a97bb78d..bd854cb975adccc53c1c5f7e3080c589b343560f 100755 (executable)
@@ -62,6 +62,8 @@ DEFAULT_MAX_GID=1000
 
 AUTHOR_DN="uid=frank.brehm,ou=People,o=Pixelpark,o=isp"
 
+WAIT_AFTER_WRITE=0.2
+
 #-------------------------------------------------------------------
 detect_color() {
 
@@ -191,7 +193,7 @@ empty_line() {
 usage() {
 
     cat <<-EOF
-       Usage: ${BASENAME} [-E|--env ENVIRONMENT] [-s|--simulate] [-d|--debug] [[-v|--verbose] | [-q|--quiet]] [--nocolor]
+       Usage: ${BASENAME} [-E|--env ENVIRONMENT] [-W|--wait SECONDS] [-s|--simulate] [-d|--debug] [[-v|--verbose] | [-q|--quiet]] [--nocolor]
               ${BASENAME} [-h|--help]
               ${BASENAME} [-V|--version]
 
@@ -199,6 +201,8 @@ usage() {
                -E|--env|--environment ENVIRONMENT
                                The LDAP environment to use as the target of this script.
                                Must be one of '${CYAN}prd${NORMAL}', '${CYAN}test${NORMAL}' or '${CYAN}dev${NORMAL}'. Default: '${CYAN}prod${NORMAL}'."
+               -W|--wait SECONDS
+                               Waiting this amount of seconds to ensure replication. Default: ${CYAN}${WAIT_AFTER_WRITE}${NORMAL} seconds.
                -s|--simulate   Simulation mode, nothing is really done.
                -d|--debug      Debug output (bash -x).
                -v|--verbose    Set verbosity on.
@@ -215,8 +219,8 @@ usage() {
 get_options() {
 
     local tmp=
-    local short_options="E:sdvqhV"
-    local long_options="env:,environment:,simulate,debug,verbose,quiet,help,version"
+    local short_options="E:W:sdvqhV"
+    local long_options="env:,environment:,wait:,simulate,debug,verbose,quiet,help,version"
     local py_version=
     local py_found="n"
     local ret=
@@ -241,6 +245,11 @@ get_options() {
                 shift
                 shift
                 ;;
+            -W|--wait)
+                WAIT_AFTER_WRITE="$2"
+                shift
+                shift
+                ;;
             -s|--simulate)
                 SIMULATE="y"
                 shift
@@ -466,6 +475,7 @@ update_password() {
     if [[ "${SIMULATE}" != "y" ]] ; then
         eval $cmd
     fi
+    sleep "${WAIT_AFTER_WRITE}"
     debug "Done."
 
 
@@ -573,6 +583,7 @@ update_mailhost() {
     if [[ "${SIMULATE}" != "y" ]] ; then
         eval $cmd
     fi
+    sleep "${WAIT_AFTER_WRITE}"
     debug "Done."
 }
 
@@ -771,6 +782,7 @@ update_public_sshkeys() {
     if [[ "${SIMULATE}" != "y" ]] ; then
         eval $cmd
     fi
+    sleep "${WAIT_AFTER_WRITE}"
     debug "Done."
 }
 
@@ -826,6 +838,7 @@ add_additional_entry() {
     if [[ "${SIMULATE}" != "y" ]] ; then
         eval $cmd
     fi
+    sleep "${WAIT_AFTER_WRITE}"
     debug "Done."
 
 }
@@ -897,6 +910,7 @@ apply_acl() {
     if [[ "${SIMULATE}" != "y" ]] ; then
         eval $cmd
     fi
+    sleep "${WAIT_AFTER_WRITE}"
     debug "Done."
 }
 
@@ -1051,6 +1065,7 @@ add_uid_pool() {
     if [[ "${SIMULATE}" != "y" ]] ; then
         eval $cmd
     fi
+    sleep "${WAIT_AFTER_WRITE}"
     debug "Done."
 
 }
@@ -1124,6 +1139,7 @@ add_gid_pool() {
     if [[ "${SIMULATE}" != "y" ]] ; then
         eval $cmd
     fi
+    sleep "${WAIT_AFTER_WRITE}"
     debug "Done."
 
 }
index ce6a7a6711b618494c2101746a60725e343f7ea9..157fab06a7924fca7248116edc99ed37fbd75296 100644 (file)
@@ -49,7 +49,7 @@ from fb_tools.xlate import format_list
 
 from .config import LDAPMigrationConfiguration, DEFAULT_ENV
 
-__version__ = '0.13.0'
+__version__ = '0.13.1'
 
 LOG = logging.getLogger(__name__)
 CFG_BASENAME = 'ldap-migration.ini'
index d11b6547d694f08ca34834a786cc5bac772fb8da..cd5ba099f65761ac751eb1220f97a41477a5de3c 100644 (file)
@@ -23,7 +23,7 @@ from fb_tools.common import to_bool
 from fb_tools.config import ConfigError, BaseConfiguration
 from fb_tools.xlate import format_list
 
-__version__ = '0.3.1'
+__version__ = '0.3.2'
 
 LOG = logging.getLogger(__name__)
 DEFAULT_ENV = 'prd'
@@ -58,7 +58,7 @@ class LDAPMigrationConfiguration(BaseConfiguration):
     max_tcp_port = (2**16 - 1)
     default_xlations_definitions_base = 'xlations.yaml'
     max_timeout = 3600
-    default_wait_after_write = 0.1
+    default_wait_after_write = 0.2
 
     environments = ('dev', 'test', 'prd')