gitlab-labkit 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bf18910dd8b5fe524da8c6c935423a9aa059e48ba35a8773d1b5aaa85ac6dd4
4
- data.tar.gz: 5793dbbe30934d2b4799fa6295e5a7994bbaeb172bcc18c85c062d83552eb1c3
3
+ metadata.gz: 3ab069c6e8587e5887a63bcf6859331f114c420223714986c6d9b4c1e2d81d4b
4
+ data.tar.gz: b14550055abb076dd52bd1c7d3e5d3d36431f50dc9707137057aaa98164b8278
5
5
  SHA512:
6
- metadata.gz: 13e32000497293b6bc57c4114db05d13eac4ed928e7111f9f30e4ade7bfa0ad173143577cb8fe503b069903752ae200fc32c8341a23db469c4aca6a27af320b0
7
- data.tar.gz: 93f1ad1a7f292732ad9c73f5b618aab676cb16d991ac55561e3e9f269ab58ff22d6c29dfd6452ea89e8b5bafc5d5b7d73f2456ac02af42047199fb689eef2958
6
+ metadata.gz: 93e3340bd0660af708f43e414dfc6a4662e108f69b5ce3d6bb16856ce4a57d7e3c5e8156a7313f09dea94fa08320338b4fb9a1d6104970f535b0eaf84fbea131
7
+ data.tar.gz: bac71cd6d4b3f9fff8aa7bac29cd4987025b89abd55d77dc63cc74fadf32d6e064c147d011a928e22b82b2e93428006034362bf96fe4c9c0dec2258eee22a4a0
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_runtime_dependency "grpc", "~> 1.19" # Be sure to update the "grpc-tools" dev_depenency too
25
25
  spec.add_runtime_dependency "jaeger-client", "~> 0.10"
26
26
  spec.add_runtime_dependency "opentracing", "~> 0.4"
27
- spec.add_runtime_dependency "redis", "~> 3.2"
27
+ spec.add_runtime_dependency "redis", ">3.0.0", "<5.0.0"
28
28
 
29
29
  # Please maintain alphabetical order for dev dependencies
30
30
  spec.add_development_dependency "grpc-tools", "~> 1.19"
@@ -42,12 +42,14 @@ module Labkit
42
42
  end
43
43
 
44
44
  def self.command_serialized(command)
45
+ return "" unless command.is_a?(Array)
46
+ return "" if command.empty?
47
+
45
48
  command_name, *arguments = command
49
+ command_name ||= "nil"
46
50
 
47
51
  info = [command_name]
48
52
  info << sanitize_argument_for_command(command_name, arguments.first) unless arguments.empty?
49
-
50
- # Additional arguments? Only include the number
51
53
  info << "...#{arguments.size - 1} more value(s)" if arguments.size > 1
52
54
 
53
55
  info.join(" ")
@@ -70,7 +72,7 @@ module Labkit
70
72
  # get_first_argument_for_command returns a masked value representing the first argument
71
73
  # from a redis command, taking care of certain sensitive commands
72
74
  def self.sanitize_argument_for_command(command_name, first_argument)
73
- return "*****" if command_is_sensitive(command_name)
75
+ return "*****" if command_is_sensitive?(command_name)
74
76
 
75
77
  return "nil" if first_argument.nil?
76
78
  return first if first_argument.is_a?(Numeric)
@@ -79,11 +81,18 @@ module Labkit
79
81
  mask_redis_arg(first_argument)
80
82
  end
81
83
 
82
- def self.command_is_sensitive(command_name)
83
- return true if command_name == :auth || "auth".casecmp(command_name).zero?
84
- return true if command_name == :eval || "eval".casecmp(command_name).zero?
84
+ # Returns true if the arguments for the command should be masked
85
+ def self.command_is_sensitive?(command_name)
86
+ command_is?(command_name, :auth) || command_is?(command_name, :eval)
87
+ end
85
88
 
86
- false
89
+ # Returns true if the command is equivalent to the command_symbol symbol
90
+ def self.command_is?(command_name, command_symbol)
91
+ if command_name.is_a?(Symbol)
92
+ command_name == command_symbol
93
+ else
94
+ command_name.to_s.casecmp(command_symbol.to_s).zero?
95
+ end
87
96
  end
88
97
 
89
98
  def self.mask_redis_arg(argument)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-labkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Newdigate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-19 00:00:00.000000000 Z
11
+ date: 2019-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -84,16 +84,22 @@ dependencies:
84
84
  name: redis
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.0.0
90
+ - - "<"
88
91
  - !ruby/object:Gem::Version
89
- version: '3.2'
92
+ version: 5.0.0
90
93
  type: :runtime
91
94
  prerelease: false
92
95
  version_requirements: !ruby/object:Gem::Requirement
93
96
  requirements:
94
- - - "~>"
97
+ - - ">"
98
+ - !ruby/object:Gem::Version
99
+ version: 3.0.0
100
+ - - "<"
95
101
  - !ruby/object:Gem::Version
96
- version: '3.2'
102
+ version: 5.0.0
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: grpc-tools
99
105
  requirement: !ruby/object:Gem::Requirement