filecluster 0.5.26 → 0.5.29

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
- SHA1:
3
- metadata.gz: 1ee01d84ce7df5b8ebe6279a92c0c14c488a5c82
4
- data.tar.gz: 7e2f785e88144ed619e55cdec6bf038264278052
2
+ SHA256:
3
+ metadata.gz: 62c0aba394cd7245330d1ec4b2e222fb500d5809310d12cc2e23fd96eb32153b
4
+ data.tar.gz: d22421a0ddd3f3810a42d19617976a911d8a2883cfb3c38aa4c2f83ff3c4874d
5
5
  SHA512:
6
- metadata.gz: 7735a60395e14dac92d0078d60c63458ac795847e55292a6b4616e29f072d50b7417f74a6cf2bb0e775c0452b2706363f10b6d82aaafe41cd5b8d371bf242c89
7
- data.tar.gz: 1e670216069549f82614300d99c53422e73782ab96c5e3ed459c32bc4d8b27dcc77eaa47b813a68e6a3a5d3fda0cc60f498e48435d19c1fab30ece49f0eee530
6
+ metadata.gz: 1617ecdbb68b3341677ff122eae10335af41508e996f3b70c6e8df48b690826f2052c6be6add92a9e3ccd44a238acb70dfe0fb246aab7d47ef471fd6969f8c3c
7
+ data.tar.gz: d2be6de927e6a056b727082a1dcd32ecdd8a5e66237e4b6b661bb4665eb65e29b3fd68f40183bfad5810746d877796e277bc29cb583dc7f366feaa2f53030eb6
@@ -48,6 +48,7 @@ class CopyTaskThread < BaseThread
48
48
  rescue Exception => e
49
49
  if e.message.match('Record not found')
50
50
  $log.warn("Item ##{task.item_id} not found before copy")
51
+ task.delete
51
52
  return nil
52
53
  else
53
54
  raise e
@@ -20,6 +20,7 @@ class DeleteTaskThread < BaseThread
20
20
  rescue Exception => e
21
21
  if e.message.match('Record not found')
22
22
  $log.warn("Item ##{task.item_id} not found before delete")
23
+ task.delete
23
24
  return nil
24
25
  else
25
26
  raise e
data/lib/fc/item.rb CHANGED
@@ -13,6 +13,7 @@ module FC
13
13
  # :additional_fields - hash of additional FC:Item fields
14
14
  # :no_md5 - don't use md5
15
15
  # :speed_limit - limit copy speed
16
+ # :force_local_storage_name
16
17
  # If item_name is part of local_path it processed as inplace - local_path is valid path to the item for policy
17
18
  def self.create_from_local(local_path, item_name, policy, options={}, &block)
18
19
  raise 'Path not exists' unless File.exists?(local_path)
@@ -32,14 +33,25 @@ module FC
32
33
  item_params.delete(:not_local)
33
34
  item_params.delete(:no_md5)
34
35
  item_params.delete(:speed_limit)
36
+ item_params.delete(:force_local_storage_name)
35
37
  raise 'Name is empty' if item_params[:name].empty?
36
38
  raise 'Zero size path' if item_params[:size] == 0
37
39
 
38
40
  if local_path.include?(item_name) && !options[:not_local]
39
- storage = policy.get_create_storages.detect do |s|
40
- s.host == FC::Storage.curr_host && local_path.index(s.path) == 0 && local_path.sub(s.path, '').sub(/\/$/, '').sub(/^\//, '') == item_params[:name]
41
+ if options[:force_local_storage_name]
42
+ storage = policy.get_create_storages.detect do |s|
43
+ s.name == options[:force_local_storage_name]
44
+ end
45
+ FC::Error.raise "force_local_storage #{options[:force_local_storage_name]} is not valid path for policy ##{policy.id}" unless storage
46
+ if local_path.index(storage.path) != 0 || local_path.sub(storage.path, '').sub(/\/$/, '').sub(/^\//, '') != item_params[:name]
47
+ FC::Error.raise "force_local_storage #{storage.name} is not valid path for local path ##{local_path}"
48
+ end
49
+ else
50
+ storage = policy.get_create_storages.detect do |s|
51
+ s.host == FC::Storage.curr_host && local_path.index(s.path) == 0 && local_path.sub(s.path, '').sub(/\/$/, '').sub(/^\//, '') == item_params[:name]
52
+ end
53
+ FC::Error.raise "local_path #{local_path} is not valid path for policy ##{policy.id}" unless storage
41
54
  end
42
- FC::Error.raise "local_path #{local_path} is not valid path for policy ##{policy.id}" unless storage
43
55
  end
44
56
 
45
57
  # new item?
data/lib/fc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FC
2
- VERSION = '0.5.26'.freeze
2
+ VERSION = '0.5.29'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filecluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.26
4
+ version: 0.5.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - sh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-28 00:00:00.000000000 Z
11
+ date: 2022-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2
@@ -216,8 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  - !ruby/object:Gem::Version
217
217
  version: '0'
218
218
  requirements: []
219
- rubyforge_project:
220
- rubygems_version: 2.6.14
219
+ rubygems_version: 3.0.8
221
220
  signing_key:
222
221
  specification_version: 4
223
222
  summary: Distributed storage