Sha256: 5a938617f696b0c14dfe0e0c3ba378a5e2bbe85e6c9e0045c04d212d9f0ca96e

Contents?: true

Size: 669 Bytes

Versions: 2

Compression:

Stored size: 669 Bytes

Contents

require_relative '../../linux/cap/change_host_name'

module VagrantPlugins
  module GuestSUSE
    module Cap
      class ChangeHostName
        extend VagrantPlugins::GuestLinux::Cap::ChangeHostName

        def self.change_host_name?(comm, name)
          basename = name.split(".", 2)[0]
          !comm.test("test \"$(hostnamectl --static status)\" = \"#{basename}\"", sudo: false)
        end

        def self.change_name_command(name)
          basename = name.split(".", 2)[0]
          return <<-EOH.gsub(/^ {14}/, "")
          hostnamectl set-hostname '#{basename}'
          echo #{name} > /etc/HOSTNAME
          EOH
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/plugins/guests/suse/cap/change_host_name.rb
vagrant-unbundled-2.2.10.0 plugins/guests/suse/cap/change_host_name.rb