bosh_common 1.3262.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 187dd3328a19039e185d45ab97eb1c6a3cd9630f
4
- data.tar.gz: c7d730f8de38ad42a6e1c813141ff4aa47d7c77d
2
+ SHA256:
3
+ metadata.gz: '09e3e71a65390e9ed3bbd2ccfa7084d71fc52cb67a6435c46856c0b24eb34306'
4
+ data.tar.gz: 6f75ab074cc56fbca906d77484811aaf1e7eb349ae7a5ddbe425ad150e9eb0b8
5
5
  SHA512:
6
- metadata.gz: cef2f3bee24e0d4b6bed8da6795a70c7b94b108d10e5807decc9304e2eea51d1faa3b4f02321a60b839fc434d0c597dfa2e6508cadac44a7cb25912326533fa8
7
- data.tar.gz: ab1e233670057e13520342c6e52a673587ea2b67a5e0d0eae990a2210558dc50eca8967b7f7558cd653b4cddbcad9ecf82333c38cb4b26a66c71aaaef31ae16a
6
+ metadata.gz: b4c087d7d8f757edba148a76589f949b13d6ce946daae280740dcdece123a97c7debaa6030249fd5ba90f3be800cfeb75af9db74f86087b2007fc0d149538033
7
+ data.tar.gz: b42bc24055ab54b600b00558a28dc42ddfd788a556b21e8318799c0676e6b919bd3a3cf7ed6fc98902a9d4a0e8e98f745cdd290f23dadff2c6fb50453be75e03
data/lib/common/common.rb CHANGED
@@ -1,4 +1,3 @@
1
- # Copyright (c) 2012 VMware, Inc.
2
1
  require 'common/errors'
3
2
  require 'common/retryable'
4
3
 
@@ -1,5 +1,3 @@
1
- # Copyright (c) 2012 VMware, Inc.
2
-
3
1
  module Bosh::Exec
4
2
  # Raised when there was an error executing the command
5
3
  class Error < StandardError
@@ -1,5 +1,3 @@
1
- # Copyright (c) 2012 VMware, Inc.
2
-
3
1
  module Bosh::Exec
4
2
  class Result
5
3
  # command that generated the result
data/lib/common/exec.rb CHANGED
@@ -1,5 +1,3 @@
1
- # Copyright (c) 2012 VMware, Inc.
2
-
3
1
  module Bosh; end
4
2
 
5
3
  require "common/exec/result"
@@ -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.exists?(@key_path) && !File.exists?(@certificate_path)
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.exists?(@certificate_path) && !File.exists?(@key_path)
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.exists?(@key_path) && File.exists?(@certificate_path)
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(:pattern => "%.1l, [%d #%p] [%T] %5l -- %c: %m\n")
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 % [severity[0..0], format_datetime(time), $$, thread_name, severity, progname,
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("%Y-%m-%dT%H:%M:%S.") << "%06d " % time.usec
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
- when ::String
34
- msg
35
- when ::Exception
36
- "#{ msg.message } (#{ msg.class })\n" <<
37
- (msg.backtrace || []).join("\n")
38
- else
39
- msg.inspect
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
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Common
3
- VERSION = '1.3262.4.0'
3
+ VERSION = '2.0.0'
4
4
  end
5
5
  end
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: 1.3262.4.0
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: 2016-07-20 00:00:00.000000000 Z
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: 1.8.2
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: 1.8.2
40
+ version: 2.2.2
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: openssl
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
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: '0'
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 2.0
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: 1.9.3
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
- rubyforge_project:
128
- rubygems_version: 2.2.2
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: []