Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 52 lines (44 sloc) 1.38 KB
#!/usr/bin/env ruby
# -*- mode: ruby -*-
#
#
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
require 'bundler/setup'
require 'vcap_services_base'
require 'yaml'
$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
require "swift_service/swift_node"
require 'pry'
def fog_credentials_from_cf_swift_credentials(cf_swift_credentials)
{
:provider => 'HP',
:hp_access_key => cf_swift_credentials["user_name"],
:hp_secret_key => cf_swift_credentials["password"],
:hp_tenant_id => cf_swift_credentials["tenant_id"],
:hp_auth_uri => cf_swift_credentials["authentication_uri"],
:hp_use_upass_auth_style => true,
:hp_avl_zone => cf_swift_credentials["availability_zone"] || "nova",
:hp_auth_version => cf_swift_credentials["authentication_version"].to_sym
}
end
fog_configuration = YAML.load(File.read(File.expand_path("../../config/fog.yml", __FILE__)))
storage_credentials = fog_configuration[:storage]
class FakeLogger
def debug(msg)
puts msg
end
def info(msg)
puts msg
end
def warn(msg)
puts msg
end
def error(msg)
puts msg
end
end
logger = FakeLogger.new
# fog_credentials_from_cf_swift_credentials(
storage = VCAP::Services::Swift::Storage.new(logger, storage_credentials)
identity = VCAP::Services::Swift::Identity.new(logger, fog_configuration[:identity])
binding.pry