kubernetes-cli 0.1.0 → 0.2.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
2
  SHA256:
3
- metadata.gz: bb7820fe8fd6c5426e502bfaeab2e5e7b3ae3350900ffdab42acaa3328bd0fd7
4
- data.tar.gz: ce6976bd46b6a7f98438738fc53910fef7ecce53082bb06062be49833892912c
3
+ metadata.gz: af9eac1d2519da95a480b3c09ab883bc220e74f16695a477e4bd07cd89237027
4
+ data.tar.gz: b772583a411af61c2b7e1276faca027f6ca276c525473edf5f7b5bd879f98dde
5
5
  SHA512:
6
- metadata.gz: 53d1088eb10bdcaa0373d595fcc8dede6495f16836a2a985957082f8f33a99f2e1ae8892001eb8c15d0327a02c75e75e6ca71b3cf9d57cd7d5cdd5b2e6396199
7
- data.tar.gz: 80b1971145ced2eb828df6cf61c63b909faa6a55650c745eaa1725b229e82f355ad1b7128834f38f1f3e6fe0a1205c917ab68ce9aa147f17674582aac209c724
6
+ metadata.gz: 45fef23e66bd4094b8621cc2779255ac48eb4883f7ab3141f838f46717159363dd7cf756b62a475611af91fe2ef08c0a5211c8adc580ae33eb5f9c03250a0312
7
+ data.tar.gz: e0667d9c0184a928d004b10383d0a8b5a99ae24f22088e89a7869c94b1209b241906069a763ec8e508f98bf9c383dd4f50e4927607f4cc34869acd9e3c0a61e4
@@ -1,2 +1,7 @@
1
+ ## 0.2.0
2
+ * Remove doubly-defined method KubernetesCLI#backticks.
3
+ * Move `status_key` into a constant.
4
+ * Add error classes I missed during extraction from kuby-core.
5
+
1
6
  ## 0.1.0
2
7
  * Birthday!
@@ -1,6 +1,20 @@
1
1
  require 'kubectl-rb'
2
2
 
3
3
  class KubernetesCLI
4
+ class KubernetesError < StandardError; end
5
+
6
+ class InvalidResourceError < KubernetesError
7
+ attr_accessor :resource
8
+ end
9
+
10
+ class InvalidResourceUriError < KubernetesError
11
+ attr_accessor :resource_uri
12
+ end
13
+
14
+ class GetResourceError < KubernetesError; end
15
+
16
+ STATUS_KEY = :kubernetes_cli_last_status
17
+
4
18
  attr_reader :kubeconfig_path, :executable
5
19
 
6
20
  def initialize(kubeconfig_path, executable = KubectlRb.executable)
@@ -19,7 +33,7 @@ class KubernetesCLI
19
33
  end
20
34
 
21
35
  def last_status
22
- Thread.current[status_key]
36
+ Thread.current[STATUS_KEY]
23
37
  end
24
38
 
25
39
  def run_cmd(cmd)
@@ -127,7 +141,7 @@ class KubernetesCLI
127
141
  systemm(cmd)
128
142
 
129
143
  unless last_status.success?
130
- raise KubernetesCLIError, "could not annotate resource '#{name}': kubectl "\
144
+ raise KubernetesError, "could not annotate resource '#{name}': kubectl "\
131
145
  "exited with status code #{last_status.exitstatus}"
132
146
  end
133
147
  end
@@ -151,21 +165,10 @@ class KubernetesCLI
151
165
  @env ||= {}
152
166
  end
153
167
 
154
- def status_key
155
- :kubernetes_cli_last_status
156
- end
157
-
158
168
  def base_cmd
159
169
  [executable, '--kubeconfig', kubeconfig_path]
160
170
  end
161
171
 
162
- def backticks(cmd)
163
- cmd_s = cmd.join(' ')
164
- `#{cmd_s}`.tap do
165
- self.last_status = $?
166
- end
167
- end
168
-
169
172
  def execc(cmd)
170
173
  run_before_callbacks(cmd)
171
174
  cmd_s = cmd.join(' ')
@@ -212,6 +215,6 @@ class KubernetesCLI
212
215
  end
213
216
 
214
217
  def last_status=(status)
215
- Thread.current[status_key] = status
218
+ Thread.current[STATUS_KEY] = status
216
219
  end
217
220
  end
@@ -1,3 +1,3 @@
1
1
  class KubernetesCLI
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubernetes-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-04 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kubectl-rb