swarm_cluster_cli_ope 0.6 → 0.7

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: 956724efc48101ced01f9b90733cb45f4e7278a7e8da2d54edf7e85a1b103cab
4
- data.tar.gz: e3d20867dcd4bc2cafa42b9997bfdbbf4cfeea4cbeb50881bdbebf615320056a
3
+ metadata.gz: 073c69aa2b2317c5c8148497cbe718c6a48f32e574f94fd98c686d8bf9645235
4
+ data.tar.gz: f37f6a1e5c9206262d0b38eaaff4583f4db31991e7715203424077b7a583c418
5
5
  SHA512:
6
- metadata.gz: 898033f68020b639df391e38728e8ac63fc284b29dbb7ead531578f10fc11aaa102d2109ebe4d43db9254a1ca2df63149ff8d50341bf7bf509a2d1e0dea5f611
7
- data.tar.gz: 85f316b0cef0d08ce7f768d7d35a67b023b728a86315433cb4bcaaf45fdaf1c71e46d609f7255a593a2aea61860d037f84bf259a5e39d417f8b64a9850c610b0
6
+ metadata.gz: 84863ff0ac40ba91ab79b191558a501aed8d709b63109310791d3475909ac4571f1bb45afbb2b0a3ede1875de2d67699e672d4d9d2f6282b7d6a0acdb39cb45c
7
+ data.tar.gz: 50af6cdd12aae5210bdb98bf96face8b61f532c89adac2b1581e9b35e356e6ada191f2614f6a26ef4a5bcc6c0842ab1c2f43bae5c5cc7028f795cbbde8ce8059
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,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swarm_cluster_cli_ope (0.6)
4
+ swarm_cluster_cli_ope (0.7)
5
5
  activesupport
6
6
  open4
7
7
  thor (~> 1.0)
@@ -10,14 +10,14 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (6.1.3)
13
+ activesupport (6.1.4.1)
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.9)
20
+ i18n (1.8.10)
21
21
  concurrent-ruby (~> 1.0)
22
22
  minitest (5.14.4)
23
23
  open4 (1.3.4)
data/README.md CHANGED
@@ -231,6 +231,8 @@ docker-compose -f test_folder/test_k8s/docker-compose-local.yml up -d
231
231
  ```
232
232
 
233
233
 
234
+ ## Release
235
+
234
236
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version
235
237
  number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git
236
238
  commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
@@ -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
@@ -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"
3
3
  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'
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: 2021-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor