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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d54a5b700fe0b66ec0d9dfd97bf5e27b2d37818af231761b81e40105ae4b4c4a
4
- data.tar.gz: 34e1d0416daa3011955f99f323ac6a0538e48f44aae091507e1c058daf29c9d5
3
+ metadata.gz: 810926eec6ad07254828502c562bc6925bf7c2e5c1300e8e118544ea3a7497bd
4
+ data.tar.gz: ffc68e0b3502ef2b4961082ef348ac120f7cb0649c899be8580525c648276333
5
5
  SHA512:
6
- metadata.gz: ae3cbe118ea54dd02fb2d0dfa9609b023cc7ba111f8aaab4bf4fd82f315b70d4219aff9e1219631546e9b8db403c0dc6abcc0dc4657057c45f5ef06696ceafc2
7
- data.tar.gz: 3b15a8baa046e3281e2fe43b96775a7f2b4956ed3211c6163767b2e5d4366866889137bdaa970c81de6ca31a27c5a8b7e25b28e347c9f6ba1343c8b06f7fa196
6
+ metadata.gz: 5d02606c642cb0a8d81531f24ff9dfdab7934d9ead488af5ee08781d7fcd13618d35b2ba9eb0beaf61f00dc6fe135f0a481b12b67b9043e8621482adfb0c525c
7
+ data.tar.gz: fc9ee6cf4accfb9e530a483a1f70206fd8508d5c862331e15f6ef26d114fe7a891987bf93ae1f6aeb4923718bd4b1ba924418a956028d2255e33ed606455e3b5
@@ -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
- puts "Running `petasos locations` on #{to_node.name} after export from #{from_node.name}"
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
- puts "Running `petasos locations` on #{from_node.name} after completing its exports"
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
- puts "Running `petasos locations` on #{to_node.name} after backfill from #{from_node.name}"
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
- puts "Running `petasos locations` on #{name} before distribution begins"
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
- yield
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: petasos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Myers