Skip to content

Commit e333707

Browse files
authored
Handle missing dataproc-role metadata in hive-lineage.sh (#1371)
Replaces the `curl -f` call to the metadata server with the safer `/usr/share/google/get_metadata_value` utility to retrieve the `dataproc-role` attribute. This change ensures the initialization action completes successfully even if the metadata key is not yet present, by using the standard Dataproc metadata helper and providing a fallback.
1 parent faad961 commit e333707

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

hive-lineage/hive-lineage.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ function install_jars() {
5252
}
5353

5454
function restart_hive_server2_master() {
55-
ROLE=$(curl -f -s -H Metadata-Flavor:Google http://metadata/computeMetadata/v1/instance/attributes/dataproc-role)
55+
# Safely get metadata without failing the script if the key is missing
56+
ROLE=$(/usr/share/google/get_metadata_value attributes/dataproc-role || echo "Unknown")
5657
if [[ "${ROLE}" == 'Master' ]]; then
5758
echo "Restarting hive-server2"
5859
sudo systemctl restart hive-server2.service

0 commit comments

Comments
 (0)