From d5637964425cb1950c842bcb866053c4f0d40152 Mon Sep 17 00:00:00 2001 From: Himani Anil Deshpande Date: Wed, 19 Mar 2025 17:04:20 -0400 Subject: [PATCH] [Kitchen Test] Use os_properties outside it block --- .../test/controls/cloudwatch_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb b/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb index d88b2e2c2f..ee35703090 100644 --- a/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb +++ b/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb @@ -20,13 +20,13 @@ describe 'Check the presence of the cloudwatch package gpg key' # In Ubuntu >20.04 due to environment variable the keyring is placed under home of the user ubuntu with the permission of root - - keyring = os_properties.ubuntu? && !os_properties.on_docker? ? '--keyring /home/ubuntu/.gnupg/pubring.kbx' : '' + is_ubuntu = os_properties.ubuntu? + keyring = is_ubuntu && !os_properties.on_docker? ? '--keyring /home/ubuntu/.gnupg/pubring.kbx' : '' sudo = os_properties.redhat_on_docker? ? '' : 'sudo' describe bash("#{sudo} gpg --list-keys #{keyring}") do # Don't check exit status for Ubuntu20 because it returns 2 when executed in the validate phase of a created AMI # os_properties cannot be used in the describe block level. It can be used within an it{} block - its('exit_status') { should eq 0 } unless os_properties.ubuntu? + its('exit_status') { should eq 0 } unless is_ubuntu its('stdout') { should match /3B789C72/ } its('stdout') { should match /Amazon CloudWatch Agent/ } end