sonic-buildimage/files
Prabhu Sreenivasan f28a670097 [baseimage]: Avoid removing localhost entry from /etc/hosts file (#2452)
- What I did
This fix removes the possibility of 'localhost' entry getting removed from /etc/hosts file by hostname-config service.

Without this change, whenever we change the hostname from 'localhost' to any other name on the config_db.json and reload the config, /etc/hosts file will only have the new hostname on it. But there are multiple sonic utilities (eg: swssconfig) which relies on the hard coded 'localhost' name and they tend to stop working.

- How I did it
Added a new check on hostname-config.sh script to avid blindly deleting the line containing the old hostname from /etc/hosts file. Now it will delete the old hostname only if its not localhost or when the hostname is not changing.

- How to verify it

Bring up SONiC on a device with hostname as localhost
Edit /etc/sonic/config_db.json to update the 'hostname' filed under DEVICE_METADATA from "hostname" : "localhost" --> "hostname" : "sonic"
run config reload -y to reflect the hostname change done on config_db.json file.
cat /etc/hosts and check whether both 127.0.0.1 localhost and 127.0.0.1 sonic entry are present on the file.
ping localhost should work fine.
- Description for the changelog
Make hostname-config service more robust in handling SONiC hostname change from localhost to anything else.
2019-01-17 22:47:19 -08:00
..
Aboot [device/Arista] fix small issue for the 7170 (#2373) 2018-12-11 04:14:46 -08:00
apt [baseimage]: Download picocom version 3.1-2 from stretch-backports; No longer build from source (#1946) 2018-08-17 17:38:20 -07:00
build_templates [mellanox|ffb] ISSU version check (#2437) 2019-01-17 14:41:32 -08:00
dhcp [baseimage]: Initial changes for dhcp to support eth0 in a mgmt vrf (#2348) 2019-01-15 18:15:56 -08:00
docker [docker-engine]: upgrade docker engine to 18.09 (#2417) 2019-01-04 20:47:43 -08:00
image_config [baseimage]: Avoid removing localhost entry from /etc/hosts file (#2452) 2019-01-17 22:47:19 -08:00
initramfs-tools [device/arista]: Update (#2336) 2018-12-04 10:08:55 -08:00
scripts [mellanox|ffb] use system level warm reboot for Mellanox fastfast boot (#2374) 2019-01-10 14:09:03 -08:00
sshd [sshd]: regenerate ssh key if ssh_host_rsa_key is not present 2018-08-11 21:38:33 +00:00