File tree Expand file tree Collapse file tree 4 files changed +33
-0
lines changed Expand file tree Collapse file tree 4 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ The following parameters are available in the `systemd` class:
144144* [ ` manage_oomd ` ] ( #-systemd--manage_oomd )
145145* [ ` oomd_ensure ` ] ( #-systemd--oomd_ensure )
146146* [ ` oomd_settings ` ] ( #-systemd--oomd_settings )
147+ * [ ` udev_purge_rules ` ] ( #-systemd--udev_purge_rules )
147148
148149##### <a name =" -systemd--default_target " ></a >` default_target `
149150
@@ -602,6 +603,14 @@ Hash of systemd-oomd configurations for oomd.conf
602603
603604Default value: ` {} `
604605
606+ ##### <a name =" -systemd--udev_purge_rules " ></a >` udev_purge_rules `
607+
608+ Data type: ` Boolean `
609+
610+ Toggle if unmanaged files in /etc/udev/rules.d should be purged if manage_udevd is enabled
611+
612+ Default value: ` false `
613+
605614### <a name =" systemd--tmpfiles " ></a >` systemd::tmpfiles `
606615
607616Update the systemd temp files
Original file line number Diff line number Diff line change 183183# @param oomd_settings
184184# Hash of systemd-oomd configurations for oomd.conf
185185#
186+ # @param udev_purge_rules
187+ # Toggle if unmanaged files in /etc/udev/rules.d should be purged if manage_udevd is enabled
186188class systemd (
187189 Optional[Pattern[' ^.+\. target$' ]] $default_target = undef ,
188190 Hash[String,String] $accounting = {},
239241 Boolean $manage_oomd = false ,
240242 Enum[' stopped' ,' running' ] $oomd_ensure = ' running' ,
241243 Systemd::OomdSettings $oomd_settings = {},
244+ Boolean $udev_purge_rules = false ,
242245) {
243246 contain systemd::install
244247
Original file line number Diff line number Diff line change 99 enable => true ,
1010 }
1111
12+ file { '/etc/udev/rules.d' :
13+ ensure => directory ,
14+ purge => $systemd::udev_purge_rules ,
15+ recurse => true ,
16+ }
17+
1218 file { '/etc/udev/udev.conf' :
1319 ensure => ' file' ,
1420 owner => ' root' ,
Original file line number Diff line number Diff line change 498498 it { is_expected . to compile . with_all_deps }
499499 it { is_expected . not_to contain_service ( 'systemd-udevd' ) }
500500 it { is_expected . not_to contain_file ( '/etc/udev/udev.conf' ) }
501+ it { is_expected . not_to contain_file ( '/etc/udev/rules.d' ) }
501502 end
502503
503504 context 'when working with udevd and no custom rules' do
534535 with_content ( %r{^resolve_names=early$} ) .
535536 with_content ( %r{^timeout_signal=SIGKILL$} )
536537 }
538+
539+ it { is_expected . to contain_file ( '/etc/udev/rules.d' ) . with_ensure ( 'directory' ) . with_purge ( false ) }
537540 end
538541
539542 context 'when working with udevd and a rule set' do
557560 }
558561 end
559562
563+ context 'when enabling udevd management and rule purging' do
564+ let ( :params ) do
565+ {
566+ manage_udevd : true ,
567+ udev_purge_rules : true ,
568+ }
569+ end
570+
571+ it { is_expected . to compile . with_all_deps }
572+ it { is_expected . to contain_file ( '/etc/udev/rules.d' ) . with_ensure ( 'directory' ) . with_purge ( true ) }
573+ end
574+
560575 it { is_expected . to compile . with_all_deps }
561576
562577 it {
You can’t perform that action at this time.
0 commit comments