vcap_common 2.0.11 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/bin/fetch_gems +63 -0
- data/bin/transform_git_source +161 -0
- data/lib/cf/version.rb +3 -0
- data/lib/json_message.rb +2 -4
- data/lib/services/api/clients/service_gateway_client.rb +90 -75
- data/lib/services/api/messages.rb +28 -23
- data/lib/vcap/common.rb +20 -3
- data/lib/vcap/component.rb +37 -34
- data/lib/vcap/stats.rb +106 -0
- metadata +112 -51
- data/lib/vcap/user_pools/user_ops.rb +0 -47
- data/lib/vcap/user_pools/user_pool.rb +0 -45
- data/lib/vcap/user_pools/user_pool_util.rb +0 -107
data/lib/vcap/component.rb
CHANGED
@@ -6,7 +6,7 @@ require "nats/client"
|
|
6
6
|
require "set"
|
7
7
|
require "thin"
|
8
8
|
require "yajl"
|
9
|
-
require "
|
9
|
+
require "vcap/stats"
|
10
10
|
|
11
11
|
module VCAP
|
12
12
|
|
@@ -47,42 +47,46 @@ module VCAP
|
|
47
47
|
class Component
|
48
48
|
|
49
49
|
# We will suppress these from normal varz reporting by default.
|
50
|
-
CONFIG_SUPPRESS = Set.new([:mbus, :service_mbus, :keys, :database_environment, :password, :pass, :token])
|
50
|
+
CONFIG_SUPPRESS = Set.new([:message_bus_servers, :mbus, :service_mbus, :keys, :database_environment, :password, :pass, :token])
|
51
51
|
|
52
|
-
class
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
52
|
+
class SafeHash < BasicObject
|
53
|
+
def initialize(hash = {})
|
54
|
+
@hash = hash
|
55
|
+
end
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
def class
|
58
|
+
SafeHash
|
59
|
+
end
|
60
|
+
|
61
|
+
def threadsafe!
|
62
|
+
@monitor = ::Monitor.new
|
63
|
+
end
|
61
64
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
65
|
+
def synchronize
|
66
|
+
if @monitor
|
67
|
+
@monitor.synchronize do
|
68
|
+
begin
|
69
|
+
@thread = ::Thread.current
|
70
|
+
yield
|
71
|
+
ensure
|
72
|
+
@thread = nil
|
71
73
|
end
|
72
|
-
else
|
73
|
-
yield
|
74
74
|
end
|
75
|
+
else
|
76
|
+
yield
|
75
77
|
end
|
78
|
+
end
|
76
79
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
@hash.__send__(sym, *args, &blk)
|
80
|
+
def method_missing(sym, *args, &blk)
|
81
|
+
if @monitor && @thread != ::Thread.current
|
82
|
+
::Kernel.raise "Lock required"
|
83
83
|
end
|
84
|
+
|
85
|
+
@hash.__send__(sym, *args, &blk)
|
84
86
|
end
|
87
|
+
end
|
85
88
|
|
89
|
+
class << self
|
86
90
|
def varz
|
87
91
|
@varz ||= SafeHash.new
|
88
92
|
end
|
@@ -93,8 +97,7 @@ module VCAP
|
|
93
97
|
@last_varz_update ||= 0
|
94
98
|
|
95
99
|
if Time.now.to_f - @last_varz_update >= 1
|
96
|
-
|
97
|
-
rss, pcpu = `ps -o rss=,pcpu= -p #{Process.pid}`.split
|
100
|
+
rss, pcpu = Stats.process_memory_and_cpu
|
98
101
|
|
99
102
|
# Update varz
|
100
103
|
varz.synchronize do
|
@@ -104,11 +107,10 @@ module VCAP
|
|
104
107
|
varz[:mem] = rss.to_i
|
105
108
|
varz[:cpu] = pcpu.to_f
|
106
109
|
|
107
|
-
|
108
|
-
varz[:
|
109
|
-
varz[:mem_free_bytes] = memory.inactive_bytes + memory.free_bytes
|
110
|
+
varz[:mem_used_bytes] = Stats.memory_used_bytes
|
111
|
+
varz[:mem_free_bytes] = Stats.memory_free_bytes
|
110
112
|
|
111
|
-
varz[:cpu_load_avg] =
|
113
|
+
varz[:cpu_load_avg] = Stats.cpu_load_average
|
112
114
|
|
113
115
|
# Return duplicate while holding lock
|
114
116
|
return varz.dup
|
@@ -181,7 +183,7 @@ module VCAP
|
|
181
183
|
varz.merge!(@discover.dup)
|
182
184
|
varz[:num_cores] = VCAP.num_cores
|
183
185
|
varz[:config] = sanitize_config(opts[:config]) if opts[:config]
|
184
|
-
varz[:
|
186
|
+
varz[:log_counts] = log_counter if log_counter
|
185
187
|
end
|
186
188
|
|
187
189
|
@healthz = "ok\n".freeze
|
@@ -229,6 +231,7 @@ module VCAP
|
|
229
231
|
clear_level(config)
|
230
232
|
config
|
231
233
|
end
|
234
|
+
|
232
235
|
end
|
233
236
|
end
|
234
237
|
end
|
data/lib/vcap/stats.rb
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'vcap/common'
|
2
|
+
require 'vmstat'
|
3
|
+
|
4
|
+
module VCAP
|
5
|
+
class Stats
|
6
|
+
class << self
|
7
|
+
def process_memory_and_cpu
|
8
|
+
if WINDOWS
|
9
|
+
rss = windows_process_memory
|
10
|
+
pcpu = windows_process_cpu
|
11
|
+
else
|
12
|
+
rss, pcpu = `ps -o rss=,pcpu= -p #{Process.pid}`.split
|
13
|
+
end
|
14
|
+
[rss, pcpu]
|
15
|
+
end
|
16
|
+
|
17
|
+
def memory_used_bytes
|
18
|
+
if WINDOWS
|
19
|
+
mem = windows_memory_used
|
20
|
+
mem[:total] - mem[:available]
|
21
|
+
else
|
22
|
+
mem = Vmstat.memory
|
23
|
+
mem.active_bytes + mem.wired_bytes
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def memory_free_bytes
|
28
|
+
if WINDOWS
|
29
|
+
mem = windows_memory_used
|
30
|
+
mem[:available]
|
31
|
+
else
|
32
|
+
mem = Vmstat.memory
|
33
|
+
mem.inactive_bytes + mem.free_bytes
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def cpu_load_average
|
38
|
+
if WINDOWS
|
39
|
+
windows_cpu_load
|
40
|
+
else
|
41
|
+
Vmstat.load_average.one_minute
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def windows_memory_used
|
48
|
+
mem_ary = system_memory_list.split
|
49
|
+
mem = Hash.new
|
50
|
+
mem[:total] = (mem_ary[3].gsub(',', '').to_i * 1024) * 1024
|
51
|
+
mem[:available] = (mem_ary[8].gsub(',', '').to_i * 1024) * 1024
|
52
|
+
mem
|
53
|
+
end
|
54
|
+
|
55
|
+
def windows_cpu_load
|
56
|
+
avg_load = %x[powershell -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned "Get-WmiObject win32_processor | Measure-Object -property LoadPercentage -Average | Foreach {$_.Average}"]
|
57
|
+
avg_load.to_i
|
58
|
+
end
|
59
|
+
|
60
|
+
def windows_process_memory
|
61
|
+
out_ary = memory_list.split
|
62
|
+
out_ary[4].delete(',').to_i
|
63
|
+
end
|
64
|
+
|
65
|
+
def windows_process_cpu
|
66
|
+
pcpu = 0
|
67
|
+
process_ary = process_list
|
68
|
+
pid = Process.pid
|
69
|
+
idx_of_process = -1
|
70
|
+
process_line_ary = process_ary.split("\n")
|
71
|
+
ary_to_search = process_line_ary[2].split(',')
|
72
|
+
ary_to_search.each_with_index { |val, idx|
|
73
|
+
pid_s = val.gsub(/"/, '')
|
74
|
+
pid_to_i = pid_s.to_i
|
75
|
+
if pid == pid_to_i
|
76
|
+
idx_of_process = idx
|
77
|
+
end
|
78
|
+
}
|
79
|
+
if idx_of_process >= 0
|
80
|
+
cpu_ary = process_time
|
81
|
+
cpu_line_ary = cpu_ary.split("\n")
|
82
|
+
ary_to_search = cpu_line_ary[2].split(',')
|
83
|
+
cpu = ary_to_search[idx_of_process]
|
84
|
+
pcpu = cpu.gsub(/"/, '').to_f
|
85
|
+
end
|
86
|
+
pcpu
|
87
|
+
end
|
88
|
+
|
89
|
+
def system_memory_list
|
90
|
+
%x[systeminfo | findstr "\\<Physical Memory>\\"]
|
91
|
+
end
|
92
|
+
|
93
|
+
def memory_list
|
94
|
+
%x[tasklist /nh /fi "pid eq #{Process.pid}"]
|
95
|
+
end
|
96
|
+
|
97
|
+
def process_time
|
98
|
+
%x[typeperf -sc 1 "\\Process(ruby*)\\% processor time"]
|
99
|
+
end
|
100
|
+
|
101
|
+
def process_list
|
102
|
+
%x[typeperf -sc 1 "\\Process(ruby*)\\ID Process"]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcap_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 3.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
7
|
+
- Cloud Foundry Core Team
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: eventmachine
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: thin
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: yajl-ruby
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,23 +55,26 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: nats
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.5.0.beta.12
|
62
|
+
- - <
|
68
63
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
64
|
+
version: '0.6'
|
70
65
|
type: :runtime
|
71
66
|
prerelease: false
|
72
67
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
68
|
requirements:
|
75
|
-
- -
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 0.5.0.beta.12
|
72
|
+
- - <
|
76
73
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.
|
74
|
+
version: '0.6'
|
78
75
|
- !ruby/object:Gem::Dependency
|
79
76
|
name: posix-spawn
|
80
77
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
78
|
requirements:
|
83
79
|
- - ~>
|
84
80
|
- !ruby/object:Gem::Version
|
@@ -86,7 +82,6 @@ dependencies:
|
|
86
82
|
type: :runtime
|
87
83
|
prerelease: false
|
88
84
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
85
|
requirements:
|
91
86
|
- - ~>
|
92
87
|
- !ruby/object:Gem::Version
|
@@ -94,7 +89,6 @@ dependencies:
|
|
94
89
|
- !ruby/object:Gem::Dependency
|
95
90
|
name: membrane
|
96
91
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
92
|
requirements:
|
99
93
|
- - ~>
|
100
94
|
- !ruby/object:Gem::Version
|
@@ -102,7 +96,6 @@ dependencies:
|
|
102
96
|
type: :runtime
|
103
97
|
prerelease: false
|
104
98
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
99
|
requirements:
|
107
100
|
- - ~>
|
108
101
|
- !ruby/object:Gem::Version
|
@@ -110,7 +103,6 @@ dependencies:
|
|
110
103
|
- !ruby/object:Gem::Dependency
|
111
104
|
name: httpclient
|
112
105
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
106
|
requirements:
|
115
107
|
- - ! '>='
|
116
108
|
- !ruby/object:Gem::Version
|
@@ -118,7 +110,6 @@ dependencies:
|
|
118
110
|
type: :runtime
|
119
111
|
prerelease: false
|
120
112
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
113
|
requirements:
|
123
114
|
- - ! '>='
|
124
115
|
- !ruby/object:Gem::Version
|
@@ -126,7 +117,6 @@ dependencies:
|
|
126
117
|
- !ruby/object:Gem::Dependency
|
127
118
|
name: em-http-request
|
128
119
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
120
|
requirements:
|
131
121
|
- - ~>
|
132
122
|
- !ruby/object:Gem::Version
|
@@ -134,7 +124,6 @@ dependencies:
|
|
134
124
|
type: :runtime
|
135
125
|
prerelease: false
|
136
126
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
127
|
requirements:
|
139
128
|
- - ~>
|
140
129
|
- !ruby/object:Gem::Version
|
@@ -142,7 +131,6 @@ dependencies:
|
|
142
131
|
- !ruby/object:Gem::Dependency
|
143
132
|
name: multipart-post
|
144
133
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
134
|
requirements:
|
147
135
|
- - ! '>='
|
148
136
|
- !ruby/object:Gem::Version
|
@@ -150,7 +138,6 @@ dependencies:
|
|
150
138
|
type: :runtime
|
151
139
|
prerelease: false
|
152
140
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
141
|
requirements:
|
155
142
|
- - ! '>='
|
156
143
|
- !ruby/object:Gem::Version
|
@@ -158,7 +145,6 @@ dependencies:
|
|
158
145
|
- !ruby/object:Gem::Dependency
|
159
146
|
name: mime-types
|
160
147
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
148
|
requirements:
|
163
149
|
- - ! '>='
|
164
150
|
- !ruby/object:Gem::Version
|
@@ -166,7 +152,20 @@ dependencies:
|
|
166
152
|
type: :runtime
|
167
153
|
prerelease: false
|
168
154
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: uuidtools
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
169
|
requirements:
|
171
170
|
- - ! '>='
|
172
171
|
- !ruby/object:Gem::Version
|
@@ -174,7 +173,6 @@ dependencies:
|
|
174
173
|
- !ruby/object:Gem::Dependency
|
175
174
|
name: vmstat
|
176
175
|
requirement: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
176
|
requirements:
|
179
177
|
- - ~>
|
180
178
|
- !ruby/object:Gem::Version
|
@@ -182,31 +180,69 @@ dependencies:
|
|
182
180
|
type: :runtime
|
183
181
|
prerelease: false
|
184
182
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
183
|
requirements:
|
187
184
|
- - ~>
|
188
185
|
- !ruby/object:Gem::Version
|
189
186
|
version: '2.0'
|
190
187
|
- !ruby/object:Gem::Dependency
|
191
|
-
name:
|
188
|
+
name: squash_ruby
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ! '>='
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
type: :runtime
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ! '>='
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: addressable
|
192
203
|
requirement: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
204
|
requirements:
|
195
205
|
- - ~>
|
196
206
|
- !ruby/object:Gem::Version
|
197
|
-
version:
|
198
|
-
type: :
|
207
|
+
version: '2.2'
|
208
|
+
type: :runtime
|
199
209
|
prerelease: false
|
200
210
|
version_requirements: !ruby/object:Gem::Requirement
|
201
|
-
none: false
|
202
211
|
requirements:
|
203
212
|
- - ~>
|
204
213
|
- !ruby/object:Gem::Version
|
205
|
-
version:
|
214
|
+
version: '2.2'
|
215
|
+
- !ruby/object:Gem::Dependency
|
216
|
+
name: steno
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
type: :runtime
|
223
|
+
prerelease: false
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - ! '>='
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0'
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: rake
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - ! '>='
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '0'
|
236
|
+
type: :development
|
237
|
+
prerelease: false
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - ! '>='
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '0'
|
206
243
|
- !ruby/object:Gem::Dependency
|
207
244
|
name: rspec
|
208
245
|
requirement: !ruby/object:Gem::Requirement
|
209
|
-
none: false
|
210
246
|
requirements:
|
211
247
|
- - ! '>='
|
212
248
|
- !ruby/object:Gem::Version
|
@@ -214,7 +250,6 @@ dependencies:
|
|
214
250
|
type: :development
|
215
251
|
prerelease: false
|
216
252
|
version_requirements: !ruby/object:Gem::Requirement
|
217
|
-
none: false
|
218
253
|
requirements:
|
219
254
|
- - ! '>='
|
220
255
|
- !ruby/object:Gem::Version
|
@@ -222,7 +257,6 @@ dependencies:
|
|
222
257
|
- !ruby/object:Gem::Dependency
|
223
258
|
name: sinatra
|
224
259
|
requirement: !ruby/object:Gem::Requirement
|
225
|
-
none: false
|
226
260
|
requirements:
|
227
261
|
- - ! '>='
|
228
262
|
- !ruby/object:Gem::Version
|
@@ -230,25 +264,55 @@ dependencies:
|
|
230
264
|
type: :development
|
231
265
|
prerelease: false
|
232
266
|
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
|
267
|
+
requirements:
|
268
|
+
- - ! '>='
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: '0'
|
271
|
+
- !ruby/object:Gem::Dependency
|
272
|
+
name: webmock
|
273
|
+
requirement: !ruby/object:Gem::Requirement
|
274
|
+
requirements:
|
275
|
+
- - ! '>='
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: '0'
|
278
|
+
type: :development
|
279
|
+
prerelease: false
|
280
|
+
version_requirements: !ruby/object:Gem::Requirement
|
281
|
+
requirements:
|
282
|
+
- - ! '>='
|
283
|
+
- !ruby/object:Gem::Version
|
284
|
+
version: '0'
|
285
|
+
- !ruby/object:Gem::Dependency
|
286
|
+
name: debugger
|
287
|
+
requirement: !ruby/object:Gem::Requirement
|
288
|
+
requirements:
|
289
|
+
- - ! '>='
|
290
|
+
- !ruby/object:Gem::Version
|
291
|
+
version: '0'
|
292
|
+
type: :development
|
293
|
+
prerelease: false
|
294
|
+
version_requirements: !ruby/object:Gem::Requirement
|
234
295
|
requirements:
|
235
296
|
- - ! '>='
|
236
297
|
- !ruby/object:Gem::Version
|
237
298
|
version: '0'
|
238
299
|
description: common vcap classes/methods
|
239
300
|
email:
|
240
|
-
-
|
301
|
+
- vcap-dev@googlegroups.com
|
241
302
|
executables: []
|
242
303
|
extensions: []
|
243
304
|
extra_rdoc_files: []
|
244
305
|
files:
|
306
|
+
- bin/fetch_gems
|
307
|
+
- bin/transform_git_source
|
308
|
+
- lib/cf/version.rb
|
245
309
|
- lib/json_message.rb
|
310
|
+
- lib/services/api.rb
|
246
311
|
- lib/services/api/async_requests.rb
|
247
312
|
- lib/services/api/clients/service_gateway_client.rb
|
248
313
|
- lib/services/api/const.rb
|
249
314
|
- lib/services/api/messages.rb
|
250
315
|
- lib/services/api/util.rb
|
251
|
-
- lib/services/api.rb
|
252
316
|
- lib/vcap/common.rb
|
253
317
|
- lib/vcap/component.rb
|
254
318
|
- lib/vcap/config.rb
|
@@ -259,35 +323,32 @@ files:
|
|
259
323
|
- lib/vcap/rolling_metric.rb
|
260
324
|
- lib/vcap/sorted_set_utils.rb
|
261
325
|
- lib/vcap/spec/em.rb
|
326
|
+
- lib/vcap/spec/forked_component.rb
|
262
327
|
- lib/vcap/spec/forked_component/base.rb
|
263
328
|
- lib/vcap/spec/forked_component/nats_server.rb
|
264
|
-
- lib/vcap/
|
329
|
+
- lib/vcap/stats.rb
|
265
330
|
- lib/vcap/subprocess.rb
|
266
|
-
|
267
|
-
- lib/vcap/user_pools/user_pool.rb
|
268
|
-
- lib/vcap/user_pools/user_pool_util.rb
|
269
|
-
homepage: http://github.com/vmware-ac/core
|
331
|
+
homepage: http://github.com/cloudfoundry/vcap-common
|
270
332
|
licenses: []
|
333
|
+
metadata: {}
|
271
334
|
post_install_message:
|
272
335
|
rdoc_options: []
|
273
336
|
require_paths:
|
274
337
|
- lib
|
275
338
|
required_ruby_version: !ruby/object:Gem::Requirement
|
276
|
-
none: false
|
277
339
|
requirements:
|
278
340
|
- - ! '>='
|
279
341
|
- !ruby/object:Gem::Version
|
280
342
|
version: '0'
|
281
343
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
282
|
-
none: false
|
283
344
|
requirements:
|
284
345
|
- - ! '>='
|
285
346
|
- !ruby/object:Gem::Version
|
286
347
|
version: '0'
|
287
348
|
requirements: []
|
288
349
|
rubyforge_project:
|
289
|
-
rubygems_version:
|
350
|
+
rubygems_version: 2.2.2
|
290
351
|
signing_key:
|
291
|
-
specification_version:
|
352
|
+
specification_version: 4
|
292
353
|
summary: vcap common
|
293
354
|
test_files: []
|
@@ -1,47 +0,0 @@
|
|
1
|
-
$:.unshift(File.join(File.dirname(__FILE__),'../../common/lib'))
|
2
|
-
$:.unshift(File.join(File.dirname(__FILE__)))
|
3
|
-
|
4
|
-
require 'logger'
|
5
|
-
require 'vcap/subprocess'
|
6
|
-
|
7
|
-
module VCAP
|
8
|
-
module UserOps
|
9
|
-
class << self
|
10
|
-
def run(cmd, expected_exit_status = 0)
|
11
|
-
result = VCAP::Subprocess.run(cmd, expected_exit_status)
|
12
|
-
end
|
13
|
-
|
14
|
-
def group_exists?(name)
|
15
|
-
found = false
|
16
|
-
Etc.group { |g| found = true if g.name == name}
|
17
|
-
Etc.endgrent
|
18
|
-
found
|
19
|
-
end
|
20
|
-
|
21
|
-
def install_group(group_name)
|
22
|
-
run("addgroup --system #{group_name}")
|
23
|
-
end
|
24
|
-
|
25
|
-
def remove_group(group_name)
|
26
|
-
run("delgroup --system #{group_name}")
|
27
|
-
end
|
28
|
-
|
29
|
-
def user_exists?(name)
|
30
|
-
found = false
|
31
|
-
Etc.passwd { |u| found = true if u.name == name}
|
32
|
-
Etc.endpwent
|
33
|
-
found
|
34
|
-
end
|
35
|
-
|
36
|
-
def install_user(user_name, group_name)
|
37
|
-
run("adduser --system --quiet --no-create-home --home '/nonexistent' #{user_name}")
|
38
|
-
run("usermod -g #{group_name} #{user_name}")
|
39
|
-
end
|
40
|
-
|
41
|
-
def remove_user(user_name)
|
42
|
-
run("deluser #{user_name}")
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|