From cac677101e1bea226c470dc279dff4938b95358c Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Thu, 23 Jan 2025 08:59:42 +0100 Subject: [PATCH] Revert "Add support for .link units and dropins" --- REFERENCE.md | 70 +------------------- manifests/manage_dropin.pp | 14 ---- manifests/manage_unit.pp | 14 ---- spec/defines/manage_dropin_spec.rb | 25 ------- spec/defines/manage_unit_spec.rb | 24 ------- spec/type_aliases/systemd_unit_link_spec.rb | 9 --- spec/type_aliases/systemd_unit_match_spec.rb | 9 --- spec/type_aliases/unit_spec.rb | 1 - templates/unit_file.epp | 4 -- types/unit.pp | 2 +- types/unit/link.pp | 8 --- types/unit/match.pp | 8 --- 12 files changed, 2 insertions(+), 186 deletions(-) delete mode 100644 spec/type_aliases/systemd_unit_link_spec.rb delete mode 100644 spec/type_aliases/systemd_unit_match_spec.rb delete mode 100644 types/unit/link.pp delete mode 100644 types/unit/match.pp diff --git a/REFERENCE.md b/REFERENCE.md index 65d3819a..80d1d9f6 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -80,8 +80,6 @@ * [`Systemd::Unit::Amount`](#Systemd--Unit--Amount): Systemd definition of amount, often bytes or united bytes * [`Systemd::Unit::AmountOrPercent`](#Systemd--Unit--AmountOrPercent): Systemd definition of amount, often bytes or united bytes * [`Systemd::Unit::Install`](#Systemd--Unit--Install): Possible keys for the [Install] section of a unit file -* [`Systemd::Unit::Link`](#Systemd--Unit--Link): Possible keys for the [Link] section of a unit file -* [`Systemd::Unit::Match`](#Systemd--Unit--Match): Possible keys for the [Match] section of a unit file * [`Systemd::Unit::Mount`](#Systemd--Unit--Mount): Possible keys for the [Mount] section of a unit file * [`Systemd::Unit::Path`](#Systemd--Unit--Path): Possible keys for the [Path] section of a unit file * [`Systemd::Unit::Percent`](#Systemd--Unit--Percent): Systemd definition of a percentage @@ -1129,8 +1127,6 @@ The following parameters are available in the `systemd::manage_dropin` defined t * [`socket_entry`](#-systemd--manage_dropin--socket_entry) * [`mount_entry`](#-systemd--manage_dropin--mount_entry) * [`swap_entry`](#-systemd--manage_dropin--swap_entry) -* [`match_entry`](#-systemd--manage_dropin--match_entry) -* [`link_entry`](#-systemd--manage_dropin--link_entry) ##### `unit` @@ -1290,22 +1286,6 @@ key value pairs for the [Swap] section of the unit file Default value: `undef` -##### `match_entry` - -Data type: `Optional[Systemd::Unit::Match]` - -kev value pairs for [Match] section of the unit file. - -Default value: `undef` - -##### `link_entry` - -Data type: `Optional[Systemd::Unit::Link]` - -kev value pairs for [Link] section of the unit file. - -Default value: `undef` - ### `systemd::manage_unit` Generate unit file from template @@ -1480,8 +1460,6 @@ The following parameters are available in the `systemd::manage_unit` defined typ * [`socket_entry`](#-systemd--manage_unit--socket_entry) * [`mount_entry`](#-systemd--manage_unit--mount_entry) * [`swap_entry`](#-systemd--manage_unit--swap_entry) -* [`match_entry`](#-systemd--manage_unit--match_entry) -* [`link_entry`](#-systemd--manage_unit--link_entry) ##### `name` @@ -1665,22 +1643,6 @@ kev value pairs for [Swap] section of the unit file. Default value: `undef` -##### `match_entry` - -Data type: `Optional[Systemd::Unit::Match]` - -kev value pairs for [Match] section of the unit file. - -Default value: `undef` - -##### `link_entry` - -Data type: `Optional[Systemd::Unit::Link]` - -kev value pairs for [Link] section of the unit file. - -Default value: `undef` - ### `systemd::modules_load` Creates a modules-load.d drop file @@ -3161,7 +3123,7 @@ custom datatype that validates different filenames for systemd units and unit te * **See also** * https://www.freedesktop.org/software/systemd/man/systemd.unit.html -Alias of `Pattern[/^[a-zA-Z0-9:\-_.\\@%]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope|link)$/]` +Alias of `Pattern[/^[a-zA-Z0-9:\-_.\\@%]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)$/]` ### `Systemd::Unit::Amount` @@ -3204,36 +3166,6 @@ Struct[{ }] ``` -### `Systemd::Unit::Link` - -Possible keys for the [Link] section of a unit file - -* **See also** - * https://www.freedesktop.org/software/systemd/man/latest/systemd.link.html - -Alias of - -```puppet -Struct[{ - Optional['MTUBytes'] => Integer[0], - }] -``` - -### `Systemd::Unit::Match` - -Possible keys for the [Match] section of a unit file - -* **See also** - * https://www.freedesktop.org/software/systemd/man/latest/systemd.link.html - -Alias of - -```puppet -Struct[{ - Optional['Driver'] => String[1], - }] -``` - ### `Systemd::Unit::Mount` Possible keys for the [Mount] section of a unit file diff --git a/manifests/manage_dropin.pp b/manifests/manage_dropin.pp index 5832928e..a5f7d0bb 100644 --- a/manifests/manage_dropin.pp +++ b/manifests/manage_dropin.pp @@ -90,8 +90,6 @@ # @param socket_entry key value pairs for the [Socket] section of the unit file # @param mount_entry key value pairs for the [Mount] section of the unit file # @param swap_entry key value pairs for the [Swap] section of the unit file -# @param match_entry kev value pairs for [Match] section of the unit file. -# @param link_entry kev value pairs for [Link] section of the unit file. # define systemd::manage_dropin ( Systemd::Unit $unit, @@ -114,8 +112,6 @@ Optional[Systemd::Unit::Socket] $socket_entry = undef, Optional[Systemd::Unit::Mount] $mount_entry = undef, Optional[Systemd::Unit::Swap] $swap_entry = undef, - Optional[Systemd::Unit::Link] $link_entry = undef, - Optional[Systemd::Unit::Match] $match_entry = undef, ) { if $timer_entry and $unit !~ Pattern['^[^/]+\.timer'] { fail("Systemd::Manage_dropin[${name}]: for unit ${unit} timer_entry is only valid for timer units") @@ -141,14 +137,6 @@ fail("Systemd::Manage_dropin[${name}]: for unit ${unit} mount_entry is only valid for swap units") } - if $link_entry and $unit !~ Pattern['^[^/]+\.link'] { - fail("Systemd::Manage_dropin[${name}]: for unit ${unit} link_entry is only valid for link units") - } - - if $match_entry and $unit !~ Pattern['^[^/]+\.link'] { - fail("Systemd::Manage_dropin[${name}]: for unit ${unit} match_entry is only valid for link units") - } - systemd::dropin_file { $name: ensure => $ensure, filename => $filename, @@ -171,8 +159,6 @@ 'socket_entry' => $socket_entry, 'mount_entry' => $mount_entry, 'swap_entry' => $swap_entry, - 'match_entry' => $match_entry, - 'link_entry' => $link_entry, }), } } diff --git a/manifests/manage_unit.pp b/manifests/manage_unit.pp index bba61f0d..aa92acf5 100644 --- a/manifests/manage_unit.pp +++ b/manifests/manage_unit.pp @@ -154,8 +154,6 @@ # @param socket_entry kev value paors for [Socket] section of the unit file. # @param mount_entry kev value pairs for [Mount] section of the unit file. # @param swap_entry kev value pairs for [Swap] section of the unit file. -# @param match_entry kev value pairs for [Match] section of the unit file. -# @param link_entry kev value pairs for [Link] section of the unit file. # define systemd::manage_unit ( Enum['present', 'absent'] $ensure = 'present', @@ -180,8 +178,6 @@ Optional[Systemd::Unit::Socket] $socket_entry = undef, Optional[Systemd::Unit::Mount] $mount_entry = undef, Optional[Systemd::Unit::Swap] $swap_entry = undef, - Optional[Systemd::Unit::Link] $link_entry = undef, - Optional[Systemd::Unit::Match] $match_entry = undef, ) { assert_type(Systemd::Unit, $name) @@ -209,14 +205,6 @@ fail("Systemd::Manage_unit[${name}]: swap_entry is only valid for swap units") } - if $link_entry and $name !~ Pattern['^[^/]+\.link'] { - fail("Systemd::Manage_unit[${name}]: link_entry is only valid for link units") - } - - if $match_entry and $name !~ Pattern['^[^/]+\.link'] { - fail("Systemd::Manage_unit[${name}]: mantch_entry is only valid for link units") - } - if $ensure != 'absent' and $name =~ Pattern['^[^/]+\.service'] and !$service_entry { fail("Systemd::Manage_unit[${name}]: service_entry is required for service units") } @@ -244,8 +232,6 @@ 'socket_entry' => $socket_entry, 'mount_entry' => $mount_entry, 'swap_entry' => $swap_entry, - 'match_entry' => $match_entry, - 'link_entry' => $link_entry, }), } } diff --git a/spec/defines/manage_dropin_spec.rb b/spec/defines/manage_dropin_spec.rb index c59b0262..a6d5c5bc 100644 --- a/spec/defines/manage_dropin_spec.rb +++ b/spec/defines/manage_dropin_spec.rb @@ -259,31 +259,6 @@ with_content(%r{^ListenMessageQueue=/panic$}) } end - - context 'on a link unit dropin' do - let(:params) do - { - unit: 'wireless.link', - match_entry: { - 'Driver' => 'brcmsmac', - }, - link_entry: { - 'MTUBytes' => 1450, - } - } - end - - it { is_expected.to compile.with_all_deps } - - it { - is_expected.to contain_systemd__dropin_file('foobar.conf'). - with_unit('wireless.link'). - with_content(%r{^\[Match\]$}). - with_content(%r{^Driver=brcmsmac$}). - with_content(%r{^\[Link\]$}). - with_content(%r{^MTUBytes=1450$}) - } - end end end end diff --git a/spec/defines/manage_unit_spec.rb b/spec/defines/manage_unit_spec.rb index 3406517c..003e0acc 100644 --- a/spec/defines/manage_unit_spec.rb +++ b/spec/defines/manage_unit_spec.rb @@ -260,30 +260,6 @@ } end - context 'on a link unit' do - let(:title) { '15-wireless.link' } - let(:params) do - { - match_entry: { - 'Driver' => 'brcmsmac', - }, - link_entry: { - 'MTUBytes' => 1450, - } - } - end - - it { is_expected.to compile.with_all_deps } - - it { - is_expected.to contain_systemd__unit_file('15-wireless.link'). - with_content(%r{^\[Match\]$}). - with_content(%r{^Driver=brcmsmac$}). - with_content(%r{^\[Link\]$}). - with_content(%r{^MTUBytes=1450$}) - } - end - context 'on a path unit' do let(:title) { 'etc-passwd.path' } diff --git a/spec/type_aliases/systemd_unit_link_spec.rb b/spec/type_aliases/systemd_unit_link_spec.rb deleted file mode 100644 index 665187c0..00000000 --- a/spec/type_aliases/systemd_unit_link_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe 'Systemd::Unit::Link' do - context 'with a key of What can have thing to link' do - it { is_expected.to allow_value({ 'MTUBytes' => 1024 }) } - end -end diff --git a/spec/type_aliases/systemd_unit_match_spec.rb b/spec/type_aliases/systemd_unit_match_spec.rb deleted file mode 100644 index e1770fac..00000000 --- a/spec/type_aliases/systemd_unit_match_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe 'Systemd::Unit::Match' do - context 'with a key of What can have thing to link' do - it { is_expected.to allow_value({ 'Driver' => 'brcmsmac' }) } - end -end diff --git a/spec/type_aliases/unit_spec.rb b/spec/type_aliases/unit_spec.rb index aed6f2eb..031f4d27 100644 --- a/spec/type_aliases/unit_spec.rb +++ b/spec/type_aliases/unit_spec.rb @@ -6,7 +6,6 @@ context 'with a permitted unit name' do [ 'foo.service', - '25-wireless.link', 'foo.socket', 'atemplate@.service', 'atemplate@instance.service', diff --git a/templates/unit_file.epp b/templates/unit_file.epp index e8755c62..b8e5b711 100644 --- a/templates/unit_file.epp +++ b/templates/unit_file.epp @@ -8,8 +8,6 @@ Optional[Hash] $socket_entry, Optional[Hash] $mount_entry, Optional[Hash] $swap_entry, - Optional[Hash] $match_entry, - Optional[Hash] $link_entry, | -%> <%- @@ -26,8 +24,6 @@ 'Mount', 'Swap', 'Install', - 'Match', - 'Link', ] # Directives which are pair of items to be expressed as a space seperated pair. diff --git a/types/unit.pp b/types/unit.pp index 4819a4d3..999d9733 100644 --- a/types/unit.pp +++ b/types/unit.pp @@ -1,3 +1,3 @@ # @summary custom datatype that validates different filenames for systemd units and unit templates # @see https://www.freedesktop.org/software/systemd/man/systemd.unit.html -type Systemd::Unit = Pattern[/^[a-zA-Z0-9:\-_.\\@%]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope|link)$/] +type Systemd::Unit = Pattern[/^[a-zA-Z0-9:\-_.\\@%]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)$/] diff --git a/types/unit/link.pp b/types/unit/link.pp deleted file mode 100644 index bf9ed130..00000000 --- a/types/unit/link.pp +++ /dev/null @@ -1,8 +0,0 @@ -# @summary Possible keys for the [Link] section of a unit file -# @see https://www.freedesktop.org/software/systemd/man/latest/systemd.link.html -# -type Systemd::Unit::Link = Struct[ - { - Optional['MTUBytes'] => Integer[0], - } -] diff --git a/types/unit/match.pp b/types/unit/match.pp deleted file mode 100644 index 19341895..00000000 --- a/types/unit/match.pp +++ /dev/null @@ -1,8 +0,0 @@ -# @summary Possible keys for the [Match] section of a unit file -# @see https://www.freedesktop.org/software/systemd/man/latest/systemd.link.html -# -type Systemd::Unit::Match = Struct[ - { - Optional['Driver'] => String[1], - } -]