summaryrefslogtreecommitdiff
path: root/cloudinit/net/netplan.py
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2019-10-24 20:02:15 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-10-24 20:02:15 +0000
commit5bec6b0e2a2ce5fd03bb04f441536fc130e67997 (patch)
treed4fbc5ae8d7360ff87c283c2550f4661ef007dff /cloudinit/net/netplan.py
parent3e2482e8aa6630ca9bc115dc1f82d44d3fde1681 (diff)
downloadvyos-cloud-init-5bec6b0e2a2ce5fd03bb04f441536fc130e67997.tar.gz
vyos-cloud-init-5bec6b0e2a2ce5fd03bb04f441536fc130e67997.zip
Fix usages of yaml, and move yaml_dump to safeyaml.dumps.
Here we replace uses of the pyyaml module directly with functions provided by cloudinit.safeyaml. Also, change/move cloudinit.util.yaml_dumps to cloudinit.safeyaml.dumps LP: #1849640
Diffstat (limited to 'cloudinit/net/netplan.py')
-rw-r--r--cloudinit/net/netplan.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/cloudinit/net/netplan.py b/cloudinit/net/netplan.py
index e54a34e5..54be1221 100644
--- a/cloudinit/net/netplan.py
+++ b/cloudinit/net/netplan.py
@@ -8,6 +8,7 @@ from .network_state import subnet_is_ipv6, NET_CONFIG_TO_V2
from cloudinit import log as logging
from cloudinit import util
+from cloudinit import safeyaml
from cloudinit.net import SYS_CLASS_NET, get_devicelist
KNOWN_SNAPD_CONFIG = b"""\
@@ -235,9 +236,9 @@ class Renderer(renderer.Renderer):
# if content already in netplan format, pass it back
if network_state.version == 2:
LOG.debug('V2 to V2 passthrough')
- return util.yaml_dumps({'network': network_state.config},
- explicit_start=False,
- explicit_end=False)
+ return safeyaml.dumps({'network': network_state.config},
+ explicit_start=False,
+ explicit_end=False)
ethernets = {}
wifis = {}
@@ -359,10 +360,10 @@ class Renderer(renderer.Renderer):
# workaround yaml dictionary key sorting when dumping
def _render_section(name, section):
if section:
- dump = util.yaml_dumps({name: section},
- explicit_start=False,
- explicit_end=False,
- noalias=True)
+ dump = safeyaml.dumps({name: section},
+ explicit_start=False,
+ explicit_end=False,
+ noalias=True)
txt = util.indent(dump, ' ' * 4)
return [txt]
return []