You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: change_host_name.rb
    path of file: ./repos/vagrant/plugins/guests/smartos/cap
    
    the code of the file until where you have to start completion: # Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

module VagrantPlugins
  module GuestSmartos
    module Cap
      class ChangeHostName
        def self.change_host_name(machine, name)
          sudo = machine.config.smartos.suexec_cmd

         
    
        def self.change_host_name(machine, name)
          sudo = machine.config.smartos.suexec_cmd

          machine.communicate.tap do |comm|
            comm.execute <<-EOH.sub(/^ */, '')
              if hostname | grep '#{name}' ; then
                exit 0
              fi

              if [ -d /usbkey ] && [ "$(zonename)" == "global" ] ; then
                #{sudo} sed -i '' 's/hostname=.*/hostname=#{name}/' /usbkey/config
              fi

              #{sudo} echo '#{name}' > /etc/nodename
              #{sudo} hostname #{name}
            EOH
          end
        end