scalingo_backups_manager 0.6.5 → 0.7.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: 8d1183b7232fbf6ee4b1706d3491c96b893815ec0af2d4752c8ad37681754ca2
4
- data.tar.gz: e93a2443de456f28c6f4389f487e14d7140fd52bc53b3ea99d161cd8c25fe0fb
3
+ metadata.gz: 9eecdc10b8f73d2a91d42fc47b3c53656f6089d0b3272fc6c40bb05b4239ed42
4
+ data.tar.gz: 97a79403c485891560862c3e3f9181a5e9df0c30f7fa6eb190303ee21137f466
5
5
  SHA512:
6
- metadata.gz: 4a0c53e2c044c77c3e5343aa9f9a3cb427e2300d3fa9619c060e8c3d2e080e313d66664b09896cf5159a225bd53e6bdf7462fa0b5093d4a55a882b10d2d687f8
7
- data.tar.gz: 8939a178fce0cc48fbd15822b9189a0bd11a77de27735a87588124e73669eb68bb32b5454fa5f50f2b6c50dae0d0af9d41aff8691a590c7203129437df15c397
6
+ metadata.gz: 0b476dc2a1651226d6ef0c11961ce4815d5250c76657167c4081e5bc25091282f176be3406c9c7c7fdf237ba3483fe4f73430a47e9323020697e43a7c8625fc8
7
+ data.tar.gz: 339c818aecf115a985df7ae57bce015880abe5b4527a80f17ff8dbedb4cef2f7650720cf48423bf2c1fbdd0cfc8a31a25fe28a7928684d9426f898485a29b88b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scalingo_backups_manager (0.6.4)
4
+ scalingo_backups_manager (0.6.6)
5
5
  httparty (~> 0.18)
6
6
  net-sftp (~> 3.0.0)
7
7
  scalingo (~> 3.0)
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (6.1.4)
13
+ activesupport (6.1.4.6)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
@@ -18,30 +18,40 @@ GEM
18
18
  zeitwerk (~> 2.3)
19
19
  concurrent-ruby (1.1.9)
20
20
  diff-lcs (1.4.4)
21
- faraday (1.4.3)
21
+ faraday (1.10.0)
22
22
  faraday-em_http (~> 1.0)
23
23
  faraday-em_synchrony (~> 1.0)
24
24
  faraday-excon (~> 1.1)
25
+ faraday-httpclient (~> 1.0)
26
+ faraday-multipart (~> 1.0)
25
27
  faraday-net_http (~> 1.0)
26
- faraday-net_http_persistent (~> 1.1)
27
- multipart-post (>= 1.2, < 3)
28
+ faraday-net_http_persistent (~> 1.0)
29
+ faraday-patron (~> 1.0)
30
+ faraday-rack (~> 1.0)
31
+ faraday-retry (~> 1.0)
28
32
  ruby2_keywords (>= 0.0.4)
29
33
  faraday-em_http (1.0.0)
30
34
  faraday-em_synchrony (1.0.0)
31
35
  faraday-excon (1.1.0)
36
+ faraday-httpclient (1.0.1)
37
+ faraday-multipart (1.0.3)
38
+ multipart-post (>= 1.2, < 3)
32
39
  faraday-net_http (1.0.1)
33
- faraday-net_http_persistent (1.1.0)
34
- faraday_middleware (1.0.0)
40
+ faraday-net_http_persistent (1.2.0)
41
+ faraday-patron (1.0.0)
42
+ faraday-rack (1.0.0)
43
+ faraday-retry (1.0.3)
44
+ faraday_middleware (1.2.0)
35
45
  faraday (~> 1.0)
36
- httparty (0.18.1)
46
+ httparty (0.20.0)
37
47
  mime-types (~> 3.0)
38
48
  multi_xml (>= 0.5.2)
39
- i18n (1.8.10)
49
+ i18n (1.10.0)
40
50
  concurrent-ruby (~> 1.0)
41
- mime-types (3.3.1)
51
+ mime-types (3.4.1)
42
52
  mime-types-data (~> 3.2015)
43
- mime-types-data (3.2021.0225)
44
- minitest (5.14.4)
53
+ mime-types-data (3.2022.0105)
54
+ minitest (5.15.0)
45
55
  multi_json (1.15.0)
46
56
  multi_xml (0.6.0)
47
57
  multipart-post (2.1.1)
@@ -62,16 +72,16 @@ GEM
62
72
  diff-lcs (>= 1.2.0, < 2.0)
63
73
  rspec-support (~> 3.10.0)
64
74
  rspec-support (3.10.2)
65
- ruby2_keywords (0.0.4)
66
- scalingo (3.0.1)
67
- activesupport (>= 5, < 7)
75
+ ruby2_keywords (0.0.5)
76
+ scalingo (3.1.0)
77
+ activesupport (>= 5, < 8)
68
78
  faraday (~> 1.0)
69
79
  faraday_middleware (~> 1.0)
70
80
  multi_json (~> 1.0, >= 1.0.3)
71
- thor (1.1.0)
81
+ thor (1.2.1)
72
82
  tzinfo (2.0.4)
73
83
  concurrent-ruby (~> 1.0)
74
- zeitwerk (2.4.2)
84
+ zeitwerk (2.5.4)
75
85
 
76
86
  PLATFORMS
77
87
  ruby
@@ -82,4 +92,4 @@ DEPENDENCIES
82
92
  scalingo_backups_manager!
83
93
 
84
94
  BUNDLED WITH
85
- 2.1.4
95
+ 2.2.28
@@ -164,6 +164,7 @@ module ScalingoBackupsManager
164
164
  when "daily"
165
165
  sftp.upload_file(path, remote_path, options: opts)
166
166
  files = sftp.list_files(remote_path)
167
+ p files.length
167
168
  puts "#{step} - Checking daily backups"
168
169
  step += 1
169
170
  if files.size > retention_config[:ttl]
@@ -10,16 +10,25 @@ module ScalingoBackupsManager
10
10
  end
11
11
 
12
12
  def start
13
- Net::SFTP.start(@ftp_host[:host], @ftp_host[:user], password: @ftp_host[:password], port: @ftp_host[:port]) do |sftp|
14
- yield(sftp) if block_given?
13
+ if @ftp_host[:password]
14
+ Net::SFTP.start(@ftp_host[:host], @ftp_host[:user], password: @ftp_host[:password], port: @ftp_host[:port]) do |sftp|
15
+ yield(sftp) if block_given?
16
+ end
17
+ elsif @ftp_host[:private_key_path]
18
+ Net::SFTP.start(@ftp_host[:host], @ftp_host[:user], key_data: [], keys: @ftp_host[:private_key_path], keys_only: true, port: @ftp_host[:port]) do |sftp|
19
+ yield(sftp) if block_given?
20
+ end
15
21
  end
16
22
  end
17
23
 
18
24
  def list_files(path)
19
25
  files = []
20
26
  start do |sftp|
21
- sftp.dir.glob("#{path}", "*.tar.gz").each do |file|
22
- files << file
27
+ begin
28
+ sftp.dir.glob("#{path}", "*.tar.gz").each do |file|
29
+ files << file
30
+ end
31
+ rescue
23
32
  end
24
33
  end
25
34
  files
@@ -36,7 +45,6 @@ module ScalingoBackupsManager
36
45
  folder_tree = []
37
46
  path.split("/").each do |folder_name|
38
47
  next if folder_name.blank?
39
-
40
48
  folder_tree << folder_name
41
49
  begin
42
50
  sftp.mkdir!(folder_tree.join("/"))
@@ -1,3 +1,3 @@
1
1
  module ScalingoBackupsManager
2
- VERSION = "0.6.5"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scalingo_backups_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Clercin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-06 00:00:00.000000000 Z
11
+ date: 2022-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor