lib/connection.rb in forj-0.0.48 vs lib/connection.rb in forj-1.0.0

- old
+ new

@@ -15,35 +15,33 @@ # See the License for the specific language governing permissions and # limitations under the License. require 'rubygems' require 'fog' -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 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 + else Logging.error('Too many retry. %s' % message) return true end - else + else Logging.error("%s\n%s" % [message,backtrace.join("\n")]) return true end end @@ -56,11 +54,11 @@ attr_accessor :sAccountName def initialize(oConfig, bAutoConnect = true) Logging.fatal(1, 'Internal Error: Missing global $HPC_ACCOUNTS') if not $HPC_ACCOUNTS - + @oConfig = oConfig @sAccountName = @oConfig.get(:account_name) @provider='HP' # TODO: Support multiple provider. (Generic Provider object required) @sAccountName = @oConfig.get(:provider) if not @sAccountName @sAccountName = 'hpcloud' if not @sAccountName @@ -95,10 +93,10 @@ retry end Logging.fatal(1, 'Compute: Unable to connect.', e) end end - + def network_connect # Trying to get Network object oSSLError=SSLErrorMgt.new # Retry object Logging.debug("HP network: Connecting to '%s' - Project '%s'" % [@provider, @credentials['tenant_id']]) begin