From 4e2da675fb7120ac3ae26e80a0f6400c8899d675 Mon Sep 17 00:00:00 2001 From: meow Date: Thu, 24 Oct 2019 11:40:08 +0500 Subject: [PATCH] a --- ucloud-init.start | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/ucloud-init.start b/ucloud-init.start index 6fa3486..794c5c5 100755 --- a/ucloud-init.start +++ b/ucloud-init.start @@ -32,7 +32,7 @@ setup_ssh() { # TODO: Make sure to replace the following address with http://metadata # whenever we got http://metadata resolving to url work successfully. - metadata=$(curl -s http://metadata:5000) + metadata=$(curl -s http://metadata:9000) echo "$metadata" | jq -r '.["ssh-key-list"] | .[]' > ssh-key-list.txt while read ssh_key; do @@ -82,23 +82,30 @@ setup_dns() { setup_etc_host() { tput setaf 2; tput bold; echo "Setting up /etc/hosts"; tput sgr0; - metadata=$(curl -s http://[2a0a:e5c1:144::]:5000) - host_list=$(echo "$metadata" | jq -r '.["host-list"]') - host_list_len=$(echo "$host_list" | jq -r '. | length') - - cat > /etc/hosts < /etc/hosts << EOF 127.0.0.1 localhost.my.domain localhost localhost.localdomain localhost ::1 localhost localhost.localdomain -$( - for i in $(seq 0 $((host_list_len - 1))); - do - ip=$(echo $host_list | jq -r ".[$i][0]") - hostname=$(echo $host_list | jq -r ".[$i][1]") - printf "%-25s %s\n" $ip $hostname - done -) +2a0a:e5c1:144:: metadata EOF + +# metadata=$(curl -s http://[2a0a:e5c1:144::]:9000) +# host_list=$(echo "$metadata" | jq -r '.["host-list"]') +# host_list_len=$(echo "$host_list" | jq -r '. | length') + +# cat > /etc/hosts <