diff --git a/lib/resources/file.rb b/lib/resources/file.rb index bd46b9ac5..3805ffb2c 100644 --- a/lib/resources/file.rb +++ b/lib/resources/file.rb @@ -25,13 +25,13 @@ module Vulcano::Resources end def contain(pattern, from, to) - raise ' not yet implemented ' + fail ' not yet implemented ' end def readable?(by_owner, by_user) if by_user.nil? m = unix_mode_mask(by_owner, 'r') || - raise("#{by_owner} is not a valid unix owner.") + fail("#{by_owner} is not a valid unix owner.") ( @file.mask & m ) != 0 else # TODO: REMOVE THIS FALLBACK @@ -42,7 +42,7 @@ module Vulcano::Resources def writable?(by_owner, by_user) if by_user.nil? m = unix_mode_mask(by_owner, 'w') || - raise("#{by_owner} is not a valid unix owner.") + fail("#{by_owner} is not a valid unix owner.") ( @file.mask & m ) != 0 else # TODO: REMOVE THIS FALLBACK @@ -53,7 +53,7 @@ module Vulcano::Resources def executable?(by_owner, by_user) if by_user.nil? m = unix_mode_mask(by_owner, 'x') || - raise("#{by_owner} is not a valid unix owner.") + fail("#{by_owner} is not a valid unix owner.") ( @file.mask & m ) != 0 else # TODO: REMOVE THIS FALLBACK diff --git a/lib/utils/parseconfig.rb b/lib/utils/parseconfig.rb index 70baabc7a..afeee3558 100644 --- a/lib/utils/parseconfig.rb +++ b/lib/utils/parseconfig.rb @@ -124,7 +124,7 @@ class ParseConfig self.params[param_name].merge!(value) elsif self.params.has_key?(param_name) if self.params[param_name].class != value.class - raise ArgumentError, "#{param_name} already exists, and is of different type!" + fail ArgumentError, "#{param_name} already exists, and is of different type!" end end else diff --git a/lib/vulcano/backend/specinfra.rb b/lib/vulcano/backend/specinfra.rb index 20b0ab4b5..64f4c8e58 100644 --- a/lib/vulcano/backend/specinfra.rb +++ b/lib/vulcano/backend/specinfra.rb @@ -20,7 +20,7 @@ module Vulcano::Backends if self.respond_to?(m.to_sym) self.send(m) else - raise "Cannot configure Specinfra backend #{type}: it isn't supported yet." + fail "Cannot configure Specinfra backend #{type}: it isn't supported yet." end end @@ -92,13 +92,13 @@ module Vulcano::Backends } if host.empty? - raise "You must configure a target host." + fail "You must configure a target host." end unless ssh_opts[:port] > 0 - raise "Port must be > 0 (not #{ssh_opts[:port]})" + fail "Port must be > 0 (not #{ssh_opts[:port]})" end if ssh_opts[:user].to_s.empty? - raise "User must not be empty." + fail "User must not be empty." end unless ssh_opts[:keys].empty? ssh_opts[:auth_methods].push('publickey') @@ -138,13 +138,13 @@ module Vulcano::Backends # validation if host.empty? - raise "You must configure a target host." + fail 'You must configure a target host.' end unless port > 0 - raise "Port must be > 0 (not #{port})" + fail 'Port must be > 0 (not #{port})' end if user.empty? - raise "You must configure a WinRM user for login." + fail 'You must configure a WinRM user for login.' end if pass.empty? raise "You must configure a WinRM password." diff --git a/lib/vulcano/plugins/backend.rb b/lib/vulcano/plugins/backend.rb index 4ff2a0dea..048863431 100644 --- a/lib/vulcano/plugins/backend.rb +++ b/lib/vulcano/plugins/backend.rb @@ -14,7 +14,7 @@ module Vulcano::Plugins %w{ file run_command os }.each do |m| next if obj.public_method_defined?(m.to_sym) obj.send(:define_method, m.to_sym) do |*args| - raise NotImplementedError.new("Backend must implement the #{m}() method.") + fail NotImplementedError.new("Backend must implement the #{m}() method.") end end diff --git a/lib/vulcano/resource.rb b/lib/vulcano/resource.rb index 0399a1804..369d46fba 100644 --- a/lib/vulcano/resource.rb +++ b/lib/vulcano/resource.rb @@ -12,7 +12,7 @@ module Vulcano def self.resource(version) if version != 1 - raise "Only resource version 1 is supported!" + fail 'Only resource version 1 is supported!' end Vulcano::Plugins::Resource end diff --git a/lib/vulcano/runner.rb b/lib/vulcano/runner.rb index d002b466d..b1e2dd4de 100644 --- a/lib/vulcano/runner.rb +++ b/lib/vulcano/runner.rb @@ -53,7 +53,7 @@ module Vulcano # Return on failure if backend_class.nil? - raise "Can't find command backend '#{backend_name}'." + fail "Can't find command backend '#{backend_name}'." end # create the backend based on the config diff --git a/lib/vulcano/targets/folder.rb b/lib/vulcano/targets/folder.rb index e27d49c67..4ee427b32 100644 --- a/lib/vulcano/targets/folder.rb +++ b/lib/vulcano/targets/folder.rb @@ -16,7 +16,7 @@ module Vulcano::Targets # get the dirs helper helper = DirsHelper.getHandler(files) if helper.nil? - raise "Don't know how to handle folder #{target}" + fail "Don't know how to handle folder #{target}" end # get all file contents file_handler = Vulcano::Targets.modules['file'] diff --git a/lib/vulcano/targets/zip.rb b/lib/vulcano/targets/zip.rb index 36b144065..a1955db0d 100644 --- a/lib/vulcano/targets/zip.rb +++ b/lib/vulcano/targets/zip.rb @@ -31,13 +31,12 @@ module Vulcano::Targets files = structure(path) helper = DirsHelper.getHandler(files) if helper.nil? - raise "Don't know how to handle folder #{path}" + fail "Don't know how to handle folder #{path}" end # get all file contents file_handler = Vulcano::Targets.modules['file'] test_files = helper.get_filenames(files) content(path, test_files) end - end end