class Dopi::Command::Ssh::FileDeploy
Public Instance Methods
content()
click to toggle source
# File lib/dopi/command/ssh/file_deploy.rb, line 37 def content content_valid? ? load_content(hash[:content]) : nil end
file()
click to toggle source
# File lib/dopi/command/ssh/file_deploy.rb, line 33 def file file_valid? ? hash[:file] : nil end
run()
click to toggle source
# File lib/dopi/command/ssh/file_deploy.rb, line 24 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_deploy.rb, line 29 def run_noop log(:info, "(NOOP) Executing '#{command_string}' for command #{name}") end
validate()
click to toggle source
# File lib/dopi/command/ssh/file_deploy.rb, line 17 def validate validate_ssh validate_exit_code log_validation_method('file_valid?', CommandParsingError) log_validation_method('content_valid?', CommandParsingError) end
Private Instance Methods
command_string()
click to toggle source
# File lib/dopi/command/ssh/file_deploy.rb, line 43 def command_string "echo -n #{Base64.strict_encode64(content)} | base64 -d > #{file}" end
content_valid?()
click to toggle source
# File lib/dopi/command/ssh/file_deploy.rb, line 60 def content_valid? hash[:content] or raise CommandParsingError, "Plugin #{name}: The key 'content' needs to be specified" load_content_valid?(hash[:content]) rescue DopCommon::PlanParsingError => e raise CommandParsingError, "Plugin #{name}: value content not valid: #{e.message}" end
file_valid?()
click to toggle source
# File lib/dopi/command/ssh/file_deploy.rb, line 47 def file_valid? hash[:file] or raise CommandParsingError, "Plugin #{name}: The key 'file' needs to be specified" hash[:file].kind_of?(String) or raise CommandParsingError, "Plugin #{name}: The value for key 'file' has to be a String" 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