relpipe-data/examples/netplan-1.sh
branchv_0
changeset 329 5bc2bb8b7946
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/relpipe-data/examples/netplan-1.sh	Mon Feb 21 00:43:11 2022 +0100
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+cat netplan.yaml \
+	| relpipe-in-yamltable \
+		--relation 'nic' \
+			--records '/yaml/network/ethernets/*|/yaml/network/bridges/*' \
+			--attribute 'name'         string    'name()' \
+			--attribute 'type'         string    'name(..)' \
+			--attribute 'dhcp4'        boolean   'dhcp4' \
+			--attribute 'dhcp6'        boolean   'dhcp6' \
+			--attribute 'accept-ra'    boolean   'accept-ra' \
+		--relation 'bridge' \
+			--records '/yaml/network/bridges/*' \
+			--attribute 'name'         string    'name()' \
+			--attribute 'gateway4'     string    'gateway4' \
+			--attribute 'mtu'          string    'mtu' \
+		--relation 'bridge_interface' \
+			--records '/yaml/network/bridges/*/interfaces' \
+			--attribute 'bridge'       string    'name(..)' \
+			--attribute 'interface'    string    '.' \
+		--relation 'ip' \
+			--records '/yaml/network/bridges/*/addresses' \
+			--attribute 'address'      string    'substring-before(., "/")' \
+			--attribute 'mask'         string    'substring-after(., "/")' \
+			--attribute 'interface'    string    'name(..)' \
+	| relpipe-out-tabular
+
+# an early draft of the relational mapping