]> git.nbdom.net Git - nb.git/commitdiff
bin/nb-update
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 11 Mar 2019 04:01:06 +0000 (04:01 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 11 Mar 2019 04:01:06 +0000 (04:01 +0000)
bin/nb-update
etc/dbq/data.php

index 092671bd4e37b3711d9c86a61cacb87e9fb0446f..223ffe2f2feb27e79ebbbf4121de05d340e576e1 100755 (executable)
@@ -34,9 +34,9 @@ export GIT_SSH="$TMP"
 filter_name="$@"
 for repo in $(nb_repos); do
 
-       [ -d "$repo/.git" ] || continue
-       [ ! -w "$repo/.git" ] && echo ">No Permission $repo" && echo && continue
-       cd "$repo" || continue
+       [ -d "$dir/.git" ] || continue
+       [ ! -w "$dir/.git" ] && echo ">No Permission $dir" && echo && continue
+       cd "$dir" || continue
 
        # name from git not from path
        name=$(git_name) || continue
@@ -61,7 +61,7 @@ for repo in $(nb_repos); do
        #
        # Get user
        #
-       user=`ls -dl "$repo/.git" | awk '{print $3}'`
+       user=`ls -dl "$dir/.git" | awk '{print $3}'`
 
        cmd=""
 
@@ -75,9 +75,9 @@ for repo in $(nb_repos); do
        #
        # Pull
        #
-       echo ">Pull $name branch=$branch user=$user path=$repo"
+       echo ">Pull $name branch=$branch user=$user path=$dir"
 
-       cmd="${cmd}GIT_SSH=$GIT_SSH cd \"$repo\" && git pull"
+       cmd="${cmd}GIT_SSH=$GIT_SSH cd \"$dir\" && git pull"
        [ "$CLEANUP" = "1" ] && cmd="$cmd && git gc"
 
        if [ 1 = 1 ] && ! git_conn_check; then
@@ -114,22 +114,18 @@ for repo in $(nb_repos); do
 
        fi
 
-               #echo nb_api_post_host_info "${NAME}.$repo.name" "$name"
+               #echo nb_api_post_host_info "${NAME}.$dir.name" "$name"
        echo
        echo "  >Post repo infos"
        (
-               nb_api_post_host_info "${NAME}.$repo.name" "$name"
-               nb_api_post_host_info "${NAME}.$repo.path" "$repo"
-               nb_api_post_host_info "${NAME}.$repo.branch" "$branch"
-               nb_api_post_host_info "${NAME}.$repo.url" "$(git remote get-url origin)"
-               nb_api_post_host_info "${NAME}.$repo.exit_code" "$(git status --short &> /dev/null; echo $?)"
-# NB 19.02.19          nb_api_post_host_info "${NAME}.$repo" "name:$name branch:$branch"
-# NB 19.02.19          nb_api_post_host_info "${NAME}.$repo.git.status.exit_code" "$(git status --short &> /dev/null; echo $?)"
-               # NB 06.02.18   key="repo.$name.$branch"
-               # NB 06.02.18   nb_api_post_host_info "${key}.path"        "$repo"
-               # NB 06.02.18   nb_api_post_host_info "${key}.exit_code"   "$ex"
+               preff="git.$dir"
+               nb_api_post_host_info "$preff.name" "$name"
+               nb_api_post_host_info "$preff.path" "$dir"
+               nb_api_post_host_info "$preff.branch" "$branch"
+               nb_api_post_host_info "$preff.url" "$(git remote get-url origin)"
+               nb_api_post_host_info "$preff.exit_code" "$(git status --short &> /dev/null; echo $?)"
+       ) 2>/dev/null | sed -E -e 's/^/    POST /; s/'$'\t''/: /'
        echo
-       ) 2>/dev/null | sed -E -e 's/^(.)/    POST \1/; s/'$'\t''/: /'
 
 done
 
index 6c71e1844162698641f438c654036b1b694fdb02..8aec03d4380eda7d0df1dbb3c1deeea7f74836f9 100644 (file)
@@ -3,7 +3,9 @@
 $DBQ['data'] = [
        'tables' => [
                        'host_info_err' => [
-                                       'sql' => "SELECT * FROM host_info WHERE key LIKE '%exit_code' AND val<> '0'",
+                                       'sql' => "SELECT * FROM host_info WHERE 0=1"
+                                               ." OR key LIKE '%.exit_code' AND val<> '0'"
+                                       ,
                        ]
        ],
 ];