Skip to content

Instantly share code, notes, and snippets.

@raygunsix
Created October 5, 2012 16:53
Show Gist options
  • Save raygunsix/3840949 to your computer and use it in GitHub Desktop.
Save raygunsix/3840949 to your computer and use it in GitHub Desktop.
opscode patch for nginx override attribute issues
--- ../raygun-forked-ckbks/partnerpedia-nginx-160001d/templates/default/plugins/nginx.rb.erb 2012-09-28 13:21:00.000000000 -0400
+++ cookbooks/partnerpedia-nginx-160001d/templates/default/plugins/nginx.rb.erb 2012-10-05 00:03:50.000000000 -0400
@@ -46,12 +46,19 @@
status, stdout, stderr = run_command(:no_status_check => true, :command => "<%= @nginx_bin %> -V")
+newcommon = "^nginx: "
+oldconfigargsig = "^configure arguments:(.+)"
+oldversionsig = "^nginx version: nginx\/(.+)"
+
+newconfigargsig = newcommon + oldconfigargsig[1..-1]
+newversionsig = newcommon + oldversionsig[1..-1]
+
if status == 0
stderr.split("\n").each do |line|
case line
- when /^configure arguments:(.+)/
- # This could be better: I'm splitting on configure arguments which removes them and also
- # adds a blank string at index 0 of the array. This is why we drop index 0 and map to
+ when /#{oldconfigargsig}/, /#{newconfigargsig}/
+ # This could be better: I'm splitting on configure arguments which removes them and also
+ # adds a blank string at index 0 of the array. This is why we drop index 0 and map to
# add the '--' prefix back to the configure argument.
nginx[:configure_arguments] = $1.split(/\s--/).drop(1).map { |ca| "--#{ca}" }
@@ -59,7 +66,7 @@
nginx[:prefix] = prefix
nginx[:conf_path] = conf_path
- when /^nginx version: nginx\/(.+)/
+ when /#{oldversionsig}/, /#{newversionsig}/
nginx[:version] = $1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment