From 563754b6c21869b6cb924b491b509abf7aa7beba Mon Sep 17 00:00:00 2001 From: Judy Ng Date: Mon, 11 Sep 2023 17:34:48 -0400 Subject: [PATCH] Fix an implicit return in clusterstatusmgtd.py and add explanatory comment in cloudwatch_agent_config_util.py (#2449) Signed-off-by: Judy Ng --- .../files/clusterstatusmgtd/clusterstatusmgtd.py | 5 +++-- .../files/cloudwatch/cloudwatch_agent_config_util.py | 1 + .../test/controls/cloudwatch_spec.rb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cookbooks/aws-parallelcluster-computefleet/files/clusterstatusmgtd/clusterstatusmgtd.py b/cookbooks/aws-parallelcluster-computefleet/files/clusterstatusmgtd/clusterstatusmgtd.py index 8067f1fc88..278883e19c 100644 --- a/cookbooks/aws-parallelcluster-computefleet/files/clusterstatusmgtd/clusterstatusmgtd.py +++ b/cookbooks/aws-parallelcluster-computefleet/files/clusterstatusmgtd/clusterstatusmgtd.py @@ -68,7 +68,7 @@ def log_exception( ): def decorator_log_exception(function): @functools.wraps(function) - def wrapper_log_expection(*args, **kwargs): # pylint: disable=R1710 + def wrapper_log_exception(*args, **kwargs): # pylint: disable=R1710 try: return function(*args, **kwargs) except catch_exception as e: @@ -77,8 +77,9 @@ def wrapper_log_expection(*args, **kwargs): # pylint: disable=R1710 if exception_to_raise: raise exception_to_raise raise + return None - return wrapper_log_expection + return wrapper_log_exception return decorator_log_exception 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 bc0fcb3bde..c51093a53f 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 @@ -158,6 +158,7 @@ def remove_backup(): try: os.remove(LOG_CONFIGS_BAK_PATH) except FileNotFoundError: + # No need to remove the file, as the file isn't found anyway pass diff --git a/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb b/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb index fbc798081e..c825b672f2 100644 --- a/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb +++ b/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb @@ -64,7 +64,7 @@ describe file('/usr/local/bin/cloudwatch_agent_config_util.py') do it { should exist } - its('sha256sum') { should eq '980b0ba6e5922fe2983d3e866ac970622f59a26a4829b8262466739582176525' } + its('sha256sum') { should eq 'b816b4891a5e8f1e7ac94616db7927f7955ba72a8f53ec1b320402a2ac9c9b7f' } its('owner') { should eq 'root' } its('group') { should eq 'root' } its('mode') { should cmp '0644' }