summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-09-27 07:04:40 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-09-27 07:04:40 +0200
commit177cb57f4fc06ebaecace262d3dbd1e417f5cce0 (patch)
tree4e52839140e1cde57682530720f60a88f1b0a235
parentClarify choice of reload method. (diff)
downloadnetworking-177cb57f4fc06ebaecace262d3dbd1e417f5cce0.tar.gz
networking-177cb57f4fc06ebaecace262d3dbd1e417f5cce0.tar.xz
Convert to PDK, and fix easy linter errors.
-rw-r--r--functions/repack.pp4
-rw-r--r--manifests/init.pp3
-rw-r--r--manifests/networkd_instance.pp31
-rw-r--r--metadata.json5
-rw-r--r--pdk.yaml2
5 files changed, 24 insertions, 21 deletions
diff --git a/functions/repack.pp b/functions/repack.pp
index a4b7815..1835fa7 100644
--- a/functions/repack.pp
+++ b/functions/repack.pp
@@ -2,8 +2,8 @@
function networking::repack(Hash[String,Variant[Hash, Array[Hash]]] $data) >> Hash[String, Array[Hash]] {
$data.map |$key, $body| {
[$key, $body ? {
- Hash => [$body],
- default => $body,
+ Hash => [$body],
+ default => $body,
}]
}.convert_to(Hash)
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 7dc2450..790c8c0 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -2,12 +2,11 @@ class networking (
Optional[Enum['systemd']] $provider = undef,
Hash[String,Hash] $items = {},
) {
-
# TODO choose a sensible provider here
case $provider {
'systemd', undef: {
- include ::networking::networkd
+ include networking::networkd
create_resources(networking::networkd_instance, $items)
}
default: {
diff --git a/manifests/networkd_instance.pp b/manifests/networkd_instance.pp
index 8a2693d..cbad0a2 100644
--- a/manifests/networkd_instance.pp
+++ b/manifests/networkd_instance.pp
@@ -9,27 +9,26 @@ define networking::networkd_instance (
String $file = "${path}/${real_filename}",
Optional[String] $mode = undef,
) {
-
file { $file:
ensure => $ensure,
owner => 'systemd-network',
mode => $mode,
content => epp('networking/unit_file.epp', {
- # Keys are unit file sections
- # Values are list of section content, so
- # {
- # 'Section' => [
- # {
- # 'key': 'value',
- # 'mvalued': ['v1', 'v2'],
- # }
- # ]
- # }
- # [Section]
- # key=value
- # mvalued=v1
- # mvalued=v2
- data => networking::repack($content),
+ # Keys are unit file sections
+ # Values are list of section content, so
+ # {
+ # 'Section' => [
+ # {
+ # 'key': 'value',
+ # 'mvalued': ['v1', 'v2'],
+ # }
+ # ]
+ # }
+ # [Section]
+ # key=value
+ # mvalued=v1
+ # mvalued=v2
+ data => networking::repack($content),
}),
notify => if $networking::networkd::notify_ { Exec['reload networkd'] } else { [] },
}
diff --git a/metadata.json b/metadata.json
index 607c904..ed37a13 100644
--- a/metadata.json
+++ b/metadata.json
@@ -15,5 +15,8 @@
{
"operatingsystem": "Archlinux"
}
- ]
+ ],
+ "pdk-version": "2.5.0",
+ "template-url": "pdk-default#2.5.0",
+ "template-ref": "tags/2.5.0-0-g369d483"
}
diff --git a/pdk.yaml b/pdk.yaml
new file mode 100644
index 0000000..4bef4bd
--- /dev/null
+++ b/pdk.yaml
@@ -0,0 +1,2 @@
+---
+ignore: []