]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/chef/templates/default/post-receive.erb
chef: Remove ancient verisign 1024 root cert
[chef.git] / cookbooks / chef / templates / default / post-receive.erb
index 58646ff1ac962ac49229274407f507e2b7f911f3..28ef5b4345874929661a8c46ff85dbc9e64de4d8 100644 (file)
@@ -5,11 +5,13 @@
 umask 0002
 unset GIT_DIR
 
+knife="/opt/chef/embedded/bin/knife"
+
 while read oldrev newrev refname
 do
   if [[ "$refname" = "refs/heads/master" ]]
   then
-    cd /var/lib/chef
+    cd /var/lib/chef/<%= @repository %>
 
     rm -f cookbooks/*/metadata.json(N)
 
@@ -25,17 +27,17 @@ do
       if [[ $file == roles/*.rb ]]
       then
         case "$action" in
-          A|M) knife role from file "${file}";;
-          D) knife role delete -y "${file:t:r}";;
+          A|M) $knife role from file "${file}";;
+          D) $knife role delete -y "${file:t:r}";;
         esac
       elif [[ $file == data_bags/*/*.json ]]
       then
         case "$action" in
           A|M) 
-            knife data bag create "${file:h:t}"
-            knife data bag from file "${file:h:t}" "${file:t}";;
+            $knife data bag create "${file:h:t}"
+            $knife data bag from file "${file:h:t}" "${file:t}";;
           D)
-            knife data bag delete -y "${file:h:t}" "${file:t:r}";;
+            $knife data bag delete -y "${file:h:t}" "${file:t:r}";;
         esac
       elif [[ $file == cookbooks/* ]]
       then
@@ -52,14 +54,14 @@ do
 
     if [[ -n "$updated_cookbooks" ]]
     then
-      knife cookbook upload "${(ou)updated_cookbooks[@]}"
+      $knife cookbook upload "${(ou)updated_cookbooks[@]}"
     fi
 
     if [[ -n "$deleted_cookbooks" ]]
     then
       for cookbook in "${(ou)deleted_cookbooks[@]}"
       do
-        knife cookbook delete -y "$cookbook"
+        $knife cookbook delete -y "$cookbook"
       done
     fi
   fi