Skip to content

Commit 3bc498b

Browse files
author
Gavin Williams
committed
Ensure that command failures get reported
1 parent 7be1de7 commit 3bc498b

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

lib/puppet/provider/elastic_user_command.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ def self.homedir
1818
# Run the user management command with specified tool arguments.
1919
def self.command_with_path(args, configdir = nil)
2020
options = {
21+
:combine => true,
2122
:custom_environment => {
2223
'ES_PATH_CONF' => configdir || '/etc/elasticsearch'
23-
}
24+
},
25+
:failonfail => true
2426
}
2527

2628
execute(

lib/puppet/provider/elasticsearch_keystore/ruby.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ def self.home_dir
2828
def self.run_keystore(args, instance, configdir = '/etc/elasticsearch', stdin = nil)
2929
options = {
3030
:custom_environment => {
31-
'ES_INCLUDE' => File.join(defaults_dir, "elasticsearch-#{instance}"),
31+
'ES_INCLUDE' => File.join(defaults_dir, "elasticsearch-#{instance}"),
3232
'ES_PATH_CONF' => "#{configdir}/#{instance}"
3333
},
34-
:uid => 'elasticsearch',
35-
:gid => 'elasticsearch'
34+
:uid => 'elasticsearch',
35+
:gid => 'elasticsearch',
36+
:failonfail => true
3637
}
3738

3839
unless stdin.nil?

spec/unit/provider/elasticsearch_keystore/elasticsearch_keystore_spec.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353
'ES_INCLUDE' => defaults_file,
5454
'ES_PATH_CONF' => "/etc/elasticsearch/#{instance}"
5555
},
56-
:uid => 'elasticsearch', :gid => 'elasticsearch'
56+
:uid => 'elasticsearch',
57+
:gid => 'elasticsearch',
58+
:failonfail => true
5759
)
5860
.and_return(
5961
Puppet::Util::Execution::ProcessOutput.new(
@@ -113,7 +115,9 @@
113115
'ES_INCLUDE' => '/etc/default/elasticsearch-es-03',
114116
'ES_PATH_CONF' => '/etc/elasticsearch/es-03'
115117
},
116-
:uid => 'elasticsearch', :gid => 'elasticsearch'
118+
:uid => 'elasticsearch',
119+
:gid => 'elasticsearch',
120+
:failonfail => true
117121
)
118122
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
119123
)

0 commit comments

Comments
 (0)