Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interfaces2netplan: unexpected line ' up route add ... ' #18

Closed
vilitux opened this issue Mar 25, 2019 · 1 comment
Closed

interfaces2netplan: unexpected line ' up route add ... ' #18

vilitux opened this issue Mar 25, 2019 · 1 comment

Comments

@vilitux
Copy link
Member

vilitux commented Mar 25, 2019

We have the following configuration active in /etc/network/interfaces:

auto eth1
iface eth1 inet static
	address 192.168.1.3
	netmask 255.255.255.0
	up route add -net 10.0.0.0 netmask 255.255.255.0 gw 192.168.1.1
        down route del -net 10.0.0.0 netmask 255.255.255.0 gw 192.168.1.1

When using interfaces2netplan, it gives us the following stacktrace:

Traceback (most recent call last):
  File "/usr/bin/interfaces2netplan", line 358, in <module>
    main()
  File "/usr/bin/interfaces2netplan", line 353, in main
    files.show()
  File "/usr/bin/interfaces2netplan", line 166, in show
    yaml = self.get_yaml()
  File "/usr/bin/interfaces2netplan", line 145, in get_yaml
    ifile = InterfacesFile(long_file)
  File "/usr/bin/interfaces2netplan", line 186, in __init__
    self._parse()
  File "/usr/bin/interfaces2netplan", line 249, in _parse
    self._parse_context(context[1], config[context], line)
  File "/usr/bin/interfaces2netplan", line 292, in _parse_context
    raise ValueError('unexpected line {!r}'.format(line))
ValueError: unexpected line ' up route add -net 10.0.0.0 netmask 255.255.255.0 gw 192.168.1.1'

The expected output would've been something like this:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens5:
      addresses:
       - 192.168.1.3/24
      gateway4: 192.168.1.1
      routes:
       - to: 10.0.0.0/24
         via: 192.168.1.1
@wdoekes
Copy link
Member

wdoekes commented Mar 23, 2020

Already fixed long long long ago in af91d3c, yo!

@wdoekes wdoekes closed this as completed Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants