Page MenuHomePhabricator

/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

hagbard claimed this task.Feb 19 2019, 10:29 PM
This comment was removed by hagbard.
hagbard triaged this task as Normal priority.Feb 19 2019, 11:09 PM
hagbard added a subscriber: c-po.Feb 19 2019, 11:52 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.

c-po added a comment.Feb 20 2019, 4:34 AM

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

c-po claimed this task.Feb 21 2019, 7:48 PM
c-po closed this task as Resolved.
c-po changed Difficulty level from Unknown (require assessment) to Easy (less than an hour).
c-po added a subscriber: hagbard.