Skip to content

Commit

Permalink
Revert "Add support for .link units and dropins"
Browse files Browse the repository at this point in the history
  • Loading branch information
traylenator authored Jan 23, 2025
1 parent 2235815 commit cac6771
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 186 deletions.
70 changes: 1 addition & 69 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

##### <a name="-systemd--manage_dropin--unit"></a>`unit`

Expand Down Expand Up @@ -1290,22 +1286,6 @@ key value pairs for the [Swap] section of the unit file

Default value: `undef`

##### <a name="-systemd--manage_dropin--match_entry"></a>`match_entry`

Data type: `Optional[Systemd::Unit::Match]`

kev value pairs for [Match] section of the unit file.

Default value: `undef`

##### <a name="-systemd--manage_dropin--link_entry"></a>`link_entry`

Data type: `Optional[Systemd::Unit::Link]`

kev value pairs for [Link] section of the unit file.

Default value: `undef`

### <a name="systemd--manage_unit"></a>`systemd::manage_unit`

Generate unit file from template
Expand Down Expand Up @@ -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)

##### <a name="-systemd--manage_unit--name"></a>`name`

Expand Down Expand Up @@ -1665,22 +1643,6 @@ kev value pairs for [Swap] section of the unit file.

Default value: `undef`

##### <a name="-systemd--manage_unit--match_entry"></a>`match_entry`

Data type: `Optional[Systemd::Unit::Match]`

kev value pairs for [Match] section of the unit file.

Default value: `undef`

##### <a name="-systemd--manage_unit--link_entry"></a>`link_entry`

Data type: `Optional[Systemd::Unit::Link]`

kev value pairs for [Link] section of the unit file.

Default value: `undef`

### <a name="systemd--modules_load"></a>`systemd::modules_load`

Creates a modules-load.d drop file
Expand Down Expand Up @@ -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)$/]`

### <a name="Systemd--Unit--Amount"></a>`Systemd::Unit::Amount`

Expand Down Expand Up @@ -3204,36 +3166,6 @@ Struct[{
}]
```

### <a name="Systemd--Unit--Link"></a>`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],
}]
```

### <a name="Systemd--Unit--Match"></a>`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],
}]
```

### <a name="Systemd--Unit--Mount"></a>`Systemd::Unit::Mount`

Possible keys for the [Mount] section of a unit file
Expand Down
14 changes: 0 additions & 14 deletions manifests/manage_dropin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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")
Expand All @@ -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,
Expand All @@ -171,8 +159,6 @@
'socket_entry' => $socket_entry,
'mount_entry' => $mount_entry,
'swap_entry' => $swap_entry,
'match_entry' => $match_entry,
'link_entry' => $link_entry,
}),
}
}
14 changes: 0 additions & 14 deletions manifests/manage_unit.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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)

Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -244,8 +232,6 @@
'socket_entry' => $socket_entry,
'mount_entry' => $mount_entry,
'swap_entry' => $swap_entry,
'match_entry' => $match_entry,
'link_entry' => $link_entry,
}),
}
}
25 changes: 0 additions & 25 deletions spec/defines/manage_dropin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 0 additions & 24 deletions spec/defines/manage_unit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }

Expand Down
9 changes: 0 additions & 9 deletions spec/type_aliases/systemd_unit_link_spec.rb

This file was deleted.

9 changes: 0 additions & 9 deletions spec/type_aliases/systemd_unit_match_spec.rb

This file was deleted.

1 change: 0 additions & 1 deletion spec/type_aliases/unit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
context 'with a permitted unit name' do
[
'foo.service',
'25-wireless.link',
'foo.socket',
'[email protected]',
'[email protected]',
Expand Down
4 changes: 0 additions & 4 deletions templates/unit_file.epp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
Optional[Hash] $socket_entry,
Optional[Hash] $mount_entry,
Optional[Hash] $swap_entry,
Optional[Hash] $match_entry,
Optional[Hash] $link_entry,
| -%>
<%-

Expand All @@ -26,8 +24,6 @@
'Mount',
'Swap',
'Install',
'Match',
'Link',
]

# Directives which are pair of items to be expressed as a space seperated pair.
Expand Down
2 changes: 1 addition & 1 deletion types/unit.pp
Original file line number Diff line number Diff line change
@@ -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)$/]
8 changes: 0 additions & 8 deletions types/unit/link.pp

This file was deleted.

8 changes: 0 additions & 8 deletions types/unit/match.pp

This file was deleted.

0 comments on commit cac6771

Please sign in to comment.