Skip to content

Commit

Permalink
Get Config_version from the metdata that cfn-hup reads
Browse files Browse the repository at this point in the history
  • Loading branch information
Himani Deshpande committed Sep 10, 2024
1 parent 2ee6f33 commit e0fd1bb
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ while $GET_LATEST_CLUSTER_CONFIG; do
echo "Old Cluster config version is $OLD_CLUSTER_CONFIG_VERSION"
#NEW_CLUSTER_CONFIG_VERSION=$(aws s3api list-object-versions --bucket ${S3_BUCKET} --prefix "${S3_ARTIFACT_DIR}/configs/cluster-config-with-implied-values.yaml" --region ${REGION} | jq -r '.Versions[] | select(.IsLatest == true) | .VersionId' 2>&1 || error_exit "${!S3API_RESULT}")
NEW_CLUSTER_CONFIG_VERSION=$(cat /opt/parallelcluster/shared/cluster-config-version )
# NEW_CLUSTER_CONFIG_VERSION=$(cat /var/lib/cfn-hup/data/metadata_db.json | jq -r '.[].deployConfigFiles.files.config_version.content')
echo "New Cluster config version is $NEW_CLUSTER_CONFIG_VERSION"

if [[ -n $NEW_CLUSTER_CONFIG_VERSION ]] && [[ $NEW_CLUSTER_CONFIG_VERSION != $OLD_CLUSTER_CONFIG_VERSION]]; then
if [[ -n "${NEW_CLUSTER_CONFIG_VERSION}" ]] && [[ "${NEW_CLUSTER_CONFIG_VERSION}" != "${OLD_CLUSTER_CONFIG_VERSION}" ]]; then
GET_LATEST_CLUSTER_CONFIG=false
CLUSTER_CONFIG_VERSION=$NEW_CLUSTER_CONFIG_VERSION
AWS_RETRY_MODE=standard
Expand All @@ -33,7 +34,7 @@ while $GET_LATEST_CLUSTER_CONFIG; do
jq -s ".[0] * .[1] * .[2] * .[3]" /tmp/common-dna.json /tmp/compute-dna.json /tmp/stack-arn.json /tmp/extra.json > /etc/chef/dna.json || ( echo "jq not installed"; cp /tmp/common-dna.json /tmp/compute-dna.json /etc/chef/dna.json )
cd /etc/chef
cinc-client --local-mode --config /etc/chef/client.rb --log_level info --logfile /var/log/chef-client.log --force-formatter --no-color --chef-zero-port 8889 --json-attributes /etc/chef/dna.json --override-runlist aws-parallelcluster-entrypoints::update && /opt/parallelcluster/scripts/fetch_and_run -postupdate
endif
fi

sleep 60
done

0 comments on commit e0fd1bb

Please sign in to comment.