From a99009ce7ea6a561dcd26af3eb723eda880d776f Mon Sep 17 00:00:00 2001 From: Emily Rowlands Date: Thu, 30 Mar 2023 14:12:51 +0100 Subject: [PATCH] selinux_login: Add sync to provider and type This allows for the login configuration to be updated, and not just created and removed. --- lib/puppet/provider/selinux_login/semanage.rb | 5 +++++ lib/puppet/type/selinux_login.rb | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/lib/puppet/provider/selinux_login/semanage.rb b/lib/puppet/provider/selinux_login/semanage.rb index 972d67f2..de52e95d 100644 --- a/lib/puppet/provider/selinux_login/semanage.rb +++ b/lib/puppet/provider/selinux_login/semanage.rb @@ -125,6 +125,11 @@ def create semanage(*args) end + def sync + args = ['login', '-m', '-s', @resource[:selinux_user], @resource[:selinux_login_name]] + semanage(*args) + end + def destroy args = ['login', '-d', @property_hash[:selinux_login_name]] semanage(*args) diff --git a/lib/puppet/type/selinux_login.rb b/lib/puppet/type/selinux_login.rb index 597831ce..b92ac432 100644 --- a/lib/puppet/type/selinux_login.rb +++ b/lib/puppet/type/selinux_login.rb @@ -17,6 +17,12 @@ newproperty(:selinux_user) do desc 'The selinux user to map to.' isrequired + + def sync + event = super + provider.sync + event + end end newproperty(:source) do