From 96037171a778641f5a3e611855f2ccd53f0d92bc Mon Sep 17 00:00:00 2001 From: Jason Vanderhoof Date: Thu, 21 Sep 2023 09:28:21 -0600 Subject: [PATCH] Adds better logging to enable troubleshooting policy factory loading --- app/domain/factories/create_from_policy_factory.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/domain/factories/create_from_policy_factory.rb b/app/domain/factories/create_from_policy_factory.rb index 7203856771..4fad47dd47 100644 --- a/app/domain/factories/create_from_policy_factory.rb +++ b/app/domain/factories/create_from_policy_factory.rb @@ -16,6 +16,7 @@ def initialize(renderer: Factories::Renderer.new, http: RestClient, schema_valid @http = http @schema_validator = schema_validator @utilities = utilities + @logger = Rails.logger # JSON and URI are defined here for visibility. They are not currently # mocked in testing, thus, we're not setting them in the initializer. @@ -128,6 +129,8 @@ def render_and_apply_policy(policy_load_path:, policy_template:, variables:, acc template: policy_template, variables: variables ).bind do |rendered_policy| + @logger.debug("Policy Factory is applying the following policy to '/policies/#{account}/policy/#{policy_load_path}'") + @logger.debug("\n#{rendered_policy}") begin response = @http.post( "http://localhost:#{ENV['PORT']}/policies/#{account}/policy/#{policy_load_path}",