bosh_common 1.3262.24.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/common/common.rb +0 -1
- data/lib/common/exec/error.rb +0 -2
- data/lib/common/exec/result.rb +0 -2
- data/lib/common/exec.rb +0 -2
- data/lib/common/logging/filters.rb +19 -0
- data/lib/common/logging/regex_filter.rb +27 -0
- data/lib/common/ssl.rb +3 -3
- data/lib/common/thread_formatter.rb +14 -14
- data/lib/common/version.rb +1 -1
- metadata +16 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '09e3e71a65390e9ed3bbd2ccfa7084d71fc52cb67a6435c46856c0b24eb34306'
|
4
|
+
data.tar.gz: 6f75ab074cc56fbca906d77484811aaf1e7eb349ae7a5ddbe425ad150e9eb0b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4c087d7d8f757edba148a76589f949b13d6ce946daae280740dcdece123a97c7debaa6030249fd5ba90f3be800cfeb75af9db74f86087b2007fc0d149538033
|
7
|
+
data.tar.gz: b42bc24055ab54b600b00558a28dc42ddfd788a556b21e8318799c0676e6b919bd3a3cf7ed6fc98902a9d4a0e8e98f745cdd290f23dadff2c6fb50453be75e03
|
data/lib/common/common.rb
CHANGED
data/lib/common/exec/error.rb
CHANGED
data/lib/common/exec/result.rb
CHANGED
data/lib/common/exec.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'common/logging/regex_filter'
|
2
|
+
|
3
|
+
module Bosh::Common::Logging
|
4
|
+
def self.null_query_filter
|
5
|
+
Bosh::Common::Logging::RegexFilter.new(
|
6
|
+
[
|
7
|
+
{ /^\(\d+\.\d+s\) \(conn: \d+\) SELECT NULL$/ => nil },
|
8
|
+
],
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.query_redaction_filter
|
13
|
+
Bosh::Common::Logging::RegexFilter.new(
|
14
|
+
[
|
15
|
+
{ /^(\(\d+\.\d+s\) \(conn: \d+\) (INSERT INTO ("|`).*?("|`)|UPDATE ("|`).*?("|`)|DELETE FROM ("|`).*?("|`))).+/m => '\1 <redacted>' },
|
16
|
+
],
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'logging/filter'
|
2
|
+
|
3
|
+
module Bosh
|
4
|
+
module Common
|
5
|
+
module Logging
|
6
|
+
class RegexFilter < ::Logging::Filter
|
7
|
+
def initialize(filters)
|
8
|
+
@filters = filters
|
9
|
+
end
|
10
|
+
|
11
|
+
def allow(event)
|
12
|
+
@filters.each do |hash|
|
13
|
+
match_pattern, replacement_pattern = hash.first
|
14
|
+
|
15
|
+
if replacement_pattern.nil?
|
16
|
+
return nil if match_pattern.match?(event.data)
|
17
|
+
else
|
18
|
+
event.data = event.data.gsub(match_pattern, replacement_pattern)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
event
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/common/ssl.rb
CHANGED
@@ -39,15 +39,15 @@ module Bosh
|
|
39
39
|
private
|
40
40
|
|
41
41
|
def load_or_create_key_and_csr_cert
|
42
|
-
if File.
|
42
|
+
if File.exist?(@key_path) && !File.exist?(@certificate_path)
|
43
43
|
raise MatchingFileNotFound, 'The key that matches the given certificate could not be found.'
|
44
44
|
end
|
45
45
|
|
46
|
-
if File.
|
46
|
+
if File.exist?(@certificate_path) && !File.exist?(@key_path)
|
47
47
|
raise MatchingFileNotFound, 'The certificate that matches the given key could not be found.'
|
48
48
|
end
|
49
49
|
|
50
|
-
if File.
|
50
|
+
if File.exist?(@key_path) && File.exist?(@certificate_path)
|
51
51
|
load_key_and_csr_cert
|
52
52
|
else
|
53
53
|
create_key_and_csr_cert
|
@@ -1,9 +1,12 @@
|
|
1
1
|
class ThreadFormatter
|
2
|
-
FORMAT = "%s, [%s#%d] [%s] %5s -- %s: %s\n"
|
2
|
+
FORMAT = "%s, [%s#%d] [%s] %5s -- %s: %s\n".freeze
|
3
3
|
|
4
4
|
# get pattern layout for Logging::Logger
|
5
5
|
def self.layout
|
6
|
-
Logging.layouts.pattern(
|
6
|
+
Logging.layouts.pattern(
|
7
|
+
pattern: "%.1l, [%d #%p] [%T] %5l -- %c: %m\n",
|
8
|
+
date_pattern: '%Y-%m-%dT%H:%M:%S.%s',
|
9
|
+
)
|
7
10
|
end
|
8
11
|
|
9
12
|
attr_accessor :datetime_format
|
@@ -14,15 +17,14 @@ class ThreadFormatter
|
|
14
17
|
|
15
18
|
def call(severity, time, progname, msg)
|
16
19
|
thread_name = Thread.current[:name] || "0x#{Thread.current.object_id.to_s(16)}"
|
17
|
-
FORMAT
|
18
|
-
msg2str(msg)]
|
20
|
+
format(FORMAT, severity[0..0], format_datetime(time), $$, thread_name, severity, progname, msg2str(msg))
|
19
21
|
end
|
20
22
|
|
21
23
|
private
|
22
24
|
|
23
25
|
def format_datetime(time)
|
24
26
|
if @datetime_format.nil?
|
25
|
-
time.strftime(
|
27
|
+
time.strftime('%Y-%m-%dT%H:%M:%S.') << format('%06d ', time.usec)
|
26
28
|
else
|
27
29
|
time.strftime(@datetime_format)
|
28
30
|
end
|
@@ -30,19 +32,18 @@ class ThreadFormatter
|
|
30
32
|
|
31
33
|
def msg2str(msg)
|
32
34
|
case msg
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
when ::String
|
36
|
+
msg
|
37
|
+
when ::Exception
|
38
|
+
"#{msg.message} (#{msg.class})\n" <<
|
39
|
+
(msg.backtrace || []).join("\n")
|
40
|
+
else
|
41
|
+
msg.inspect
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
46
|
module Kernel
|
45
|
-
|
46
47
|
def with_thread_name(name)
|
47
48
|
old_name = Thread.current[:name]
|
48
49
|
Thread.current[:name] = name
|
@@ -50,5 +51,4 @@ module Kernel
|
|
50
51
|
ensure
|
51
52
|
Thread.current[:name] = old_name
|
52
53
|
end
|
53
|
-
|
54
54
|
end
|
data/lib/common/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VMware
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semi_semantic
|
@@ -30,56 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.2.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.2.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: openssl
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
type: :
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec-its
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
47
|
+
version: 3.2.0
|
48
|
+
type: :runtime
|
77
49
|
prerelease: false
|
78
50
|
version_requirements: !ruby/object:Gem::Requirement
|
79
51
|
requirements:
|
80
52
|
- - ">="
|
81
53
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
54
|
+
version: 3.2.0
|
83
55
|
description: BOSH common
|
84
56
|
email: support@cloudfoundry.com
|
85
57
|
executables: []
|
@@ -92,6 +64,8 @@ files:
|
|
92
64
|
- lib/common/exec.rb
|
93
65
|
- lib/common/exec/error.rb
|
94
66
|
- lib/common/exec/result.rb
|
67
|
+
- lib/common/logging/filters.rb
|
68
|
+
- lib/common/logging/regex_filter.rb
|
95
69
|
- lib/common/release/release_directory.rb
|
96
70
|
- lib/common/retryable.rb
|
97
71
|
- lib/common/ssl.rb
|
@@ -107,9 +81,9 @@ files:
|
|
107
81
|
- lib/common/version/version_list.rb
|
108
82
|
homepage: https://github.com/cloudfoundry/bosh
|
109
83
|
licenses:
|
110
|
-
- Apache
|
84
|
+
- Apache-2.0
|
111
85
|
metadata: {}
|
112
|
-
post_install_message:
|
86
|
+
post_install_message:
|
113
87
|
rdoc_options: []
|
114
88
|
require_paths:
|
115
89
|
- lib
|
@@ -117,16 +91,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
91
|
requirements:
|
118
92
|
- - ">="
|
119
93
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
94
|
+
version: 2.7.0
|
121
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
96
|
requirements:
|
123
97
|
- - ">="
|
124
98
|
- !ruby/object:Gem::Version
|
125
99
|
version: '0'
|
126
100
|
requirements: []
|
127
|
-
|
128
|
-
|
129
|
-
signing_key:
|
101
|
+
rubygems_version: 3.4.19
|
102
|
+
signing_key:
|
130
103
|
specification_version: 4
|
131
104
|
summary: BOSH common
|
132
105
|
test_files: []
|