Sha256: ff7fb00036ef5384dc1dfad72281bb8e99c5301be867d169544b5a8bd58cd4dc

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

module Vagrant
  module Util
    # Helper methods for inspecting guests to determine if specific services
    # or applications are installed and in use
    module GuestInspection
      # Linux specific inspection helpers
      module Linux

        ## systemd helpers

        # systemd is in use
        #
        # @return [Boolean]
        def systemd?(comm)
          comm.test("systemctl | grep '^-\.mount'")
        end

        # systemd hostname set is via hostnamectl
        #
        # @return [Boolean]
        def hostnamectl?(comm)
          comm.test("hostnamectl")
        end

        ## nmcli helpers

        # nmcli is installed
        #
        # @return [Boolean]
        def nmcli?(comm)
          comm.test("nmcli")
        end

        # NetworkManager currently controls device
        #
        # @param comm [Communicator]
        # @param device_name [String]
        # @return [Boolean]
        def nm_controlled?(comm, device_name)
          comm.test("nmcli d show #{device_name}") &&
            !comm.test("nmcli d show #{device_name} | grep unmanaged")
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
vagrant-unbundled-2.0.1.0 lib/vagrant/util/guest_inspection.rb
vagrant-aws-mkubenka-0.7.2.pre.22 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-f3fdbf414272/lib/vagrant/util/guest_inspection.rb
vagrant-aws-mkubenka-0.7.2.pre.16 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-1ee58c40e3f5/lib/vagrant/util/guest_inspection.rb
vagrant-unbundled-2.0.0.1 lib/vagrant/util/guest_inspection.rb