petasos 0.5.4 → 0.5.6
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/petasos/distributor.rb +3 -6
- data/lib/petasos/node.rb +10 -2
- data/lib/petasos.rb +10 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 810926eec6ad07254828502c562bc6925bf7c2e5c1300e8e118544ea3a7497bd
|
4
|
+
data.tar.gz: ffc68e0b3502ef2b4961082ef348ac120f7cb0649c899be8580525c648276333
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d02606c642cb0a8d81531f24ff9dfdab7934d9ead488af5ee08781d7fcd13618d35b2ba9eb0beaf61f00dc6fe135f0a481b12b67b9043e8621482adfb0c525c
|
7
|
+
data.tar.gz: fc9ee6cf4accfb9e530a483a1f70206fd8508d5c862331e15f6ef26d114fe7a891987bf93ae1f6aeb4923718bd4b1ba924418a956028d2255e33ed606455e3b5
|
data/lib/petasos/distributor.rb
CHANGED
@@ -87,8 +87,7 @@ class Petasos::Distributor
|
|
87
87
|
`scp #{from_node.host}:#{export_path}* #{to_node.host}:#{pool_storage.last}`
|
88
88
|
end
|
89
89
|
end
|
90
|
-
|
91
|
-
`ssh #{to_node.host} \'cd #{to_node.path} && bash -lc \"petasos locations\"\'`
|
90
|
+
to_node.run_petasos_locations("after export from #{from_node.name}")
|
92
91
|
end
|
93
92
|
# mark it as completed
|
94
93
|
completed_export_file_path = File.join(Dir.pwd, "completed-#{File.basename(exports_file_path)}")
|
@@ -96,8 +95,7 @@ class Petasos::Distributor
|
|
96
95
|
# and then put it back where it came from
|
97
96
|
`scp #{completed_export_file_path} #{from_node.host}:#{from_node.path}`
|
98
97
|
`rm #{completed_export_file_path}`
|
99
|
-
|
100
|
-
`ssh #{from_node.host} \'cd #{from_node.path} && bash -lc \"petasos locations\"\'`
|
98
|
+
from_node.run_petasos_locations("after completing its exports")
|
101
99
|
end
|
102
100
|
|
103
101
|
# {"wow-ah"=>
|
@@ -129,8 +127,7 @@ class Petasos::Distributor
|
|
129
127
|
end
|
130
128
|
end
|
131
129
|
|
132
|
-
|
133
|
-
`ssh #{to_node.host} \'cd #{to_node.path} && bash -lc \"petasos locations\"\'`
|
130
|
+
to_node.run_petasos_locations("after backfill from #{from_node.name}")
|
134
131
|
end
|
135
132
|
end
|
136
133
|
end
|
data/lib/petasos/node.rb
CHANGED
@@ -11,8 +11,7 @@ class Petasos::Node
|
|
11
11
|
@manifests = []
|
12
12
|
`mkdir -p #{config["name"]}`
|
13
13
|
|
14
|
-
|
15
|
-
`ssh #{host} \'cd #{path} && bash -lc \"petasos locations\"\'`
|
14
|
+
run_petasos_locations("before distribution begins")
|
16
15
|
|
17
16
|
grab_manifest_and_exports
|
18
17
|
parse_manifests
|
@@ -30,6 +29,15 @@ class Petasos::Node
|
|
30
29
|
config["path"]
|
31
30
|
end
|
32
31
|
|
32
|
+
def petasos_locations_command
|
33
|
+
config["petasos_command"] || config["petasos_locations_command"] || "\'cd #{path} && bash -lc \"petasos locations\"\'"
|
34
|
+
end
|
35
|
+
|
36
|
+
def run_petasos_locations(context = "")
|
37
|
+
puts "Running `petasos locations` on #{name} #{context}"
|
38
|
+
`ssh #{host} #{petasos_locations_command}`
|
39
|
+
end
|
40
|
+
|
33
41
|
def grab_manifest_and_exports
|
34
42
|
`scp #{config["host"]}:#{config["path"]}/manifest* #{config["name"]}/`
|
35
43
|
`scp #{config["host"]}:#{config["path"]}/exports* #{config["name"]}/`
|
data/lib/petasos.rb
CHANGED
@@ -28,9 +28,18 @@ class Petasos
|
|
28
28
|
def lock_and_run(mode, &block)
|
29
29
|
lock_filename = "petasos_is_running_#{mode}"
|
30
30
|
if !File.file?(lock_filename)
|
31
|
+
puts "did not find lock file #{lock_filename}"
|
31
32
|
`touch #{lock_filename}`
|
32
|
-
|
33
|
+
begin
|
34
|
+
yield
|
35
|
+
rescue StandardError => e
|
36
|
+
puts "petasos: error: #{e.message}"
|
37
|
+
puts e.backtrace
|
38
|
+
end
|
33
39
|
`rm #{lock_filename}`
|
40
|
+
else
|
41
|
+
puts "found lock file #{lock_filename}"
|
42
|
+
puts "petasos is already running in #{mode} mode"
|
34
43
|
end
|
35
44
|
end
|
36
45
|
|