Page MenuHomeVyOS Platform

/usr/libexec/vyos/conf_mode/host_name.py needs to add an additional newline char
Closed, ResolvedPublicBUG

Description

For example, this command

set system static-host-mapping host-name asa inet 45.45.45.45

Results in the following /etc/hosts file:

### Autogenerated by host_name.py ###
127.0.0.1       localhost router.xx.xx.xx

# The following lines are desirable for IPv6 capable hosts
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters45.45.45.45     comcast       #vyatta entry

Note that if you fix it manually by editing /etc/hosts directly, it seems that the 'set system static-host-mapping...' command edits /etc/hosts properly. However, the problem returns after a reboot.

I think there needs to be an additional newline on line 46 of host_name.py.

Details

Difficulty level
Easy (less than an hour)
Version
VyOS 1.2.0-rolling+201902190337
Why the issue appeared?
Will be filled on close

Event Timeline

This comment was removed by hagbard.
hagbard triaged this task as Normal priority.Feb 19 2019, 11:09 PM

/opt/vyatta/share/vyatta-cfg/templates/system/static-host-mapping/host-name/node.def writes the entry, I think the functionality should be integrated into host_name.py. I contacted @c-po to hear his opinion.

Yes, please migrate that function, too. One more migrated command.

c-po claimed this task.
c-po changed Difficulty level from Unknown (require assessment) to Easy (less than an hour).
c-po added a subscriber: hagbard.