From 3fcd3d691a9effcd54f45c65ae433d62dc271171 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Sun, 31 May 2015 18:56:13 -0700 Subject: [PATCH] Fix syntax errors and style on Fedora flavor cap --- plugins/guests/fedora/cap/flavor.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/guests/fedora/cap/flavor.rb b/plugins/guests/fedora/cap/flavor.rb index 5e36fbcb5..253352f5e 100644 --- a/plugins/guests/fedora/cap/flavor.rb +++ b/plugins/guests/fedora/cap/flavor.rb @@ -4,19 +4,18 @@ module VagrantPlugins class Flavor def self.flavor(machine) # Read the version file - output = "" + version = nil machine.communicate.sudo("grep VERSION_ID /etc/os-release") do |type, data| - output += data if type == :stdout + if type == :stdout + version = data.split("=")[1].chomp.to_i + end 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 + if version.nil? || version < 20 return :fedora + else + return "fedora_#{version}".to_sym end end end