class Dopi::Command::Ssh::FileExists
Public Instance Methods
file()
click to toggle source
# File lib/dopi/command/ssh/file_exists.rb, line 30 def file @file ||= file_valid? ? hash[:file] : nil end
run()
click to toggle source
# File lib/dopi/command/ssh/file_exists.rb, line 21 def run cmd_stdout, cmd_stderr, cmd_exit_code = ssh_command({}, command_string) check_exit_code(cmd_exit_code) end
run_noop()
click to toggle source
# File lib/dopi/command/ssh/file_exists.rb, line 26 def run_noop log(:info, "(NOOP) Executing '#{command_string}' for command #{name}") end
validate()
click to toggle source
# File lib/dopi/command/ssh/file_exists.rb, line 15 def validate validate_ssh validate_exit_code log_validation_method('file_valid?', CommandParsingError) end
Private Instance Methods
command_string()
click to toggle source
# File lib/dopi/command/ssh/file_exists.rb, line 36 def command_string "[ -e #{file} ]" end
file_valid?()
click to toggle source
# File lib/dopi/command/ssh/file_exists.rb, line 40 def file_valid? hash[:file] or raise CommandParsingError, "Plugin #{name}: The key 'file' needs to be specified" begin Pathname.new(hash[:file]).absolute? or raise CommandParsingError, "Plugin #{name}: The path for 'file' has to be absolute" rescue ArgumentError => e raise CommandParsingError, "Plugin #{name}: The value in 'file' is not a valid file path: #{e.message}" end end