<commit_before>require 'chef/provider/lwrp_base'
require 'cheffish/cheffish_server_api'

class Chef::Provider::MachineExecute < Chef::Provider::LWRPBase

  use_inline_resources

  def whyrun_supported?
    true
  end

  def machine
    @machine ||= begin
      if new_resource.machine.kind_of?(ChefMetal::Machine)
        new_resource.machine
      else
        # TODO this is inefficient, can we cache or something?
        node = Cheffish::CheffishServerAPI.new(new_resource.chef_server).get("/nodes/#{new_resource.machine}")
        new_resource.provisioner.connect_to_machine(node)
      end
    end
  end

  action :run do
    machine.execute(self, new_resource.command)
  end
end<commit_msg>Apply the same fix from machine_file to machine_execute<commit_after>require 'chef/provider/lwrp_base'
require 'cheffish/cheffish_server_api'

class Chef::Provider::MachineExecute < Chef::Provider::LWRPBase

  include ChefMetal::ProviderActionHandler

  use_inline_resources

  def whyrun_supported?
    true
  end

  def machine
    @machine ||= begin
      if new_resource.machine.kind_of?(ChefMetal::Machine)
        new_resource.machine
      else
        # TODO this is inefficient, can we cache or something?
        node = Cheffish::CheffishServerAPI.new(new_resource.chef_server).get("/nodes/#{new_resource.machine}")
        new_resource.provisioner.connect_to_machine(node)
      end
    end
  end

  action :run do
    machine.execute(self, new_resource.command)
  end
end
{'fraction_non_alphanumeric': 0.08648648648648649, 'fraction_numerical': 0.0, 'mean_word_length': 3.855737704918033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6327661', 'n_tokens_mistral': 474, 'n_tokens_neox': 461, 'n_words': 92}