Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/adblockplus/templates/web/hooks_wrapper.sh.erb

Issue 29733731: #7320 - Introduce helpcenter role (Closed)
Patch Set: For comments 5 and 6 Created April 10, 2018, 2:45 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/adblockplus/templates/web/hooks_wrapper.sh.erb
===================================================================
new file mode 100644
--- /dev/null
+++ b/modules/adblockplus/templates/web/hooks_wrapper.sh.erb
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Puppet: <%= @title %>
+# This script is a wrapper of accesible hooks, defined via hiera and accessed
+# via ssh with the ForceCommand option.
+
+usage()
+{
+ echo "Avaiable commands are:"
+ echo "help"
+<% @hooks.keys.each do |key| -%>
+ echo "<%= key %>"
+<% end -%>
+}
+
+command="$1"; shift
+case "$command" in
+ "help")
+ usage
+ ;;
+<% @hooks.each do |command, values| -%>
mathias 2018/04/17 15:57:13 Why the double space here?
f.lopez 2018/04/17 18:02:22 Acknowledged.
+"<%= command %>")
+ <%= scope.function_join([[@wrapper_path, command], "/"]) %> "$@"
mathias 2018/04/17 15:57:14 Why not use Ruby's very own join method here? Also
f.lopez 2018/04/17 18:02:22 Acknowledged.
+ ;;
+<% end -%>
+ *)
+ echo "Unrecognized command"
+ usage
+ exit 1
+ ;;
+esac
+

Powered by Google App Engine
This is Rietveld