import netifaces
import netaddr
import yaml
class Ethernet(yaml.YAMLObject):
def __init__(self, addresses, gateway4, mtu, nameservers):
self.nameservers = nameservers
self.mtu = mtu
self.gateway4 = gateway4
self.addresses = addresses
I am trying to write this class to a yum file:
with open("/home/netplan.yaml", "w") as file:
yaml.dump(document, file, default_flow_style=False)
I get this result:
!!python/object:__main__.Netplan
network: !!python/object:__main__.Network
ethernets:
docker0: !!python/object:__main__.Ethernet
addresses:
- 172.26.0.1/16
gateway4: 1.1.1.1
mtu: 9000
How is it possible to remove all meta information like !!python/object:main. from a yaml file?