From bf3a2a757b20f497918defd63029277fa9bb3ec5 Mon Sep 17 00:00:00 2001 From: Helena Greebe Date: Wed, 15 Nov 2023 10:21:38 -0500 Subject: [PATCH] Patch for use of jinja templating to refactor cloudwatch config --- .../files/cloudwatch/cloudwatch_agent_config_util.py | 2 +- .../files/cloudwatch/write_cloudwatch_agent_json.py | 2 +- .../resources/cloudwatch/partial/_cloudwatch_common.rb | 2 +- .../test/controls/cloudwatch_spec.rb | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cookbooks/aws-parallelcluster-environment/files/cloudwatch/cloudwatch_agent_config_util.py b/cookbooks/aws-parallelcluster-environment/files/cloudwatch/cloudwatch_agent_config_util.py index 41ed03820f..48884ea2f9 100644 --- a/cookbooks/aws-parallelcluster-environment/files/cloudwatch/cloudwatch_agent_config_util.py +++ b/cookbooks/aws-parallelcluster-environment/files/cloudwatch/cloudwatch_agent_config_util.py @@ -70,7 +70,7 @@ def _read_json_at(path): def _read_jinja_template_at(path): - """Read the JSON file at path.""" + """Read the JSON file at path as a Jinja template.""" try: with open(render_jinja_template(path), encoding="utf-8") as input_file: return json.load(input_file) diff --git a/cookbooks/aws-parallelcluster-environment/files/cloudwatch/write_cloudwatch_agent_json.py b/cookbooks/aws-parallelcluster-environment/files/cloudwatch/write_cloudwatch_agent_json.py index f14bd9997d..31fdc16015 100644 --- a/cookbooks/aws-parallelcluster-environment/files/cloudwatch/write_cloudwatch_agent_json.py +++ b/cookbooks/aws-parallelcluster-environment/files/cloudwatch/write_cloudwatch_agent_json.py @@ -64,7 +64,7 @@ def add_instance_log_stream_prefixes(configs): def read_data(config_path): - """Read in log configuration data from config_path.""" + """Read in and render jinja template of the log configuration data from config_path.""" with open(render_jinja_template(config_path), encoding="utf-8") as infile: return json.load(infile) diff --git a/cookbooks/aws-parallelcluster-environment/resources/cloudwatch/partial/_cloudwatch_common.rb b/cookbooks/aws-parallelcluster-environment/resources/cloudwatch/partial/_cloudwatch_common.rb index 6e38bb0c3e..e8ca75f3b2 100644 --- a/cookbooks/aws-parallelcluster-environment/resources/cloudwatch/partial/_cloudwatch_common.rb +++ b/cookbooks/aws-parallelcluster-environment/resources/cloudwatch/partial/_cloudwatch_common.rb @@ -137,7 +137,7 @@ def package_path path common_module_path user 'root' group 'root' - mode '0644' + mode '0755' end execute "cloudwatch-config-validation" do diff --git a/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb b/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb index 2ae4bb1ae3..d65e31a1f8 100644 --- a/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb +++ b/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb @@ -40,7 +40,7 @@ describe file('/usr/local/bin/write_cloudwatch_agent_json.py') do it { should exist } - its('sha256sum') { should eq 'e528db6e875ed28e1ed0caf5e2e4cb9542e744ce9ebfadafa594272542fe7ea2' } + its('sha256sum') { should eq '54239b52d8cbae4b9da0efb3a73f06160e30b3580d9eba8e970fe2b81b973737' } its('owner') { should eq 'root' } its('group') { should eq 'root' } its('mode') { should cmp '0755' } @@ -64,7 +64,7 @@ describe file('/usr/local/bin/cloudwatch_agent_config_util.py') do it { should exist } - its('sha256sum') { should eq '55125b14b8b5dba4b694b07f2ece008a6607ceb24ce0ae784a92affe34bd78bd' } + its('sha256sum') { should eq 'd50da5d7f6bdda90b41e18f713432c6eff8e03c6efe32f024b1c214cd9bb3eb8' } its('owner') { should eq 'root' } its('group') { should eq 'root' } its('mode') { should cmp '0644' } @@ -75,7 +75,7 @@ its('sha256sum') { should eq 'b65d53caf3d69f723324c4339f44cd8662a5c63ad8796118640738d7f6a63381' } its('owner') { should eq 'root' } its('group') { should eq 'root' } - its('mode') { should cmp '0644' } + its('mode') { should cmp '0755' } end describe 'Check the cloudwatch service'