voxpupuli / puppet-systemd

Puppet module to manage systemd
https://forge.puppet.com/puppet/systemd
Apache License 2.0
52 stars 142 forks source link

Correct typing for IOReadIOPSMax, IOWriteIOPSMax,... in systemd::manage_dropin #430

Closed traylenator closed 4 months ago

traylenator commented 4 months ago

Pull Request (PR) description

Using any of the following directives in systemd::manage_dropin or systemd::manage_unit resulted in a compilation error.

The types for these directives in Systemd::Unit::Slice and Systemd::Unit::Service have now been updated.

Example usage:

systemd::manage_dropin { 'devicelimits.conf':
  unit          =>  'special.service',
  service_entry => {
   'IOReadIOPSMax' => [
     ['/dev/afs',100],
     ['/dev/gluster','1000K'],
   ],
  },
}

would result in a drop in file of:

[Service]
IOReadIOPSMax=/dev/afs 100
IOReadIOPSMax=/dev/gluster 1000K

This Pull Request (PR) fixes the following issues

Worth Noting

traylenator commented 4 months ago

Very open to the simpler:

systemd::manage_dropin { 'devicelimits.conf':
  unit          =>  'special.service',
  service_entry => {
   'IOReadIOPSMax' => [
      '/dev/afs 100',
      '/dev/gluster  1000K',
   ],
  },
}

:+1: or :-1: for this simpler one.

TheMeier commented 4 months ago

Maybe make a type for

Variant[Tuple[Stdlib::Absolutepath, Systemd::Unit::Amount],Array[Tuple[Stdlib::Absolutepath, Systemd::Unit::Amount]]]

and

Array[Tuple[Stdlib::Absolutepath, Systemd::Unit::Amount]]

Systemd::Unit::Bandwidth?

traylenator commented 4 months ago

Maybe make a type for

Variant[Tuple[Stdlib::Absolutepath, Systemd::Unit::Amount],Array[Tuple[Stdlib::Absolutepath, Systemd::Unit::Amount]]]

and

Array[Tuple[Stdlib::Absolutepath, Systemd::Unit::Amount]]

Systemd::Unit::Bandwidth?

I don't think this is used anywhere else. I certainly don't want to move away from the obvious to read.

variant[array[thing],thing]

So would only leave the tuple to simplify and that's simple already. :-)