Intégration de la branche release-5.3.0

This commit is contained in:
Jephté Clain 2016-09-28 23:32:01 +04:00
commit 82b62f2326
7 changed files with 70 additions and 32 deletions

View File

@ -1,3 +1,9 @@
## Version 5.3.0 du 28/09/2016-23:31
5c466d8 ldif et ldap: match des suffixes sans tenir compte de la casse. modrdn prend un nouvel argument SUFFIX
9eb566a runsmod: modifier chemins par défaut
a082788 bash_completion: bug sur certains serveurs
## Version 5.2.1 du 01/09/2016-15:44
9995f95 runsmod: bug

View File

@ -1 +1 @@
5.2.1
5.3.0

View File

@ -1 +1 @@
013002000
013003000

View File

@ -32,4 +32,9 @@ function __bash_completion_module_enabled() {
if ! __bash_completion_enabled; then
__NUTOOLS_BASH_COMPLETION=1
fi
[ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=1
if [ -z "$BASH_COMPLETION" ]; then
BASH_COMPLETION=1
# activer les options nécessaires pour la complétion, parce que ce n'est
# peut-être pas encore fait.
shopt -s extglob progcomp
fi

View File

@ -129,7 +129,7 @@ function get_dcsuffix() {
# base de donnée non administrative.
# retourner 1 si la valeur n'a pas pu être obtenue
local suffix
suffix="$(get_suffixes "$1" | awk '/(^|,)dc=[^,]+/ { print }')" || return 1
suffix="$(get_suffixes "$1" | awk '/(^|,)[dD][cC]=[^,]+/ { print }')" || return 1
<<<"$suffix" head -n1
}
@ -140,22 +140,23 @@ function get_suffix() {
# retourner 1 si la valeur n'a pas pu être obtenue
local suffixes suffix
suffixes="$(get_suffixes "$1")" || return 1
suffix="$(<<<"$suffixes" awk '/(^|,)dc=[^,]+/ { print }')"
suffix="$(<<<"$suffixes" awk '/(^|,)[dD][cC]=[^,]+/ { print }')"
[ -n "$suffix" ] || suffix="$suffixes"
<<<"$suffix" head -n1
}
function reldn() {
local suffix="${2:-$SUFFIX}"
local dn="$(strlower "$1")"
local suffix="$(strlower "${2:-$SUFFIX}")"
# exprimer le dn $1 relativement au suffixe $2(=$SUFFIX)
if [ -z "$suffix" ]; then
echo "$1"
elif [ -z "$1" -o "$1" == "$suffix" ]; then
elif [ -z "$dn" -o "$dn" == "$suffix" ]; then
echo ""
elif [ "${1%,$suffix}" != "$1" ]; then
elif [ "${dn%,$suffix}" != "$dn" ]; then
# absolu, enlever $suffix
echo "${1%,$suffix}"
echo "${1:$((${#dn} - ${#suffix}))}"
else
# relatif
echo "$1"
@ -163,19 +164,20 @@ function reldn() {
}
function _absdn() {
local suffix="$2"
local dn="$(strlower "$1")"
local suffix="$(strlower "$2")"
# obtenir le dn absolu correspondant au dn $1, le dn de base étant $2
if [ -z "$suffix" ]; then
echo "$1"
elif [ -z "$1" -o "$1" == "$suffix" ]; then
echo "$suffix"
elif [ "${1%,$suffix}" != "$1" ]; then
elif [ -z "$dn" -o "$dn" == "$suffix" ]; then
echo "$2"
elif [ "${dn%,$suffix}" != "$dn" ]; then
# absolu
echo "$1"
else
# relatif, ajouter $suffix
echo "$1,$suffix"
echo "$1,$2"
fi
}
@ -187,7 +189,9 @@ function absdn() {
function subof() {
# tester si le dn absolu $1 est $2 ou un enfant de $2
[ "$1" == "$2" -o "${1%,$2}" != "$1" ]
local dn="$(strlower "$1")"
local par="$(strlower "$2")"
[ "$dn" == "$par" -o "${dn%,$par}" != "$dn" ]
}
function rabsdn() {
@ -207,7 +211,7 @@ function rabsdn() {
if [ "${dn#/}" != "$dn" ]; then
echo "${dn#/}"
elif [ "$dn" == "~" ]; then
echo "$SUFFIX"
echo "$suffix"
elif [ "${dn#\~/}" != "$dn" ]; then
_absdn "${dn#\~/}" "$suffix"
else

View File

@ -274,16 +274,27 @@ function tl_deleteentry() {
function tl_modrdn() {
local newrdn newsup keep
local suffix="$(strlower "$3")"
local dn="$(strlower "$1")"
if [ "${1%,}" != "$1" ]; then
# ignorer le suffixe éventuellement fourni
set -- "${1%,}" "$2"
elif [ -n "$suffix" -a "${dn%,$suffix}" == "$dn" ]; then
# rajouter le suffixe
set -- "$1,$3" "$2"
fi
splitfsep "$1" , newrdn newsup
case "$2" in
k|keep|keepold|keepoldrdn) keep=1;;
esac
case "$2" in k|keep|keepold|keepoldrdn) keep=1;; esac
awkrun newrdn:str="$newrdn" newsup:str="$newsup" keep:int="$keep" '
/^dn:/ {
dn = $0
print dn
actual_newrdn = newrdn
if (actual_newrdn == "") {
actual_newrdn = $2
gsub(/,.*$/, "", actual_newrdn)
}
print
print "changetype: modrdn"
print "newrdn: " newrdn
print "newrdn: " actual_newrdn
if (keep) print "deleteoldrdn: 0"
else print "deleteoldrdn: 1"
if (newsup != "") print "newsuperior: " newsup
@ -1274,9 +1285,18 @@ D, moddelattr
Supprimer l'attribut
delentry
Supprimer l'objet
rename, modrdn NEWRDN[,NEWSUPERIOR] [keep[oldrdn]]
rename, modrdn NEWRDN[,NEWSUPERIOR] [keep[oldrdn]] [SUFFIX]
Déplacer/renommer l'objet. L'ancienne valeur est supprimée, à moins que
l'argument keep ne soit spécifié.
Si NEWRDN est vide, alors ',NEWSUPERIOR' doit être spécifié (remarquez la
virgule avant le nouveau supérieur), et cela signifie que l'objet a le même
RDN dans la nouvelle branche.
SUFFIX est le suffixe de la base de donnée. Le DN 'NEWRDN,NEWSUPERIOR' est
exprimé relativement à SUFFIX, sauf s'il se termine par une virgule. Par
exemple, étant donné SUFFIX='dc=domain,dc=tld', les expressions suivantes
sont équivalentes:
modrdn uid=new,ou=people <=> modrdn uid=new,ou=people,dc=domain,dc=tld
modrdn uid=new,cn=config, <=> modrdn uid=new,cn=config
touchentry
Forcer la réplication de l'objet en simulant une modification"
@ -1293,6 +1313,9 @@ function get_transform_cmd() {
# _T_cut_after:
# faut-il découper automatiquement les lignes *après* avoir lancé les
# commandes.
# _T_suffix:
# suffixe de la base de données pour les commandes qui prennent des RDN,
# e.g. modrdn
local -a cmds cmdparts
local cmd dest first=1 xempty xdel
local auto_uncut="$_T_uncut_before"
@ -1395,7 +1418,7 @@ function get_transform_cmd() {
d|md|moddel|moddelval) cmdparts=(tl_modifyattr delete);;
D|moddelattr) cmdparts=(tl_deleteattr);;
delentry|moddelentry) cmdparts=(tl_deleteentry);;
rename|modrdn|modrename|modmodrdn) cmdparts=(tl_modrdn "$@");;
rename|modrdn|modrename|modmodrdn) cmdparts=(tl_modrdn "$1" "$2" "${3:-$_T_suffix}");;
touch|touchentry|modtouchentry) cmdparts=(tl_touchentry);;
litteral) cmdparts=("$@");;
*)

View File

@ -28,13 +28,13 @@ RUNSMOD_MODULES_URLS=(
RUNSMOD_HOSTS_URLS=(
runsh
)
RUNSMOD_BASEDIR="$HOME/runs"
RUNSMOD_BASEDIR="$HOME/wop/runsmod"
RUNSMOD_MAP=(
# mapping par défaut
runss:"$HOME/wop/runs"
modules:"$HOME/wop/modules"
hosts:"$HOME/wop/hosts"
runsh:"$HOME/wop/hosts/all/hosts"
hosts:"$HOME/wop/hosts.d"
runsh:"$HOME/wop/hosts"
)
RUNSMOD_PROFILES=(
pvcs
@ -49,11 +49,11 @@ RUNSMOD_pvcs_SCRIPTS_URLS=("${RUNSMOD_SCRIPTS_URLS[@]}" si/base-runs)
RUNSMOD_pvcs_MODULES_URLS=("${RUNSMOD_MODULES_URLS[@]}")
RUNSMOD_pvcs_HOSTS_URLS=("${RUNSMOD_HOSTS_URLS[@]}")
RUNSMOD_pvcs_MAP=(
si/base-runs:"$HOME/wop/legacy-runs"
runss:"$HOME/wop/runs"
modules:"$HOME/wop/pmodules"
hosts:"$HOME/wop/hosts"
runsh:"$HOME/wop/hosts/all/hosts"
runsh:"$HOME/wop/hosts.d"
si/base-runs:"$HOME/wop/lruns"
)
# vcs
@ -65,8 +65,8 @@ RUNSMOD_vcs_HOSTS_URLS=("${RUNSMOD_HOSTS_URLS[@]}")
RUNSMOD_vcs_MAP=(
runss:"$HOME/wop/pruns"
modules:"$HOME/wop/modules"
hosts:"$HOME/wop/hosts"
runsh:"$HOME/wop/hosts/all/phosts"
hosts:"$HOME/wop/phosts"
runsh:"$HOME/wop/phosts.d"
)
# jclain
@ -78,5 +78,5 @@ RUNSMOD_jclain_MAP=(
runss:"$HOME/wop/j/runs"
modules:"$HOME/wop/j/modules"
hosts:"$HOME/wop/j/hosts"
runsh:"$HOME/wop/j/hosts/all/hosts"
runsh:"$HOME/wop/j/hosts.d"
)