Sha256: f252c4cf4eac8844c6c2db3d1f0b5ee330cdde34c7d0d8a43ff25a3c946542fc

Contents?: true

Size: 1.74 KB

Versions: 6

Compression:

Stored size: 1.74 KB

Contents

require "pathname"

require "vagrant"

require Vagrant.source_root.join("plugins/hosts/linux/host")

module VagrantPlugins
  module HostFedora
    class Host < VagrantPlugins::HostLinux::Host
      def self.match?
        release_file = Pathname.new("/etc/redhat-release")

        if release_file.exist?
          release_file.open("r:ISO-8859-1:UTF-8") do |f|
            contents = f.gets
            return true if contents =~ /^Fedora/
            return true if contents =~ /^CentOS/
            return true if contents =~ /^Red Hat Enterprise Linux Server/
          end
        end

        false
      end

      # Normal, mid-range precedence.
      def self.precedence
        5
      end

      def initialize(*args)
        super

        nfs_server_binary = "/etc/init.d/nfs"

        # On Fedora 16+, systemd replaced init.d, so we have to use the
        # proper NFS binary. This checks to see if we need to do that.
        release_file = Pathname.new("/etc/redhat-release")
        begin
          release_file.open("r:ISO-8859-1:UTF-8") do |f|
            version_number = /(CentOS|Fedora|Red Hat Enterprise Linux Server).*release ([0-9]+)/.match(f.gets)[2].to_i
            if version_number >= 16
              # "service nfs-server" will redirect properly to systemctl
              # when "service nfs-server restart" is called.
              nfs_server_binary = "/usr/sbin/service nfs-server"
            end
          end
        rescue Errno::ENOENT
          # File doesn't exist, not a big deal, assume we're on a
          # lower version.
        end
        @nfs_apply_command = "/usr/sbin/exportfs -r"
        @nfs_check_command = "#{nfs_server_binary} status"
        @nfs_start_command = "#{nfs_server_binary} start"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/plugins/hosts/fedora/host.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/plugins/hosts/fedora/host.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/plugins/hosts/fedora/host.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/plugins/hosts/fedora/host.rb
tnargav-1.3.6 plugins/hosts/fedora/host.rb
tnargav-1.3.3 plugins/hosts/fedora/host.rb