File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,24 @@ if [[ ! -d /var/db ]]; then
17
17
mkdir -p /var/db
18
18
fi
19
19
20
+ smartdc_info " Retrieving metadata sdc:hostname"
21
+
22
+ $MDATA_GET sdc:hostname > /etc/hostname.new
23
+ case $? in
24
+ 0)
25
+ smartdc_info " Metadata sdc:hostname successfuly retrieved."
26
+ mv /etc/hostname{.new,}
27
+ smartdc_info " Setting hostname"
28
+ hostname $( cat /etc/hostname)
29
+ ;;
30
+ 1)
31
+ smartdc_info " Metadata sdc:hostname not defined."
32
+ rm -f /etc/hostname.new
33
+ ;;
34
+ * )
35
+ smartdc_fatal " Metadata couldn't be retrieved."
36
+ ;;
37
+ esac
20
38
21
39
smartdc_info " Retrieving metadata user-data"
22
40
Original file line number Diff line number Diff line change 6
6
7
7
# load common functions and vars
8
8
. /lib/smartdc/common.lib
9
+
10
+
11
+ # Set hostname to value set in /etc/hostname
12
+ # Ensures we get the hostname from meta data sdc:hostname if it was set.
13
+ NEWHOSTNAME=$( cat /etc/hostname)
14
+
15
+ sed -i ' /HOSTNAME=/HOSTNAME=${NEWHOSTNAME}/g' /etc/sysconfig/network
You can’t perform that action at this time.
0 commit comments