Skip to content

Commit

Permalink
Merge pull request #156 from dluxem/issue-134-win-service
Browse files Browse the repository at this point in the history
Fixes Windows issue where filebeats service is reinstalled on each run
  • Loading branch information
vkhatri authored Apr 1, 2020
2 parents 593fc98 + d29dbdf commit a0292dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions resources/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@
source package_file
action :unzip
not_if { ::File.exist?(new_resource.conf_dir + '/install-service-filebeat.ps1') }
notifies :run, 'powershell_script[install filebeat as service]', :immediately
end

powershell_script 'install filebeat as service' do
code "& '#{new_resource.conf_dir}/install-service-filebeat.ps1'"
action :nothing
end
end

Expand Down
3 changes: 2 additions & 1 deletion spec/unit/recipes/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@
end

it 'run powershell_script to install filebeat as service' do
expect(chef_run).to run_powershell_script('install filebeat as service')
expect(chef_run.windows_zipfile('C:/opt/filebeat')).to notify('powershell_script[install filebeat as service]').to(:run).immediately
expect(chef_run).to_not run_powershell_script('install filebeat as service')
end
end

Expand Down

0 comments on commit a0292dc

Please sign in to comment.