swiftinit provider write file directly

Do not use the puppet file resource from within
the swiftinit service provider.  In puppet versions
4.4.0+ it has unexpected results.  Instead use ruby
File to write the init/service files directly.

Change-Id: If0dc56e0742e591e3db3ed18154edf3489d5ef1a
This commit is contained in:
Adam Vinsh 2016-06-14 16:20:58 -04:00
parent d01e3ac030
commit d239e198a9
2 changed files with 4 additions and 16 deletions

View File

@ -83,21 +83,9 @@ Puppet::Type.type(:service).provide :swiftinit, :parent => :service do
# file and notify systemctl. For Ubuntu < 16.04 create init file.
def enable
if default_provider_upstart?
file = Puppet::Type.type(:file).new(
:name => "/etc/init/#{resource[:pattern]}.conf",
:ensure => :present,
:content => upstart_template,
:mode => '0644'
)
file.write(file)
File.open("/etc/init/#{resource[:pattern]}.conf", 'w') { |file| file.write(upstart_template) }
else
file = Puppet::Type.type(:file).new(
:name => "/etc/systemd/system/#{resource[:pattern]}.service",
:ensure => :present,
:content => systemd_template,
:mode => '0644'
)
file.write(file)
File.open("/etc/systemd/system/#{resource[:pattern]}.service", 'w') { |file| file.write(systemd_template) }
systemctl_run('daemon-reload', nil, true)
systemctl_run('enable', [resource[:pattern]], false)
end

View File

@ -44,7 +44,7 @@ describe 'basic swift' do
manage_ring => true,
zone => '2',
storage_local_net_ip => '127.0.0.1',
require => Swift::Storage::Loopback[2] ,
require => Swift::Storage::Loopback['2'] ,
}
class { '::swift::ringbuilder':
part_power => '18',
@ -125,7 +125,7 @@ describe 'basic swift' do
manage_ring => true,
zone => '2',
storage_local_net_ip => '127.0.0.1',
require => Swift::Storage::Loopback[2] ,
require => Swift::Storage::Loopback['2'] ,
}
class { '::swift::storage::account':
service_provider => 'swiftinit',