]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
Try to make use of the extralist in the components file for static-update-component too
authorPeter Palfrader <peter@palfrader.org>
Sun, 7 Apr 2013 19:01:38 +0000 (21:01 +0200)
committerPeter Palfrader <peter@palfrader.org>
Sun, 7 Apr 2013 19:01:38 +0000 (21:01 +0200)
modules/roles/templates/static-mirroring/static-update-component.erb
modules/sudo/files/sudoers

index ed214e58fda570587558a460cbeb6a8ec9e48308..23fb0d97347ba24c3d0a9f86aa9478b22402246f 100755 (executable)
@@ -22,7 +22,7 @@
 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 usage() {
-  echo >&2 "Usage: $0 [-f] <component>"
+  echo >&2 "Usage: $0 <component>"
   exit 1
 }
 
@@ -30,10 +30,6 @@ componentlist=/etc/static-components.conf
 
 if [ "$#" = 1 ]; then
   component="$1"
-elif [ "$#" = 2 ]; then
-  if [ "$1" = "-f" ]; then force=1
-  else usage; fi
-  component="$2"
 else
   usage
 fi
@@ -44,19 +40,33 @@ if [ "${component%/*}" != "$component" ] ; then
   exit 1
 fi
 
+thishost=$(hostname -f)
 srchost="$(awk -v component="$component" '$1 == component {print $2; exit}' "$componentlist")"
 srcdir="$(awk -v component="$component" '$1 == component {print $3; exit}' "$componentlist")"
+inextralist="$(
+               awk -v component="$component" -v host="$thishost" '
+                 $1 == component {
+                   split($4,extra,",")
+                   for (i in extra) {
+                     if (host == extra[i]) {
+                       printf "%s:%s\n", $2, $3
+                       exit
+                     }
+                   }
+                   exit
+                 }' "$componentlist"
+              )"
 if [ -z "$srchost" ] || [ -z "$srcdir" ]; then
   echo >&2 "$0: Invalid component: $component (not found in $componentlist)";
   exit 1
 fi
 
-if ! [ "$srchost" = "`hostname -f`" ] && ! [ "$force" = 1 ]; then
-  echo >&2 "Component $component is sourced from $srchost, not this host."
+if ! [ "$srchost" = "$thisthost" ] && [ -z "$inextralist" ]; then
+  echo >&2 "Component $component is sourced from $srchost, and this host is neither that nor in the extra allowed list."
   exit 1
 fi
 
-if ! [ -d "$srcdir" ] && ! [ "$force" = 1 ]; then
+if [ "$srchost" = "$thisthost" ] && ! [ -d "$srcdir" ]; then
   echo >&2 "Component source directory $srcdir does not exist or is not a directory, or is not accessible."
   exit 1
 fi
index ebeb1d25208b7748af807e9f2c01ce3ccd318740..e5c6c6c3dd735a686293e219ba52a520ccce06d3 100644 (file)
@@ -129,8 +129,7 @@ buildd              ALL=(ALL)               NOPASSWD: ALL
 
 %planet                senfl=(staticsync)      NOPASSWD: /usr/local/bin/static-update-component planet.debian.org
 %debbits       master=(staticsync)     NOPASSWD: /usr/local/bin/static-update-component bits.debian.org
-%backports     ries=(staticsync)       NOPASSWD: /usr/local/bin/static-update-component backports.debian.org
-%backports     franck=(staticsync)     NOPASSWD: /usr/local/bin/static-update-component -f backports.debian.org
+%backports     franck,ries=(staticsync)        NOPASSWD: /usr/local/bin/static-update-component backports.debian.org
 
 # The piuparts slave needs to handle chroots
 piupartss      piatti=(ALL)            NOPASSWD: ALL