Skip to content

Commit

Permalink
Fix windows ruby 3.1 matcher
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Powell <[email protected]>
  • Loading branch information
tpowell-progress committed Mar 1, 2024
1 parent ccaa8a4 commit 451e583
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions lib/chef/resource/private_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def create_key(regenerate, action)
converge_by "change format of #{new_resource.type} private key #{new_path} from #{current_resource.format} to #{new_resource.format}" do
write_private_key(current_private_key)
end
elsif RUBY_PLATFORM !~ /mswin|mingw32|windows/ && (@current_file_mode & 0077) != 0
elsif RUBY_PLATFORM !~ /mswin|mingw|windows/ && (@current_file_mode & 0077) != 0
new_mode = @current_file_mode & 07700
converge_by "change mode of private key #{new_path} to #{new_mode.to_s(8)}" do
::File.chmod(new_mode, new_path)
Expand Down Expand Up @@ -197,36 +197,25 @@ def new_path
end

def new_key_with_path
puts caller
puts "<<<< new resource >>>>"
puts new_resource.inspect
path = new_resource.path
things = if path.is_a?(Symbol)

Check warning on line 201 in lib/chef/resource/private_key.rb

View workflow job for this annotation

GitHub Actions / chefstyle

Lint/UselessAssignment: Useless assignment to variable - things.
puts ">> is a symbol"
[ nil, path ]

Check failure on line 202 in lib/chef/resource/private_key.rb

View workflow job for this annotation

GitHub Actions / chefstyle

[Correctable] Layout/IndentationWidth: Use 2 (not -7) spaces for indentation.
elsif Pathname.new(path).relative?

Check failure on line 203 in lib/chef/resource/private_key.rb

View workflow job for this annotation

GitHub Actions / chefstyle

[Correctable] Layout/ElseAlignment: Align elsif with if.
puts ">> relative"
private_key, private_key_path = Cheffish.get_private_key_with_path(path, run_context.config)
puts "private_key, private_key_path = #{private_key}, #{private_key_path} "
if private_key
puts ">> private_key"
[ private_key, (private_key_path || :none) ]
elsif run_context.config[:private_key_write_path]
puts ">> else private_key"
@should_create_directory = true
path = ::File.join(run_context.config[:private_key_write_path], path)
[ nil, path ]
else
raise "Could not find key #{path} and Chef::Config.private_key_write_path is not set."
end
elsif ::File.exist?(path)

Check failure on line 214 in lib/chef/resource/private_key.rb

View workflow job for this annotation

GitHub Actions / chefstyle

[Correctable] Layout/ElseAlignment: Align elsif with if.
puts ">> file exist"
[ IO.read(path), path ]
else

Check failure on line 216 in lib/chef/resource/private_key.rb

View workflow job for this annotation

GitHub Actions / chefstyle

[Correctable] Layout/ElseAlignment: Align else with if.
puts ">> else nil"
[ nil, path ]
end

Check warning on line 218 in lib/chef/resource/private_key.rb

View workflow job for this annotation

GitHub Actions / chefstyle

[Correctable] Layout/EndAlignment: end at 218, 10 is not aligned with if at 201, 19.
# things.tap { |x| puts "new_key_with_path #{x}"; puts caller }
end

def load_current_resource
Expand Down Expand Up @@ -259,9 +248,6 @@ def load_current_resource
else
resource.action :delete
end
puts caller
puts "<<<< current resource >>>>"
puts resource.inspect
@current_resource = resource
end
end
Expand Down

0 comments on commit 451e583

Please sign in to comment.