Sha256: 9684a0182ba42098d0ce7a1c5e4f07e76cb98cf263d590b43d92a0c1e9a380b7

Contents?: true

Size: 1.35 KB

Versions: 12

Compression:

Stored size: 1.35 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") do |f|
            return true if f.gets =~ /^Fedora/
          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") do |f|
            version_number = /Fedora release ([0-9]+)/.match(f.gets)[1].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
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 5 rubygems

Version Path
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/plugins/hosts/fedora/host.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/plugins/hosts/fedora/host.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/plugins/hosts/fedora/host.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/plugins/hosts/fedora/host.rb
tnargav-1.2.2 plugins/hosts/fedora/host.rb
vagrantup-1.1.3 plugins/hosts/fedora/host.rb
vagrantup-1.1.2 plugins/hosts/fedora/host.rb
vagrantup-1.1.1 plugins/hosts/fedora/host.rb
vagrantup-1.1.0 plugins/hosts/fedora/host.rb
vagrantup-1.1.4 plugins/hosts/fedora/host.rb
vagrant-actionio-0.0.9 vendor/bundle/bundler/gems/vagrant-c74251a1d9c0/plugins/hosts/fedora/host.rb
vagrant-lxc-0.0.1 vendor/vagrant/plugins/hosts/fedora/host.rb