swarm_cluster_cli_ope 0.6 → 0.7.2.1

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: 956724efc48101ced01f9b90733cb45f4e7278a7e8da2d54edf7e85a1b103cab
4
- data.tar.gz: e3d20867dcd4bc2cafa42b9997bfdbbf4cfeea4cbeb50881bdbebf615320056a
3
+ metadata.gz: 2b1b531caf2e5ae14fa47befec029b67c8c5b414bdf9d7378597a69254a7fcd6
4
+ data.tar.gz: 6b0903a0694ce1601a604c1efc0ab5cbb80d496c2758c257935dd4386fd125e3
5
5
  SHA512:
6
- metadata.gz: 898033f68020b639df391e38728e8ac63fc284b29dbb7ead531578f10fc11aaa102d2109ebe4d43db9254a1ca2df63149ff8d50341bf7bf509a2d1e0dea5f611
7
- data.tar.gz: 85f316b0cef0d08ce7f768d7d35a67b023b728a86315433cb4bcaaf45fdaf1c71e46d609f7255a593a2aea61860d037f84bf259a5e39d417f8b64a9850c610b0
6
+ metadata.gz: 477f99d4021367e7200fe425dd00887faaefa2fe708f73c3ce175996410917daee50e38a1209cf5f80186cc97c9f0ac16d45a9531da9b6e2ce039752b3df647b
7
+ data.tar.gz: 86caa366eba35e60fcda660f1f2fd55ffe81bd357e2d9f1df8bd52ecc95ae4a845cb56ec357c51711a02473432fa9e79b72458f0e51359048c1831f6e54825d8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Changelog
2
2
 
3
+ # 0.7
4
+ - riconoscimento delle immagini durante rsync per installare correttamente pacchetto,
5
+ viene riconosciuto ubuntu ed alpine
6
+
3
7
  # 0.6
4
8
  - sync con MongoDB
5
9
 
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swarm_cluster_cli_ope (0.6)
5
- activesupport
4
+ swarm_cluster_cli_ope (0.7.2.1)
5
+ activesupport (< 7)
6
6
  open4
7
7
  thor (~> 1.0)
8
8
  zeitwerk (~> 2.3)
@@ -10,22 +10,22 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (6.1.3)
13
+ activesupport (6.1.6)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
17
17
  tzinfo (~> 2.0)
18
18
  zeitwerk (~> 2.3)
19
- concurrent-ruby (1.1.8)
20
- i18n (1.8.9)
19
+ concurrent-ruby (1.1.10)
20
+ i18n (1.10.0)
21
21
  concurrent-ruby (~> 1.0)
22
- minitest (5.14.4)
22
+ minitest (5.16.1)
23
23
  open4 (1.3.4)
24
24
  rake (12.3.3)
25
- thor (1.1.0)
25
+ thor (1.2.1)
26
26
  tzinfo (2.0.4)
27
27
  concurrent-ruby (~> 1.0)
28
- zeitwerk (2.4.2)
28
+ zeitwerk (2.6.0)
29
29
 
30
30
  PLATFORMS
31
31
  ruby
@@ -35,4 +35,4 @@ DEPENDENCIES
35
35
  swarm_cluster_cli_ope!
36
36
 
37
37
  BUNDLED WITH
38
- 1.17.3
38
+ 2.1.4
data/README.md CHANGED
@@ -231,9 +231,12 @@ docker-compose -f test_folder/test_k8s/docker-compose-local.yml up -d
231
231
  ```
232
232
 
233
233
 
234
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version
235
- number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git
236
- commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
234
+ ## Release
235
+
236
+ To install this gem onto your local machine, run `bundle exec rake install`.
237
+
238
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,
239
+ which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
237
240
 
238
241
 
239
242
  ## License
@@ -31,8 +31,9 @@ module SwarmClusterCliOpe
31
31
 
32
32
  # @param [String,Array<String>] cmd -> comando da passare a kubectl exec -- CMD
33
33
  # @return [SwarmClusterCliOpe::ShellCommandResponse]
34
- def exec(cmd)
35
- base_cmd(["exec", name, "--", cmd].flatten).execute
34
+ # @param [FalseClass] allow_failure -> parametro per lasciar fallire o meno il comando senza bloccarsi e poi gestirlo
35
+ def exec(cmd, allow_failure: false)
36
+ base_cmd(["exec", name, "--", cmd].flatten).execute(allow_failure: allow_failure)
36
37
  end
37
38
 
38
39
  ##
@@ -45,22 +45,24 @@ module SwarmClusterCliOpe
45
45
 
46
46
  # controllo presenza comandi necessari
47
47
  command_installed = false
48
- cmd_ricerca = container.exec(['bash -c "command -v rsync && command -v killall"'])
49
- unless cmd_ricerca.failed?
50
- num_commands = cmd_ricerca.raw_result[:stdout].split("\n").count rescue 0
51
- if num_commands == 2
52
- command_installed = true
53
- end
48
+ install_rsync = false
49
+ install_psmisc = false
50
+ if container.exec(['sh -c "command -v apt"'], allow_failure: true).success?
51
+ puts "Container Ubuntu"
52
+ install_rsync = container.exec(['sh -c "command -v rsync || apt update && apt install -yq rsync "'], allow_failure: true).success?
53
+ install_psmisc = container.exec(['sh -c "command -v killall || apt update && apt install -yq psmisc"'], allow_failure: true).success?
54
54
  end
55
55
 
56
- unless command_installed
57
- # tentiamo di installarlo
58
- cmd = container.exec(['bash -c "apt update && apt install -yq rsync psmisc"'])
59
- if cmd.failed?
60
- puts "Problemi nell'installazione di rsync nel pod"
61
- else
62
- command_installed = true
63
- end
56
+ if container.exec(['sh -c "command -v apk"'], allow_failure: true).success?
57
+ puts "Container Alpine"
58
+ install_rsync = container.exec(['sh -c "command -v rsync || apk add rsync"'], allow_failure: true).success?
59
+ install_psmisc = true
60
+ end
61
+
62
+ if install_rsync and install_psmisc
63
+ command_installed = true
64
+ else
65
+ puts "Problemi nell'installazione di rsync nel pod"
64
66
  end
65
67
 
66
68
  if command_installed
@@ -4,7 +4,14 @@ module SwarmClusterCliOpe
4
4
 
5
5
  # @return [SwarmClusterCliOpe::Models::ComposeContainer]
6
6
  def self.find_by_service_name(service_name, stack_name: '')
7
- res = ShellCommandExecution.new("docker inspect #{[stack_name, service_name, "1"].compact.join("_".strip)}").execute
7
+ # prima controlliamo se siamo con il vecchio sistema di docker-compose dove i nomi dei servizi venivano
8
+ # costruiti con _ oppure se siamo nella nuova versione di docker compose dove c'è il - che fà da spaziatore
9
+ res = nil
10
+ ["_", "-"].each do |separatore|
11
+ res = ShellCommandExecution.new("docker inspect #{[stack_name, service_name, "1"].compact.join(separatore)}").execute(allow_failure: true)
12
+ break unless res.failed?
13
+ end
14
+ raise "Non siamo riusciti ad identificare il servizio in locale" if res.failed?
8
15
  self.new(JSON.parse(res.raw_result[:stdout]).first)
9
16
  end
10
17
 
@@ -66,7 +66,19 @@ module SwarmClusterCliOpe
66
66
  - pg_user: "postgres" -> valore in chiaro, in sostituzione della variabile ambiente, DEFAULT: postgres
67
67
  - database_name_env: "POSTGRES_DB" -> variabile ambiente interna al servizio contenente NOME DB, DEFAULT: POSTGRES_DB
68
68
  - database_name: "nome_db" -> valore in chiaro, in sostituzione della variabile ambiente
69
-
69
+ mongo:
70
+ -- local: -> hash di configurazioni per il DB locale
71
+ - service: "db" -> nome del servizio nel compose locale, DEFAULT: quello definito sopra
72
+ - password: "" -> password per DB
73
+ - username: "" -> username per DB
74
+ - database_name: "nome_db" -> nome del DB
75
+ - exclude_from_sync: "coll1,coll2" -> elenco di collections di cui non eseguire il dump quando facciamo PUSH, DEFAULT: ''
76
+ -- remote: -> hash di configurazioni per il DB remoto
77
+ - service: "db" -> nome del servizio nel compose locale, DEFAULT: quello definito sopra
78
+ - password: "" -> password per DB
79
+ - username: "" -> username per DB
80
+ - database_name: "nome_db" -> nome del DB
81
+ - exclude_from_sync: "coll1,coll2" -> elenco di collections di cui non eseguire il dump quando facciamo PULL, DEFAULT: ''
70
82
 
71
83
  EXAMPLE:
72
84
  Esempio di sincronizzazione di un file sqlite3 e una cartella
@@ -1,3 +1,3 @@
1
1
  module SwarmClusterCliOpe
2
- VERSION = "0.6"
2
+ VERSION = "0.7.2.1"
3
3
  end
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "thor", '~>1.0'
33
33
  spec.add_dependency "zeitwerk", '~>2.3'
34
34
  spec.add_dependency "open4"
35
- spec.add_dependency "activesupport"
35
+ spec.add_dependency "activesupport", '<7'
36
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swarm_cluster_cli_ope
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: 0.7.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marino Bonetti
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-04 00:00:00.000000000 Z
11
+ date: 2022-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "<"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '7'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "<"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '7'
69
69
  description: |-
70
70
  Gestione di varie operazioni come sincronia con le cartelle bindate dei container (rsync) up o
71
71
  down e possibilità di scaricare/caricare i file direttamente all'interno del cluster, in
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  requirements: []
161
- rubygems_version: 3.0.8
161
+ rubygems_version: 3.1.4
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: WIP Gemma per la gestione del cluster swarm