swarm_cluster_cli_ope 0.5.0.pre.1 → 0.5.0

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.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -2
  3. data/Gemfile.lock +4 -48
  4. data/README.md +11 -2
  5. data/lib/swarm_cluster_cli_ope.rb +9 -1
  6. data/lib/swarm_cluster_cli_ope/base_configuration.rb +226 -0
  7. data/lib/swarm_cluster_cli_ope/cli.rb +2 -129
  8. data/lib/swarm_cluster_cli_ope/configuration.rb +10 -186
  9. data/lib/swarm_cluster_cli_ope/configuration_concern.rb +10 -9
  10. data/lib/swarm_cluster_cli_ope/k8s.rb +59 -83
  11. data/lib/swarm_cluster_cli_ope/kubernetes/configuration.rb +75 -0
  12. data/lib/swarm_cluster_cli_ope/kubernetes/pod.rb +144 -0
  13. data/lib/swarm_cluster_cli_ope/{k8s_rsync → kubernetes/rsync_cfgs}/password +0 -0
  14. data/lib/swarm_cluster_cli_ope/{k8s_rsync → kubernetes/rsync_cfgs}/rsyncd.conf +0 -0
  15. data/lib/swarm_cluster_cli_ope/{k8s_rsync → kubernetes/rsync_cfgs}/rsyncd.secrets +0 -0
  16. data/lib/swarm_cluster_cli_ope/kubernetes/sync_configs/base_decorator.rb +28 -0
  17. data/lib/swarm_cluster_cli_ope/kubernetes/sync_configs/mysql.rb +10 -0
  18. data/lib/swarm_cluster_cli_ope/kubernetes/sync_configs/post_gres.rb +11 -0
  19. data/lib/swarm_cluster_cli_ope/kubernetes/sync_configs/rsync.rb +125 -0
  20. data/lib/swarm_cluster_cli_ope/kubernetes/sync_configs/sqlite3.rb +9 -0
  21. data/lib/swarm_cluster_cli_ope/logger_concern.rb +1 -1
  22. data/lib/swarm_cluster_cli_ope/shell_command_response.rb +18 -5
  23. data/lib/swarm_cluster_cli_ope/stack_sync_concern.rb +135 -0
  24. data/lib/swarm_cluster_cli_ope/sync_configs/base.rb +1 -1
  25. data/lib/swarm_cluster_cli_ope/sync_configs/mysql.rb +17 -2
  26. data/lib/swarm_cluster_cli_ope/thor_configuration_concern.rb +29 -0
  27. data/lib/swarm_cluster_cli_ope/version.rb +1 -1
  28. metadata +17 -7
@@ -9,7 +9,7 @@ module SwarmClusterCliOpe
9
9
  attr_accessor :configs
10
10
 
11
11
  # @param [Hash] configs
12
- # @param [Continuation] stack_cfgs
12
+ # @param [Configuration] stack_cfgs
13
13
  def initialize(stack_cfgs, configs)
14
14
  super()
15
15
  @configs = configs
@@ -7,9 +7,24 @@ module SwarmClusterCliOpe
7
7
  resume('pull')
8
8
  if yes?("Confermare il comando?[y,yes]")
9
9
  tmp_file = "/tmp/#{Time.now.to_i}.sql.gz"
10
- container.exec("bash -c 'mysqldump -u #{remote.username} --password=#{remote.password} #{remote.database_name} | gzip -c -f' > #{tmp_file}")
10
+ container.exec("bash -c 'mysqldump -u #{remote.username} --password=#{remote.password} #{remote.database_name} | gzip -c -f' > #{tmp_file}")
11
11
  local_container.copy_in(tmp_file, tmp_file)
12
- local_container.exec("bash -c 'zcat #{tmp_file} | mysql -u #{local.username} --password=#{local.password} #{local.database_name}'")
12
+ local_authentication = "-u #{local.username} --password=#{local.password}"
13
+
14
+ command = []
15
+ command << "bash -c '"
16
+
17
+ command << "mysql #{local_authentication} -e \"DROP DATABASE IF EXISTS #{local.database_name};CREATE DATABASE #{local.database_name}\""
18
+
19
+ command << "&&"
20
+
21
+ command << "zcat #{tmp_file}"
22
+ command << "|"
23
+ command << "mysql #{local_authentication} #{local.database_name}"
24
+
25
+ command << "'"
26
+
27
+ local_container.exec(command.join" ")
13
28
  end
14
29
  true
15
30
  end
@@ -0,0 +1,29 @@
1
+ require 'active_support/concern'
2
+
3
+ module SwarmClusterCliOpe
4
+ module ThorConfigurationConcern
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+
9
+ desc "config", "Visualizza le configurazioni mergiate (HOME + Project configuration[#{Configuration.cfgs_project_file_name}])"
10
+
11
+ def config
12
+ cfgs.env(options[:environment]) do
13
+ puts JSON.pretty_generate(cfgs.merged_configurations)
14
+ end
15
+ end
16
+
17
+ desc "configure_project STACK_NAME", "Genera il file di configurazione del progetto contenente il nome dello stack"
18
+
19
+ def configure_project(stack_name)
20
+ cfgs.env(options[:environment]) do |c|
21
+ c.stack_name = stack_name
22
+ c.save_project_cfgs
23
+ end
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+ end
@@ -1,3 +1,3 @@
1
1
  module SwarmClusterCliOpe
2
- VERSION = "0.5.0.pre.1"
2
+ VERSION = "0.5.0"
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.5.0.pre.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marino Bonetti
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-09 00:00:00.000000000 Z
11
+ date: 2020-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -88,6 +88,7 @@ files:
88
88
  - Rakefile
89
89
  - exe/swarm_cli_ope
90
90
  - lib/swarm_cluster_cli_ope.rb
91
+ - lib/swarm_cluster_cli_ope/base_configuration.rb
91
92
  - lib/swarm_cluster_cli_ope/cli.rb
92
93
  - lib/swarm_cluster_cli_ope/commands/base.rb
93
94
  - lib/swarm_cluster_cli_ope/commands/compose_container.rb
@@ -98,9 +99,16 @@ files:
98
99
  - lib/swarm_cluster_cli_ope/configuration.rb
99
100
  - lib/swarm_cluster_cli_ope/configuration_concern.rb
100
101
  - lib/swarm_cluster_cli_ope/k8s.rb
101
- - lib/swarm_cluster_cli_ope/k8s_rsync/password
102
- - lib/swarm_cluster_cli_ope/k8s_rsync/rsyncd.conf
103
- - lib/swarm_cluster_cli_ope/k8s_rsync/rsyncd.secrets
102
+ - lib/swarm_cluster_cli_ope/kubernetes/configuration.rb
103
+ - lib/swarm_cluster_cli_ope/kubernetes/pod.rb
104
+ - lib/swarm_cluster_cli_ope/kubernetes/rsync_cfgs/password
105
+ - lib/swarm_cluster_cli_ope/kubernetes/rsync_cfgs/rsyncd.conf
106
+ - lib/swarm_cluster_cli_ope/kubernetes/rsync_cfgs/rsyncd.secrets
107
+ - lib/swarm_cluster_cli_ope/kubernetes/sync_configs/base_decorator.rb
108
+ - lib/swarm_cluster_cli_ope/kubernetes/sync_configs/mysql.rb
109
+ - lib/swarm_cluster_cli_ope/kubernetes/sync_configs/post_gres.rb
110
+ - lib/swarm_cluster_cli_ope/kubernetes/sync_configs/rsync.rb
111
+ - lib/swarm_cluster_cli_ope/kubernetes/sync_configs/sqlite3.rb
104
112
  - lib/swarm_cluster_cli_ope/logger_concern.rb
105
113
  - lib/swarm_cluster_cli_ope/manager.rb
106
114
  - lib/swarm_cluster_cli_ope/models/base.rb
@@ -113,6 +121,7 @@ files:
113
121
  - lib/swarm_cluster_cli_ope/node.rb
114
122
  - lib/swarm_cluster_cli_ope/shell_command_execution.rb
115
123
  - lib/swarm_cluster_cli_ope/shell_command_response.rb
124
+ - lib/swarm_cluster_cli_ope/stack_sync_concern.rb
116
125
  - lib/swarm_cluster_cli_ope/sync_configs/base.rb
117
126
  - lib/swarm_cluster_cli_ope/sync_configs/base_database.rb
118
127
  - lib/swarm_cluster_cli_ope/sync_configs/copy.rb
@@ -121,6 +130,7 @@ files:
121
130
  - lib/swarm_cluster_cli_ope/sync_configs/post_gres.rb
122
131
  - lib/swarm_cluster_cli_ope/sync_configs/rsync.rb
123
132
  - lib/swarm_cluster_cli_ope/sync_configs/sqlite3.rb
133
+ - lib/swarm_cluster_cli_ope/thor_configuration_concern.rb
124
134
  - lib/swarm_cluster_cli_ope/version.rb
125
135
  - lib/swarm_cluster_cli_ope/worker.rb
126
136
  - swarm_cluster_cli_ope.gemspec
@@ -143,9 +153,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
153
  version: 2.3.0
144
154
  required_rubygems_version: !ruby/object:Gem::Requirement
145
155
  requirements:
146
- - - ">"
156
+ - - ">="
147
157
  - !ruby/object:Gem::Version
148
- version: 1.3.1
158
+ version: '0'
149
159
  requirements: []
150
160
  rubygems_version: 3.0.8
151
161
  signing_key: