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

Describe how to add enty to interfaces file. #6

Open
amdei opened this issue Sep 23, 2016 · 0 comments
Open

Describe how to add enty to interfaces file. #6

amdei opened this issue Sep 23, 2016 · 0 comments

Comments

@amdei
Copy link

amdei commented Sep 23, 2016

It would be really convinient if sample, how to add new interface definition to existing file will be provided.

I came to a following solution:

new_iface = Iface
new_iface.name = 'eth4'

new_iface.method = 'static'
new_iface.address_family = 'inet'
new_iface.address = '1.2.3.4'
new_iface.netmask = '255.0.0.0'
new_iface.gateway = '4.3.2.1'
new_iface.startup = Allow

f1 = InterfacesFile('/etc/network/interfaces2')
f1.interfaces.append(new_iface)

f1.save()

Whicth is obviously do not work - there is only <class 'network_interfaces.iface.Iface'> in result file.

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

1 participant