replace raise with fail

This commit is contained in:
Christoph Hartmann 2015-09-03 23:24:42 +02:00
parent 556bb5a0f0
commit bbbb8380ca
8 changed files with 17 additions and 18 deletions

View file

@ -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

View file

@ -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

View file

@ -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."

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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']

View file

@ -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