Method: RightSupport::Net::S3Helper.health_check
- Defined in:
- lib/right_support/net/s3_helper.rb
.health_check ⇒ String or True
Checks if it is possible to connect to the S3 Bucket.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/right_support/net/s3_helper.rb', line 144 def self.health_check config s3 # test config file return 'S3 Config file: Credentials: Syntax error.' unless s3_enabled? ["bucket_name", "master_secret"].each do |conf| return "S3 Config file: #{conf.upcase}: Syntax error." if config[conf].nil? || config[conf] == '' || config[conf] == "@@#{conf.upcase}@@" end # test connection original_text = 'heath check' test_key = 'ping' begin post(test_key, original_text) rescue Exception => e return e. end begin result_text = get(test_key) rescue Exception => e return e. end return 'Sended text and returned one are not equal. Possible master_secret problem' if result_text != original_text # retrurn true if there were not errors true end |