-
Notifications
You must be signed in to change notification settings - Fork 6
/
console
executable file
·52 lines (44 loc) · 1.38 KB
/
console
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/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