kruby 1.36.0.2 → 1.36.0.3

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: c0339eb1cc8a6f1d7402b0f089dca4cdd7fd20c0b0f0a049cec2b3fcd0a78276
4
- data.tar.gz: 3416b24a60f29e7715a9ff45a1f542dbc83c325c988c51e9c288e6a618403f85
3
+ metadata.gz: 2368426a514cb2faa1a955a344c27535fd8a5e0ed658daa220ac3670b500a7dc
4
+ data.tar.gz: 5df9b8da264349a436a6b57568f165608c2a2630475ed27280f1c5b3c8fdfd5f
5
5
  SHA512:
6
- metadata.gz: 4d3b65bb69cb397cb29704318d5359d570aa55113c7e45e99930b11606628c301e08404671373f35bdb0bfb9e64e67399ea682f770f4900fb73e82c559c41b98
7
- data.tar.gz: bc2755b8608df879b0b5abffafb0255096abdde11d2a37d3e689e97d1113fa4c12818016c617b74308f3953f38aac989e2bae3cd6a732c9d59a11b5d3a100e3a
6
+ metadata.gz: 40a65006935258583abbe2b9111a43f6f5fa9022a7783a24c9166e0e03e9983b1243303e00d0903b893e99de105464c48b52f3040244c6cc8b02c0cab46f8c82
7
+ data.tar.gz: 7a8d5684829a67ece0845578f14c2caee7f92df7a4360dc6afeb265a35ddff1803d3741f811530a8f314f59b8fac2d632ff8760cd80db855f89d8aa2a7f89fc8
@@ -90,13 +90,13 @@ module Kubernetes
90
90
  Configuration.instance_variable_set(:@in_cluster_config, self)
91
91
  Configuration.prepend(Module.new do
92
92
  # rubocop:disable Metrics/LineLength
93
- def api_key_with_prefix(identifier)
93
+ def api_key_with_prefix(identifier, param_alias = nil)
94
94
  in_cluster_config = self.class.instance_variable_get(:@in_cluster_config)
95
95
  if identifier == 'authorization' && @api_key.key?(identifier) && in_cluster_config.token_expires_at <= Time.now
96
96
  in_cluster_config.load_token
97
97
  @api_key[identifier] = 'Bearer ' + in_cluster_config.token
98
98
  end
99
- super identifier
99
+ super identifier, param_alias
100
100
  end
101
101
  # rubocop:enable Metrics/LineLength
102
102
  end)
@@ -49,6 +49,13 @@ module Kubernetes
49
49
  File.dirname(path)
50
50
  end
51
51
 
52
+ def resolve_path(file_path)
53
+ return file_path unless file_path
54
+ file_path = file_path.to_s
55
+ return file_path if file_path.start_with?('/')
56
+ File.expand_path(file_path, File.expand_path(base_path))
57
+ end
58
+
52
59
  def config
53
60
  @config ||= File.open(path) do |io|
54
61
  ::YAML.safe_load(io.read)
@@ -86,8 +93,8 @@ module Kubernetes
86
93
 
87
94
  def setup_ssl(cluster, user, config)
88
95
  # rubocop:disable DoubleNegation
89
- config.verify_ssl = !!cluster['verify-ssl']
90
- config.verify_ssl_host = !!cluster['verify-ssl']
96
+ config.verify_ssl = !!cluster['verify_ssl']
97
+ config.verify_ssl_host = !!cluster['verify_ssl']
91
98
  # rubocop:enable DoubleNegation
92
99
 
93
100
  config.ssl_ca_cert = cluster['certificate-authority']
@@ -98,6 +105,7 @@ module Kubernetes
98
105
  def find_cluster(name)
99
106
  find_by_name(config['clusters'], 'cluster', name).tap do |cluster|
100
107
  Kubernetes.create_temp_file_and_set(cluster, 'certificate-authority')
108
+ cluster['certificate-authority'] = resolve_path(cluster['certificate-authority'])
101
109
  cluster['verify_ssl'] = !cluster['insecure-skip-tls-verify']
102
110
  end
103
111
  end
@@ -108,6 +116,8 @@ module Kubernetes
108
116
 
109
117
  Kubernetes.create_temp_file_and_set(user, 'client-certificate')
110
118
  Kubernetes.create_temp_file_and_set(user, 'client-key')
119
+ user['client-certificate'] = resolve_path(user['client-certificate'])
120
+ user['client-key'] = resolve_path(user['client-key'])
111
121
  load_token_file(user)
112
122
  setup_auth(user)
113
123
  end
@@ -117,6 +127,7 @@ module Kubernetes
117
127
  # If tokenFile is specified, then set token
118
128
  return unless !user['token'] && user['tokenFile']
119
129
 
130
+ user['tokenFile'] = resolve_path(user['tokenFile'])
120
131
  File.open(user['tokenFile']) do |io|
121
132
  user['token'] = io.read.chomp
122
133
  end
@@ -260,21 +260,30 @@ module Kubernetes
260
260
  end
261
261
 
262
262
  server = servers[index]
263
- url = server[:url]
263
+ url = server[:url].dup
264
264
 
265
265
  return url unless server.key? :variables
266
266
 
267
267
  # go through variable and assign a value
268
268
  server[:variables].each do |name, variable|
269
- if variables.key?(name)
270
- if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
271
- url.gsub! "{" + name.to_s + "}", variables[name]
269
+ variable_key = if variables.key?(name)
270
+ name
271
+ elsif variables.key?(name.to_s)
272
+ name.to_s
273
+ elsif name.respond_to?(:to_sym) && variables.key?(name.to_sym)
274
+ name.to_sym
275
+ end
276
+
277
+ if variable_key
278
+ variable_value = variables[variable_key]
279
+ if (!variable.key?(:enum_values) || variable[:enum_values].include?(variable_value))
280
+ url.gsub! "{" + name.to_s + "}", variable_value
272
281
  else
273
- fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
282
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variable_value}. Must be #{variable[:enum_values]}."
274
283
  end
275
284
  else
276
285
  # use default value
277
- url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
286
+ url.gsub! "{" + name.to_s + "}", variable[:default_value]
278
287
  end
279
288
  end
280
289
 
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "open3"
4
+ require "rubygems/specification"
5
+ require "shellwords"
6
+ require "kubernetes/release/changelog"
7
+
8
+ module Kubernetes
9
+ module Release
10
+ module PublishGuard
11
+ module_function
12
+
13
+ def gemspec_files(gemspec_path)
14
+ spec = Gem::Specification.load(gemspec_path)
15
+ raise Changelog::Error, "failed to load gemspec #{gemspec_path}" unless spec
16
+
17
+ spec.files
18
+ rescue Gem::InvalidSpecificationException => e
19
+ raise Changelog::Error, e.message
20
+ end
21
+
22
+ def untracked_package_files(repo_root:, package_root:, package_files:)
23
+ repo_paths = package_files.map do |path|
24
+ package_file_repo_path(repo_root: repo_root, package_root: package_root, package_path: path)
25
+ end.uniq.sort
26
+ return [] if repo_paths.empty?
27
+
28
+ tracked_paths = capture_command("git", "-C", repo_root, "ls-files", "--", *repo_paths).lines.map(&:chomp)
29
+ repo_paths - tracked_paths
30
+ end
31
+
32
+ def untracked_gemspec_files(repo_root:, package_root:, gemspec_path:)
33
+ untracked_package_files(
34
+ repo_root: repo_root,
35
+ package_root: package_root,
36
+ package_files: gemspec_files(gemspec_path)
37
+ )
38
+ end
39
+
40
+ def package_file_repo_path(repo_root:, package_root:, package_path:)
41
+ repo_root = File.expand_path(repo_root)
42
+ repo_prefix = "#{repo_root}#{File::SEPARATOR}"
43
+ full_path = File.expand_path(package_path, package_root)
44
+
45
+ unless full_path.start_with?(repo_prefix)
46
+ raise Changelog::Error, "gem package file #{package_path} resolves outside #{repo_root}"
47
+ end
48
+
49
+ full_path.delete_prefix(repo_prefix)
50
+ end
51
+
52
+ def capture_command(*command)
53
+ output, status = Open3.capture2e(*command)
54
+ return output if status.success?
55
+
56
+ message = "command failed: #{Shellwords.join(command)}"
57
+ details = output.strip
58
+ message = "#{message}\n#{details}" unless details.empty?
59
+ raise Changelog::Error, message
60
+ end
61
+ end
62
+ end
63
+ end
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.1.0
11
11
  =end
12
12
 
13
13
  module Kubernetes
14
- VERSION = '1.36.0.2'
14
+ VERSION = '1.36.0.3'
15
15
  end
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  require 'json'
16
+ require 'uri'
16
17
 
17
18
  # The Kubernetes module encapsulates the Kubernetes client for Ruby
18
19
  module Kubernetes
@@ -24,9 +25,12 @@ module Kubernetes
24
25
  end
25
26
 
26
27
  def make_url(path, resource_version)
27
- query = '?watch=true'
28
- query += "&resourceVersion=#{resource_version}" if resource_version
29
- path + query
28
+ uri = URI.parse(path)
29
+ query = URI.decode_www_form(uri.query || '').to_h
30
+ query['watch'] = 'true'
31
+ query['resourceVersion'] = resource_version if resource_version
32
+ query_string = query.map { |k, v| "#{URI.encode_www_form_component(k).gsub('+', '%20')}=#{URI.encode_www_form_component(v).gsub('+', '%20')}" }.join('&')
33
+ "#{uri.path}?#{query_string}"
30
34
  end
31
35
 
32
36
  def connect(path, resource_version = nil, &_block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.36.0.2
4
+ version: 1.36.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - doridoridoriand
@@ -903,6 +903,7 @@ files:
903
903
  - lib/kubernetes/models/v2_resource_metric_status.rb
904
904
  - lib/kubernetes/models/version_info.rb
905
905
  - lib/kubernetes/release/changelog.rb
906
+ - lib/kubernetes/release/publish_guard.rb
906
907
  - lib/kubernetes/utils.rb
907
908
  - lib/kubernetes/version.rb
908
909
  - lib/kubernetes/watch.rb