prof 0.34.4 → 0.35.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prof/environment/cloud_foundry.rb +23 -8
- data/lib/prof/environment/pcf_drinks.rb +1 -1
- data/lib/prof/ssh_gateway.rb +18 -13
- data/lib/prof/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4ddd8d05c9400b4e036c41efc1cc02d953def92
|
4
|
+
data.tar.gz: dfb0062b8677454840308cb7ff9164fed7f7c7b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eeb2d83c91ee66cd12cd1d5c02de75fb26e50174b80efbd23ffbb7bd58b5d82f46f53357004210e2d0222d84647c029a6689535140bbae579e6cab96d2b9a28
|
7
|
+
data.tar.gz: 6ed2f347b987fdd1c2daa75f217377da25c8ab62731b3cbc9b50ffe4b30749cd817460bd3acf65f161e5277c151fb8d1b488f43070007ff9c864ac83bff55104
|
@@ -36,10 +36,13 @@ module Prof
|
|
36
36
|
bosh_target: 'https://192.168.50.4:25555',
|
37
37
|
bosh_username: 'admin',
|
38
38
|
bosh_password: 'admin',
|
39
|
+
bosh_ca_cert_path: nil,
|
40
|
+
bosh_env_login: false,
|
39
41
|
|
40
42
|
ssh_gateway_host: '192.168.50.4',
|
41
43
|
ssh_gateway_username: 'vagrant',
|
42
44
|
ssh_gateway_password: 'vagrant',
|
45
|
+
ssh_gateway_private_key: nil,
|
43
46
|
|
44
47
|
bosh_service_broker_job_name:,
|
45
48
|
bosh_manifest_path:,
|
@@ -54,9 +57,12 @@ module Prof
|
|
54
57
|
@bosh_target = bosh_target
|
55
58
|
@bosh_username = bosh_username
|
56
59
|
@bosh_password = bosh_password
|
60
|
+
@bosh_ca_cert_path = bosh_ca_cert_path
|
61
|
+
@bosh_env_login = bosh_env_login
|
57
62
|
@ssh_gateway_host = ssh_gateway_host
|
58
63
|
@ssh_gateway_username = ssh_gateway_username
|
59
64
|
@ssh_gateway_password = ssh_gateway_password
|
65
|
+
@ssh_gateway_private_key = ssh_gateway_private_key
|
60
66
|
@bosh_service_broker_job_name = bosh_service_broker_job_name
|
61
67
|
@bosh_manifest_path = bosh_manifest_path
|
62
68
|
@cloud_foundry_api_url = cloud_foundry_api_url
|
@@ -95,19 +101,28 @@ module Prof
|
|
95
101
|
|
96
102
|
def bosh_director
|
97
103
|
@bosh_director ||= Hula::BoshDirector.new(
|
98
|
-
target_url:
|
99
|
-
username:
|
100
|
-
password:
|
101
|
-
manifest_path:
|
104
|
+
target_url: bosh_target,
|
105
|
+
username: bosh_username,
|
106
|
+
password: bosh_password,
|
107
|
+
manifest_path: bosh_manifest_path,
|
108
|
+
certificate_path: bosh_ca_cert_path,
|
109
|
+
env_login: bosh_env_login
|
102
110
|
)
|
103
111
|
end
|
104
112
|
|
105
113
|
def ssh_gateway
|
106
|
-
|
114
|
+
opts = {
|
107
115
|
gateway_host: ssh_gateway_host,
|
108
116
|
gateway_username: ssh_gateway_username,
|
109
|
-
|
110
|
-
|
117
|
+
}
|
118
|
+
|
119
|
+
if @ssh_gateway_private_key
|
120
|
+
opts[:gateway_private_key] = ssh_gateway_private_key
|
121
|
+
else
|
122
|
+
opts[:gateway_password] = ssh_gateway_password
|
123
|
+
end
|
124
|
+
|
125
|
+
@ssh_gateway ||= Prof::SshGateway.new(opts)
|
111
126
|
end
|
112
127
|
|
113
128
|
def cloud_foundry_uaa
|
@@ -135,7 +150,7 @@ module Prof
|
|
135
150
|
attr_reader :cloud_controller_identity, :cloud_controller_password,
|
136
151
|
:cloud_foundry_username, :cloud_foundry_password, :bosh_target, :bosh_username, :bosh_password,
|
137
152
|
:ssh_gateway_host, :ssh_gateway_username, :ssh_gateway_password, :bosh_manifest_path,
|
138
|
-
:cloud_foundry_api_url, :use_proxy
|
153
|
+
:cloud_foundry_api_url, :use_proxy, :ssh_gateway_private_key, :bosh_ca_cert_path, :bosh_env_login
|
139
154
|
|
140
155
|
def broker_registrar_properties
|
141
156
|
bosh_manifest.job('broker-registrar').properties.fetch('broker')
|
@@ -31,7 +31,7 @@ module Prof
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def cloud_foundry
|
34
|
-
@cloud_foundry ||= CloudFoundry.new(
|
34
|
+
@cloud_foundry ||= Prof::CloudFoundry.new(
|
35
35
|
domain: cloud_foundry_domain,
|
36
36
|
username: ops_manager.cf_admin_credentials.username,
|
37
37
|
password: ops_manager.cf_admin_credentials.password
|
data/lib/prof/ssh_gateway.rb
CHANGED
@@ -15,18 +15,19 @@ require 'uri'
|
|
15
15
|
|
16
16
|
module Prof
|
17
17
|
class SshGateway
|
18
|
-
def initialize(gateway_host:, gateway_username:, gateway_password: nil, ssh_key: nil)
|
19
|
-
@gateway_host
|
18
|
+
def initialize(gateway_host:, gateway_username:, gateway_password: nil, gateway_private_key: nil, ssh_key: nil)
|
19
|
+
@gateway_host = gateway_host
|
20
20
|
@gateway_username = gateway_username
|
21
21
|
@gateway_password = gateway_password
|
22
|
-
@
|
23
|
-
@
|
22
|
+
@gateway_private_key = gateway_private_key
|
23
|
+
@ssh_key = ssh_key
|
24
|
+
@forwards = {}
|
24
25
|
end
|
25
26
|
|
26
27
|
def execute_on(host, cmd, options = {})
|
27
|
-
user
|
28
|
-
password
|
29
|
-
run_as_root
|
28
|
+
user = options.fetch(:user, 'vcap')
|
29
|
+
password = options.fetch(:password, 'c1oudc0w')
|
30
|
+
run_as_root = options.fetch(:root, false)
|
30
31
|
discard_stderr = options.fetch(:discard_stderr, false)
|
31
32
|
|
32
33
|
cmd = "echo -e \"#{password}\\n\" | sudo -S #{cmd}" if run_as_root
|
@@ -82,8 +83,6 @@ module Prof
|
|
82
83
|
|
83
84
|
private
|
84
85
|
|
85
|
-
attr_reader :gateway_username, :gateway_password, :forwards
|
86
|
-
|
87
86
|
def ssh_agent
|
88
87
|
@ssh_agent ||= Net::SSH::Authentication::Agent.connect
|
89
88
|
end
|
@@ -93,15 +92,21 @@ module Prof
|
|
93
92
|
end
|
94
93
|
|
95
94
|
def ssh_gateway
|
95
|
+
opts = { paranoid: false }
|
96
|
+
if @gateway_private_key
|
97
|
+
opts[:keys] = [@gateway_private_key]
|
98
|
+
else
|
99
|
+
opts[:password] = @gateway_password
|
100
|
+
end
|
101
|
+
|
96
102
|
@ssh_gateway ||= Net::SSH::Gateway.new(
|
97
103
|
gateway_host,
|
98
|
-
gateway_username,
|
99
|
-
|
100
|
-
paranoid: false
|
104
|
+
@gateway_username,
|
105
|
+
opts
|
101
106
|
)
|
102
107
|
rescue Net::SSH::AuthenticationFailed
|
103
108
|
message = [
|
104
|
-
"Failed to connect to #{gateway_host}, with #{gateway_username}:#{gateway_password}.",
|
109
|
+
"Failed to connect to #{gateway_host}, with #{@gateway_username}:#{@gateway_password}.",
|
105
110
|
"The ssh-agent has #{ssh_agent.identities.size} identities. Please either add a key, or correct password"
|
106
111
|
].join(' ')
|
107
112
|
raise Net::SSH::AuthenticationFailed, message
|
data/lib/prof/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.35.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CF London
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem-release
|