From 673a21d4945ba80c8cee50cfbce3b3a9d39be8bc Mon Sep 17 00:00:00 2001 From: Igor Rzegocki Date: Fri, 30 Sep 2016 12:36:52 +0200 Subject: [PATCH] fix(framework): Added missing `deploy_environment` to `null` framework Even if framework is set to null, at least `RACK_ENV` needs to be set. This gives application the hint, which environment is currently used - which the app can interpret or not. Signed-off-by: Igor Rzegocki --- libraries/drivers_framework_null.rb | 6 +++++- spec/unit/libraries/drivers_framework_null_spec.rb | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libraries/drivers_framework_null.rb b/libraries/drivers_framework_null.rb index 9e5db559..72571c46 100644 --- a/libraries/drivers_framework_null.rb +++ b/libraries/drivers_framework_null.rb @@ -4,7 +4,11 @@ module Framework class Null < Drivers::Framework::Base adapter :null allowed_engines :null - output filter: [] + output filter: [:deploy_environment] + + def raw_out + super.merge(deploy_environment: { 'RACK_ENV' => globals[:environment] }) + end end end end diff --git a/spec/unit/libraries/drivers_framework_null_spec.rb b/spec/unit/libraries/drivers_framework_null_spec.rb index 90fa1184..e9c15537 100644 --- a/spec/unit/libraries/drivers_framework_null_spec.rb +++ b/spec/unit/libraries/drivers_framework_null_spec.rb @@ -11,6 +11,7 @@ end it 'returns proper out data' do - expect(described_class.new(dummy_context(node), aws_opsworks_app).out).to eq({}) + expect(described_class.new(dummy_context(node), aws_opsworks_app).out) + .to eq(deploy_environment: { 'RACK_ENV' => 'staging' }) end end