filecluster 0.5.27 → 0.5.28
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 +4 -4
- data/lib/fc/item.rb +15 -3
- data/lib/fc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9de6ac005874dd4c6bcb167cc9c71b6417f384c4116668ebcda03f6741f3a2ce
|
4
|
+
data.tar.gz: ec2aff79aff42a1b27d68168d2260e8720b676542bf2563ffcbc03a6880c7d37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf0c2a5c574e188f9af197b0acf9d328cf49eee1b89708b52f96b63cd3b60c974c2d9f832790619648cf3e67ec8904072965623b2afad01149668e9f13b9d4da
|
7
|
+
data.tar.gz: 96e31037d021574d7e6c033dea7a7c5fe685c8166b72ed257d41d8b115c23d0fe3d8892a94ed43bd8cdca31ce6fc1d222242aff297c55c762cfe56c51f9bd649
|
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
|
-
|
40
|
-
|
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 #{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
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.
|
4
|
+
version: 0.5.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|