From f75d84c38ecfac1891e5f3e8fe2d424cc3e7448d Mon Sep 17 00:00:00 2001 From: Xuanqi He <93849823+hehe7318@users.noreply.github.com> Date: Tue, 22 Oct 2024 04:12:53 +0800 Subject: [PATCH] [Develop] Get region from Identity Document instead of AZ (#2812) * Fix an issue in the way we get region when manage volumes so that it can correctly handle local zone. --- CHANGELOG.md | 8 ++++++++ .../files/default/ec2_udev_rules/manageVolume.py | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50e62d072..5f6d338a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ aws-parallelcluster-cookbook CHANGELOG This file is used to list changes made in each version of the AWS ParallelCluster cookbook. +3.12.0 +------ + +**CHANGES** + +**BUG FIXES** +- Fix an issue in the way we get region when manage volumes so that it can correctly handle local zone. + 3.11.1 ------ diff --git a/cookbooks/aws-parallelcluster-environment/files/default/ec2_udev_rules/manageVolume.py b/cookbooks/aws-parallelcluster-environment/files/default/ec2_udev_rules/manageVolume.py index 5db0b6096..5f7816b1c 100644 --- a/cookbooks/aws-parallelcluster-environment/files/default/ec2_udev_rules/manageVolume.py +++ b/cookbooks/aws-parallelcluster-environment/files/default/ec2_udev_rules/manageVolume.py @@ -214,8 +214,9 @@ def handle_volume(volume_id, attach, detach): instance_id = get_metadata_value(token, "http://169.254.169.254/latest/meta-data/instance-id") - region = get_metadata_value(token, "http://169.254.169.254/latest/meta-data/placement/availability-zone") - region = region[:-1] + identity_document = get_metadata_value(token, "http://169.254.169.254/latest/dynamic/instance-identity/document") + identity = json.loads(identity_document) + region = identity["region"] proxy_config = parse_proxy_config()