Skip to content

Commit

Permalink
Merging nested conditions into outer unless conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis Charreau committed Dec 20, 2023
1 parent 0619a4e commit b322191
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/puppet/provider/elastic_stack_keystore/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@ def self.run_keystore(args, service, stdin = nil)
stdin = File.file?(elastic_keystore_password_file_bak) ? "#{elastic_keystore_password_bak}\n#{elastic_keystore_password}\n#{elastic_keystore_password}" : "#{elastic_keystore_password}\n#{elastic_keystore_password}"
end

unless args[0] == 'passwd' || args[0] == 'has-passwd'
if service == 'elasticsearch' && passwd?(service) && !password.strip.empty?
stdin = stdin.nil? ? password : "#{password}\n#{stdin}"
end
if service == 'elasticsearch' && passwd?(service) && !password.strip.empty? && args[0] != 'passwd' && args[0] != 'has-passwd'
stdin = stdin.nil? ? password : "#{password}\n#{stdin}"
end

unless stdin.nil?
Expand Down

0 comments on commit b322191

Please sign in to comment.