swarm_cluster_cli_ope 0.5.0.pre.3 → 0.5.0.pre.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38b75604119e4338ee0cc8552d15c82ab5f7bc7aa41f4cf45a4c5e3dd333fd36
|
4
|
+
data.tar.gz: 7cc4fd8a3a39907dea28f413843e0d9d997fb7effd4dea3ba8081b8235ac1067
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10f7fc072a0eb4144ec717f8fe09b67d71831a88c3fd205639054e52c309ef8d43655ce4b1f997e9ce3ecb83587a30d01a75f02b555355414e47d87d793b8c6f
|
7
|
+
data.tar.gz: 1546b4dfcf48483bfd0ff7502a2a2613d129acb59d21256aa2b94ecb8c3f1beeccc0313abfeb9e0f9da003efe5a187d4d69f356a8de2700c4d664ae5ed979887
|
data/Gemfile.lock
CHANGED
@@ -98,10 +98,10 @@ module SwarmClusterCliOpe
|
|
98
98
|
puts "Problemi nella ricerca del pod"
|
99
99
|
exit
|
100
100
|
else
|
101
|
-
if ris.
|
101
|
+
if ris.single_obj[:items].empty?
|
102
102
|
logger.warn { "non abbiamo trovato il pod" }
|
103
103
|
else
|
104
|
-
self.new(ris.
|
104
|
+
self.new(ris.single_obj[:items].first, context: context)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
@@ -119,7 +119,7 @@ module SwarmClusterCliOpe
|
|
119
119
|
puts "Problemi nella ricerca del pod"
|
120
120
|
exit
|
121
121
|
else
|
122
|
-
self.new(ris.
|
122
|
+
self.new(ris.single_obj, context: context)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'forwardable'
|
2
2
|
|
3
3
|
module SwarmClusterCliOpe
|
4
|
-
##
|
5
|
-
# Identifica una risposta dalla shell
|
4
|
+
##
|
5
|
+
# Identifica una risposta dalla shell
|
6
6
|
class ShellCommandResponse
|
7
7
|
extend Forwardable
|
8
8
|
include LoggerConcern
|
@@ -28,18 +28,24 @@ module SwarmClusterCliOpe
|
|
28
28
|
##
|
29
29
|
# Risultato, essendo sempre composto da una lista di righe in formato json, ritorniamo un array di json
|
30
30
|
# @param [Object] object_class
|
31
|
-
# @return [Array<object_class
|
32
|
-
def result(object_class: OpenStruct)
|
31
|
+
# @return [Array<object_class>,Object]
|
32
|
+
def result(object_class: OpenStruct, single: false)
|
33
33
|
#tento prima di estrapolare direttamente da json e sucessivamente come array
|
34
|
-
|
34
|
+
if single
|
35
35
|
# questo per k8s, dato che abbiamo come risposta un json vero
|
36
|
-
object_class.new(JSON.parse(
|
37
|
-
|
36
|
+
object_class.new(JSON.parse(raw_result[:stdout]))
|
37
|
+
else
|
38
38
|
# questo nel caso siamo in swarm che ci ritorna un array di json
|
39
39
|
raw_result[:stdout].split("\n").collect { |s| object_class.new(JSON.parse(s)) }
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
# @param [Class<OpenStruct>] object_class
|
44
|
+
# @return [Object]
|
45
|
+
def single_obj(object_class: OpenStruct)
|
46
|
+
result(object_class: object_class, single: true)
|
47
|
+
end
|
48
|
+
|
43
49
|
#
|
44
50
|
# def to_a
|
45
51
|
# raw_result[:stdout].split("\n")
|