Skip to content

Commit

Permalink
selinux_login: Just use the login name as title
Browse files Browse the repository at this point in the history
This allows for resources to be named consistently when the properties
change.
  • Loading branch information
EmRowlands committed Jul 13, 2023
1 parent 625d64c commit 340c17e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/puppet/provider/selinux_login/semanage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def self.prefetch(resources)
instances.each do |provider|
resource = resources[provider.name]
if resource
unless resource[:selinux_user].to_s == provider.selinux_user && resource[:selinux_login_name].to_s == provider.selinux_login_name || resource.purging?
raise Puppet::ResourceError, "Selinux_login['#{resource[:name]}']: title does not match its seuser and login ('#{provider.name}' != '#{provider.selinux_user}_#{provider.selinux_login_name}'), and a conflicting resource exists"
unless resource[:selinux_login_name].to_s == provider.selinux_login_name || resource.purging?
raise Puppet::ResourceError, "Selinux_login['#{resource[:name]}']: title does not match its login ('#{provider.name}' != '#{provider.selinux_login_name}'), and a conflicting resource exists"
end

resource.provider = provider
Expand All @@ -112,7 +112,7 @@ def self.prefetch(resources)
resources.each_values do |res|
next unless res[:selinux_user] == provider.selinux_user && res[:selinux_login_name] == provider.selinux_login_name

warning("Selinux_login['#{res[:name]}']: title does not match its seuser and login ('#{provider.name}' != '#{provider.selinux_user}_#{provider.selinux_login_name}')")
warning("Selinux_login['#{res[:name]}']: title does not match its login ('#{provider.name}' != '#{provider.selinux_login_name}')")
resource.provider = provider
resource[:ensure] = :present if provider.source == :policy
end
Expand Down
2 changes: 1 addition & 1 deletion manifests/login.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

# Do nothing unless SELinux is enabled
if $facts['os']['selinux']['enabled'] {
selinux_login { "${selinux_login_name}_${selinux_user}":
selinux_login { $selinux_login_name:
ensure => $ensure,
selinux_login_name => $selinux_login_name,
selinux_user => $selinux_user,
Expand Down

0 comments on commit 340c17e

Please sign in to comment.