From efd7b459dd999ef3177cb519d6beb809bb4e4d93 Mon Sep 17 00:00:00 2001 From: langdon Date: Thu, 30 Oct 2014 15:36:06 -0400 Subject: [PATCH] Add more capabilities for Fedora guests --- plugins/guests/fedora/cap/flavor.rb | 25 +++++++++++++++++++++++++ plugins/guests/fedora/cap/nfs_client.rb | 13 +++++++++++++ plugins/guests/fedora/plugin.rb | 10 ++++++++++ 3 files changed, 48 insertions(+) create mode 100644 plugins/guests/fedora/cap/flavor.rb create mode 100644 plugins/guests/fedora/cap/nfs_client.rb diff --git a/plugins/guests/fedora/cap/flavor.rb b/plugins/guests/fedora/cap/flavor.rb new file mode 100644 index 000000000..5e36fbcb5 --- /dev/null +++ b/plugins/guests/fedora/cap/flavor.rb @@ -0,0 +1,25 @@ +module VagrantPlugins + module GuestFedora + module Cap + class Flavor + def self.flavor(machine) + # Read the version file + output = "" + machine.communicate.sudo("grep VERSION_ID /etc/os-release") do |type, data| + output += data if type == :stdout + end + version = output.split("=")[1].chomp!.to_i + + # Detect various flavors we care about + if version >= 20 + return :"fedora_#{version}" + else if version >= 20 + return :"fedora_#{version}" + else + return :fedora + end + end + end + end + end +end diff --git a/plugins/guests/fedora/cap/nfs_client.rb b/plugins/guests/fedora/cap/nfs_client.rb new file mode 100644 index 000000000..4c8e6a546 --- /dev/null +++ b/plugins/guests/fedora/cap/nfs_client.rb @@ -0,0 +1,13 @@ +module VagrantPlugins + module GuestFedora + module Cap + class NFSClient + def self.nfs_client_install(machine) + machine.communicate.tap do |comm| + comm.sudo("yum -y install nfs-utils nfs-utils-lib") + end + end + end + end + end +end diff --git a/plugins/guests/fedora/plugin.rb b/plugins/guests/fedora/plugin.rb index 66b2d111f..78e376f96 100644 --- a/plugins/guests/fedora/plugin.rb +++ b/plugins/guests/fedora/plugin.rb @@ -25,6 +25,16 @@ module VagrantPlugins require_relative "cap/network_scripts_dir" Cap::NetworkScriptsDir end + + guest_capability("fedora", "flavor") do + require_relative "cap/flavor" + Cap::Flavor + end + + guest_capability("fedora", "nfs_client_install") do + require_relative "cap/nfs_client" + Cap::NFSClient + end end end end