Skip to content

Commit

Permalink
Reload udev rules after change (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
deric committed Aug 27, 2024
1 parent 7e2e187 commit e8e1588
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifests/udev/rule.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
owner => 'root',
group => 'root',
mode => '0444',
notify => $notify_services,
notify => $notify_services << 'Exec[systemd-udev_reload]',
selinux_ignore_defaults => $selinux_ignore_defaults,
content => epp("${module_name}/udev_rule.epp", { 'rules' => $rules }),
}
Expand Down
7 changes: 7 additions & 0 deletions manifests/udevd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@
* => $udev_rule,
}
}

exec { 'systemd-udev_reload':
command => 'udevadm control --reload-rules && udevadm trigger',
refreshonly => true,
path => $facts['path'],
}

}
2 changes: 2 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,8 @@
'ACTION=="add", KERNEL=="sdb", RUN+="/bin/raw /dev/raw/raw2 %N"',
])
}

it { is_expected.to contain_file('/etc/udev/rules.d/example_raw.rules').that_notifies('Exec[systemd-udev_reload]') }
end

context 'with machine-info' do
Expand Down

0 comments on commit e8e1588

Please sign in to comment.