Skip to content

Conversation

@traylenator
Copy link
Contributor

Pull Request (PR) description

It was currently not possible to provide an array of commands for a timer's service to run e.g

systemd::timer_wrapper{'purgescratch':
  ensure      => present,
  command     => [
    "/usr/bin/find /koji/scratch -xdev -depth -mtime +365 ( -type f -o -type l ) -delete -o -type d -empty -delete",
    "/usr/bin/find /koji/work -xdev -depth -mtime +365 ( -type f -o -type l ) -delete -o -type d -empty -delete",
  ]
  on_calendar => 'Daily',
}

Support arrays of commands

It was currently not possible to provide an array of commands for a
timer's service to run e.g

```puppet
systemd::timer_wrapper{'purgescratch':
  ensure      => present,
  command     => [
    "/usr/bin/find /koji/scratch -xdev -depth -mtime +365 ( -type f -o -type l ) -delete -o -type d -empty -delete",
    "/usr/bin/find /koji/work -xdev -depth -mtime +365 ( -type f -o -type l ) -delete -o -type d -empty -delete",
  ]
  on_calendar => 'Daily',
}
```

Support arrays of commands
@traylenator traylenator added the enhancement New feature or request label Nov 26, 2025
Comment on lines +42 to +44
Optional[Variant[Systemd::Unit::Service::Exec,Array[Systemd::Unit::Service::Exec,1]]] $pre_command = undef,
Optional[Variant[Systemd::Unit::Service::Exec,Array[Systemd::Unit::Service::Exec,1]]] $command = undef,
Optional[Variant[Systemd::Unit::Service::Exec,Array[Systemd::Unit::Service::Exec,1]]] $post_command = undef,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe that's the point where this should go into a custom type alias? :D

in your example you use:

['/usr/bin/echo run this', '/usr/bin/echo and this']

I'm wondering if the array will confuse because because they will actually do:

['/usr/bin/echo', 'run', 'this']

because of the exec resource, which accepts arrays for a single command + parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will write it out as

ExecStart=/usr/bin/echo run this
ExecStart=/usr/bin/echo and this

its not an actual exec

@traylenator traylenator merged commit 19c0ee5 into voxpupuli:master Dec 2, 2025
56 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants