module Deployment module Methods module Helper def sendmail(options) Helper.validates_presence_of options[:from], "Mail-FROM not set" Helper.validates_presence_of options[:to], "Mail-TO not set" Helper.validates_presence_of options[:subject], "No mail subject set" Helper.validates_presence_of options[:body], "No mail body set" Helper.validates_presence_of @cdb['smtp_host'], "SMTP host not set" helper = Helper::Mail.new helper.smtp_host = @cdb['smtp_host'] helper.sendmail(options) end def assert_url_response_of(options={}) asserter = Asserter::Url.new asserter.check_protocol = options[:check_protocol] || @cdb['check_protocol'] || "http" asserter.check_host = options[:check_host] || @cdb['check_host'] asserter.check_port = options[:check_port] || @cdb['check_port'] || '80' asserter.check_uri = options[:check_uri] || @cdb['check_uri'] || '/' asserter.check_response_string = options[:chek_response_string] || @cdb['check_response_string'] || 'html' asserter.assert_url_response_of(options) end def report_to_cdb(options={}) reporter = Reporter::Cdb.new reporter.version = @version.to_json reporter.worker = self reporter.set_version(options) end def report_by_mail(options={}) reporter = Reporter::Mail.new reporter.deploy_email_from = options[:deploy_email_from] || @cdb['deploy_email_from'] reporter.deploy_email_to = options[:deploy_email_to] || @cdb['deploy_email_to'] reporter.application_name = options[:application_name] || $recipe_config[:application_name] || @cdb['application_name'] reporter.module_name = options[:module_name] || $recipe_config[:module_name] || @cdb['module_name'] reporter.environment = $recipe_config['ENVIRONMENT'] reporter.version = @version.to_json reporter.worker = self reporter.send(options) end def tomcat_deploy(options={}) publisher = Publisher::Tomcat.new publisher.servers = options[:servers] || @cdb['servers'] publisher.runners = options[:runners] || @cdb['runners'] || publisher.servers publisher.initd_script = options[:initd_script] || @cdb['initd_script'] publisher.application_name = options[:application_name] || $recipe_config[:application_name] || @cdb['application_name'] publisher.catalina_home = options[:catalina_home] || @cdb['catalina_home'] publisher.tomcat_context = options[:tomcat_context] || @cdb['tomcat_context'] publisher.logfilename = options[:logfilename] || @cdb['logfilename'] publisher.check_host = options[:check_host] || @cdb['check_host'] publisher.worker = self publisher.deploy(options) end def samba_mount (remote_path, local_path) smb = Helper::Smb.new smb.remote_path = remote_path smb.local_path = local_path smb.samba_mount() end def samba_umount (local_path) smb = Helper::Smb.new smb.local_path = local_path smb.samba_umount() end end end end