diff --git a/app/controllers/api/v1/r10k/environment_controller.rb b/app/controllers/api/v1/r10k/environment_controller.rb index 5cc096b..ae06970 100644 --- a/app/controllers/api/v1/r10k/environment_controller.rb +++ b/app/controllers/api/v1/r10k/environment_controller.rb @@ -30,19 +30,6 @@ class EnvironmentController < ApplicationController private - def headers - headers = {} - request.env.each do |k, v| - headers[k.to_s] = v.to_s if k =~ %r{^([A-Z]|_)+$} - end - headers - end - - def req_body - request.body.rewind - request.body.read - end - def get_prefix(data) case APP_CONFIG.prefix when 'repo' diff --git a/app/controllers/api/v1/r10k/module_controller.rb b/app/controllers/api/v1/r10k/module_controller.rb index 71cfb2a..3cd309c 100644 --- a/app/controllers/api/v1/r10k/module_controller.rb +++ b/app/controllers/api/v1/r10k/module_controller.rb @@ -8,8 +8,7 @@ class ModuleController < ApplicationController # POST: /module post %r{\/(module|api\/v1\/r10k\/module)} do protected! if APP_CONFIG.protected - request.body.rewind - data = PuppetWebhook::Parsers.new(request).params + data = PuppetWebhook::Parsers.new(headers, req_body).params ModuleController.helpers R10kHelpers diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1f1afc9..6951c60 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -74,4 +74,17 @@ def slack_settings {} end end + + def headers + headers = {} + request.env.each do |k, v| + headers[k.to_s] = v.to_s if k =~ %r{^([A-Z]|_)+$} + end + headers + end + + def req_body + request.body.rewind + request.body.read + end end