Class: Vagrant::Hosts::Fedora
- Defined in:
- lib/vagrant/hosts/fedora.rb
Class Method Summary collapse
- .match? ⇒ Boolean
-
.precedence ⇒ Object
Normal, mid-range precedence.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Fedora
constructor
A new instance of Fedora.
Methods inherited from Linux
#nfs?, #nfs_export, #nfs_prune
Methods included from Util::Retryable
Methods inherited from Base
#nfs?, #nfs_export, #nfs_prune
Constructor Details
#initialize(*args) ⇒ Fedora
Returns a new instance of Fedora.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/vagrant/hosts/fedora.rb', line 23 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 |
Class Method Details
.match? ⇒ Boolean
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/vagrant/hosts/fedora.rb', line 6 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 |
.precedence ⇒ Object
Normal, mid-range precedence.
19 20 21 |
# File 'lib/vagrant/hosts/fedora.rb', line 19 def self.precedence 5 end |