Skip to content

Commit

Permalink
Add workarounds for systemd socket activation
Browse files Browse the repository at this point in the history
Fixes #14
  • Loading branch information
bodgit committed Oct 6, 2018
1 parent 0a67af7 commit d781f8b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
35 changes: 35 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,39 @@
* => $attributes,
}
}

if $::service_provider == 'systemd' {
ensure_resource('exec', 'systemctl daemon-reload', {
refreshonly => true,
path => $::path,
})

# EL7 ships some slightly broken systemd units for socket activation
['autofs', 'pac', 'pam', 'ssh', 'sudo'].each |$service| {
file { "/etc/systemd/system/sssd-${service}.service.d":
ensure => directory,
owner => 0,
group => 0,
mode => '0644',
force => true,
purge => true,
recurse => true,
recurselimit => 1,
}

file { "/etc/systemd/system/sssd-${service}.service.d/override.conf":
ensure => file,
owner => 0,
group => 0,
mode => '0644',
content => @(EOS/L),
[Service]
ExecStartPre=
User=
Group=
| EOS
notify => Exec['systemctl daemon-reload'],
}
}
}
}
8 changes: 5 additions & 3 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@
if has_key($::sssd::socket_services, $service) {
Array($::sssd::socket_services[$service], true).each |String $x| {
service { $x:
enable => true,
enable => true,
require => Exec['systemctl daemon-reload'],
}
}
}
Expand All @@ -350,8 +351,9 @@
if has_key($::sssd::socket_services, $service) {
Array($::sssd::socket_services[$service], true).each |String $x| {
service { $x:
ensure => stopped,
enable => false,
ensure => stopped,
enable => false,
require => Exec['systemctl daemon-reload'],
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions spec/classes/sssd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@
it { is_expected.to contain_sssd_conf('sssd/reconnection_retries').with_value('3') }
it { is_expected.to contain_sssd_conf('sssd/try_inotify').with_value('true') }
it { is_expected.to contain_sssd_conf('sssd/user').with_value('sssd') }

case facts[:operatingsystemmajrelease]
when '6'
# noop
else
it { is_expected.to contain_exec('systemctl daemon-reload') }
it { is_expected.to contain_file('/etc/systemd/system/sssd-autofs.service.d') }
it { is_expected.to contain_file('/etc/systemd/system/sssd-autofs.service.d/override.conf') }
it { is_expected.to contain_file('/etc/systemd/system/sssd-pac.service.d') }
it { is_expected.to contain_file('/etc/systemd/system/sssd-pac.service.d/override.conf') }
it { is_expected.to contain_file('/etc/systemd/system/sssd-pam.service.d') }
it { is_expected.to contain_file('/etc/systemd/system/sssd-pam.service.d/override.conf') }
it { is_expected.to contain_file('/etc/systemd/system/sssd-ssh.service.d') }
it { is_expected.to contain_file('/etc/systemd/system/sssd-ssh.service.d/override.conf') }
it { is_expected.to contain_file('/etc/systemd/system/sssd-sudo.service.d') }
it { is_expected.to contain_file('/etc/systemd/system/sssd-sudo.service.d/override.conf') }
end
end
end
end

0 comments on commit d781f8b

Please sign in to comment.