From 8e38447e21d6e8ecf8e9607c0a7a9d8037b2c181 Mon Sep 17 00:00:00 2001 From: Patrick Shelby Date: Fri, 21 Feb 2020 14:43:45 -0500 Subject: [PATCH] #141 Upgrading cfn-model version to inherit Globals section parsing (#381) * Updating deprecated 'version' property to 'ruby-version' for setup-ruby action. * #141 Upgrading cfn-model version to inherit Globals section parsing and adding validation test. --- .rubocop.yml | 2 +- Gemfile.lock | 12 ++++++------ cfn-nag.gemspec | 2 +- .../cfn_nag_lambda_permission_spec.rb | 9 +++++++++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 52e6306b..aa54fd01 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,7 +7,7 @@ AllCops: Style/IfUnlessModifier: Enabled: false -Metrics/LineLength: +Layout/LineLength: Max: 120 Style/Documentation: diff --git a/Gemfile.lock b/Gemfile.lock index 8165fcaf..6b40778b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: cfn-nag (0.0.0) aws-sdk-s3 (~> 1.60.1) - cfn-model (= 0.4.14) + cfn-model (= 0.4.16) lightly (~> 0.3.2) logging (~> 2.2.2) netaddr (~> 2.0.4) @@ -14,22 +14,22 @@ GEM specs: ast (2.4.0) aws-eventstream (1.0.3) - aws-partitions (1.270.0) - aws-sdk-core (3.89.1) + aws-partitions (1.275.0) + aws-sdk-core (3.90.1) aws-eventstream (~> 1.0, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.28.0) + aws-sdk-kms (1.29.0) aws-sdk-core (~> 3, >= 3.71.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.60.1) + aws-sdk-s3 (1.60.2) aws-sdk-core (~> 3, >= 3.83.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) aws-sigv4 (1.1.0) aws-eventstream (~> 1.0, >= 1.0.2) - cfn-model (0.4.14) + cfn-model (0.4.16) kwalify (= 0.7.2) psych (~> 3) diff-lcs (1.3) diff --git a/cfn-nag.gemspec b/cfn-nag.gemspec index 28d487dc..09dee70d 100644 --- a/cfn-nag.gemspec +++ b/cfn-nag.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |s| # versus what we used to run tests in cfn-nag before publishing cfn-nag # they are coupled and we are doing a good bit of experimenting in cfn-model # i might consider collapsing them again.... - s.add_runtime_dependency('cfn-model', '0.4.14') + s.add_runtime_dependency('cfn-model', '0.4.16') s.add_runtime_dependency('logging', '~> 2.2.2') s.add_runtime_dependency('netaddr', '~> 2.0.4') s.add_runtime_dependency('optimist', '~> 3.0.0') diff --git a/spec/cfn_nag_integration/cfn_nag_lambda_permission_spec.rb b/spec/cfn_nag_integration/cfn_nag_lambda_permission_spec.rb index 1c2a0aa4..be9b453d 100644 --- a/spec/cfn_nag_integration/cfn_nag_lambda_permission_spec.rb +++ b/spec/cfn_nag_integration/cfn_nag_lambda_permission_spec.rb @@ -56,5 +56,14 @@ actual_aggregate_results = @cfn_nag.audit_aggregate_across_files input_path: test_template_path(template_name) expect(actual_aggregate_results[0][:file_results][:failure_count]).to eq 0 end + + it 'makes globals available as a top-level hash' do + template_name = 'yaml/sam/globals.yml' + cfn_model = CfnParser.new.parse read_test_template(template_name) + globals = cfn_model.globals + + expect(globals).to_not be_nil + expect(globals['Function'].timeout).to eq 30 + end end end