petasos 0.5.2 → 0.5.4

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: cb623c372e4177df95553923e61d111337bb01b28ace724d443d2a2014631ad2
4
- data.tar.gz: b914c31bbd9c6743f662c051b881ca9e9195542e5ec6b7b1c8890b33496470a6
3
+ metadata.gz: d54a5b700fe0b66ec0d9dfd97bf5e27b2d37818af231761b81e40105ae4b4c4a
4
+ data.tar.gz: 34e1d0416daa3011955f99f323ac6a0538e48f44aae091507e1c058daf29c9d5
5
5
  SHA512:
6
- metadata.gz: 8882b063964e50f3c3e6109d652eedac094c619007d173760ccc769c2452b86ab875b1355c5434d431e20a1e634624dd642207484f76d1c13de6bcc96ceaa03d
7
- data.tar.gz: 5e545b2c1fbe779f1effa4641fe3fa93b5f46aa60611bacaae6e24d9b57a5809fe5bac79c17ab5f996dfa80a62dfe2258b6289faa3ba9a817653b81f43e1adfd
6
+ metadata.gz: ae3cbe118ea54dd02fb2d0dfa9609b023cc7ba111f8aaab4bf4fd82f315b70d4219aff9e1219631546e9b8db403c0dc6abcc0dc4657057c45f5ef06696ceafc2
7
+ data.tar.gz: 3b15a8baa046e3281e2fe43b96775a7f2b4956ed3211c6163767b2e5d4366866889137bdaa970c81de6ca31a27c5a8b7e25b28e347c9f6ba1343c8b06f7fa196
@@ -88,7 +88,7 @@ class Petasos::Distributor
88
88
  end
89
89
  end
90
90
  puts "Running `petasos locations` on #{to_node.name} after export from #{from_node.name}"
91
- `ssh #{to_node.host} \"cd #{to_node.path} && petasos locations\"`
91
+ `ssh #{to_node.host} \'cd #{to_node.path} && bash -lc \"petasos locations\"\'`
92
92
  end
93
93
  # mark it as completed
94
94
  completed_export_file_path = File.join(Dir.pwd, "completed-#{File.basename(exports_file_path)}")
@@ -97,7 +97,7 @@ class Petasos::Distributor
97
97
  `scp #{completed_export_file_path} #{from_node.host}:#{from_node.path}`
98
98
  `rm #{completed_export_file_path}`
99
99
  puts "Running `petasos locations` on #{from_node.name} after completing its exports"
100
- `ssh #{from_node.host} \"cd #{from_node.path} && petasos locations\"`
100
+ `ssh #{from_node.host} \'cd #{from_node.path} && bash -lc \"petasos locations\"\'`
101
101
  end
102
102
 
103
103
  # {"wow-ah"=>
@@ -130,7 +130,7 @@ class Petasos::Distributor
130
130
  end
131
131
 
132
132
  puts "Running `petasos locations` on #{to_node.name} after backfill from #{from_node.name}"
133
- `ssh #{to_node.host} \"cd #{to_node.path} && petasos locations\"`
133
+ `ssh #{to_node.host} \'cd #{to_node.path} && bash -lc \"petasos locations\"\'`
134
134
  end
135
135
  end
136
136
  end
data/lib/petasos/node.rb CHANGED
@@ -12,7 +12,7 @@ class Petasos::Node
12
12
  `mkdir -p #{config["name"]}`
13
13
 
14
14
  puts "Running `petasos locations` on #{name} before distribution begins"
15
- `ssh #{host} \"cd #{path} && petasos locations\"`
15
+ `ssh #{host} \'cd #{path} && bash -lc \"petasos locations\"\'`
16
16
 
17
17
  grab_manifest_and_exports
18
18
  parse_manifests
data/lib/petasos.rb CHANGED
@@ -7,14 +7,30 @@ class Petasos
7
7
  class Error < StandardError; end
8
8
 
9
9
  def run(mode = "")
10
- unless File.file?("petasos_is_running")
11
- `touch petasos_is_running`
12
- process_locations
13
- unless mode == "locations"
14
- process_distribution if File.file?(File.join(Dir.pwd, "petasos_distribution-config.yaml"))
10
+ if mode == "locations"
11
+ lock_and_run("locations") do
15
12
  process_locations
16
13
  end
17
- `rm petasos_is_running`
14
+ elsif mode == "distribution"
15
+ lock_and_run("distribution") do
16
+ process_distribution
17
+ end
18
+ else # mode is neither distribution or locations
19
+ lock_and_run("locations") do
20
+ process_locations
21
+ end
22
+ lock_and_run("distribution") do
23
+ process_distribution
24
+ end
25
+ end
26
+ end
27
+
28
+ def lock_and_run(mode, &block)
29
+ lock_filename = "petasos_is_running_#{mode}"
30
+ if !File.file?(lock_filename)
31
+ `touch #{lock_filename}`
32
+ yield
33
+ `rm #{lock_filename}`
18
34
  end
19
35
  end
20
36
 
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.2
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Myers