lib/connection.rb in forj-0.0.43 vs lib/connection.rb in forj-0.0.44

- old
+ new

@@ -15,19 +15,42 @@ # See the License for the specific language governing permissions and # limitations under the License. require 'rubygems' require 'fog' -require 'require_relative' - -require_relative 'yaml_parse.rb' +require 'yaml_parse.rb' include YamlParse # # Connection module # +class SSLErrorMgt + + def initialize() + @iRetry=0 + end + + def ErrorDetected(message,backtrace) + if message.match('SSLv2/v3 read server hello A: unknown protocol') + if @iRetry <5 + sleep(2) + @iRetry+=1 + print "%s/5 try...\r" % @iRetry if $FORJ_LOGGER.level == 0 + return false + else + Logging.error('Too many retry. %s' % message) + return true + end + else + Logging.error("%s\n%s" % [message,backtrace.join("\n")]) + return true + end + end + +end + class ForjConnection attr_accessor :oCompute attr_accessor :oNetwork attr_accessor :sAccountName @@ -101,12 +124,12 @@ creds = File.join($HPC_ACCOUNTS, @sAccountName) if not File.exists?(creds) Logging.fatal(1, "'%s' was not configured. Did you executed 'forj setup %s'? Please do it and retry." % [@sAccountName, @sAccountName]) end - @oConfig.ExtraLoad(creds, :hpc_accounts, @sAccountName) + @oConfig.oConfig.ExtraLoad(creds, :hpc_accounts, @sAccountName) - template = @oConfig.ExtraGet(:hpc_accounts, @sAccountName) + template = @oConfig.oConfig.ExtraGet(:hpc_accounts, @sAccountName) credentials = {} begin credentials['access_key'] = template[:credentials][:account_id] credentials['secret_key'] = template[:credentials][:secret_key] credentials['auth_uri'] = template[:credentials][:auth_uri]