envirobly-orchestra 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27540543de48daec3396d69ad5ce05079fefd25a0f76a092c914a8e2873a80e7
4
- data.tar.gz: 96d0c5e27e028b8c0cc06df90c81bc111a5efe4d591c1926d201773443bc9e11
3
+ metadata.gz: 7a146603656b0f7d989daba62fac148bed321781ad26c5a822da7ec1b75bcc18
4
+ data.tar.gz: 7c8d3a88177da3422c850bc371c821ced7704413bcfcc5d3b475d7c812939083
5
5
  SHA512:
6
- metadata.gz: 803c22a7247aa5e69a133436924146cb94d2d7d7f56258e446154fac304fcfdba4d4b60f84a1b9407af1505d12eb40946bb515ce19f1a6354b6ae73f178fc82a
7
- data.tar.gz: d16b2d572fbb2acd1357c733af6083ea5020cc82eee376c771ffcab3ec5a795bccd9cb948f558247fcec5c27e02950a44add0d7247d0f497da8bb1f856d6bb55
6
+ metadata.gz: cdfee431c6e723f79c5cfb647104f974cb12ca40b1975bfe1b1c1a43528cf51f84cf7dc110b1bd9549c520cd93f79210be674484787a5b9077bf9b21c407fb72
7
+ data.tar.gz: d16acac39984a4d0d15dd2de18cf0460c7b1b4973449774a904c87ed521fa89062bd36995b276b532f20bed69148720ee7e95e03ce43d9380896dc09341b77d0
@@ -1,4 +1,5 @@
1
1
  require "thor"
2
+ require "logger"
2
3
 
3
4
  class Orchestra::Base < Thor
4
5
  def self.exit_on_failure?
@@ -27,13 +28,16 @@ class Orchestra::Base < Thor
27
28
  end
28
29
 
29
30
  def log(text)
30
- Orchestra::Logger.instance.log "inv-#{Thread.current[:invocation]} #{text}"
31
+ # Size-based rotated logging: 3 10-megabyte files.
32
+ @logger ||= Logger.new("/var/log/orchestra.log", 3, 10485760)
33
+
34
+ @logger.info text
31
35
  end
32
36
 
33
37
  def execute(cmd, exit_on_failure: true)
34
38
  stdout_and_err, status = Open3.capture2e *cmd
35
39
 
36
- log stdout_and_err unless stdout_and_err.blank?
40
+ log stdout_and_err unless stdout_and_err.nil? || stdout_and_err.empty?
37
41
 
38
42
  if exit_on_failure && status.to_i > 0
39
43
  exit 1
@@ -1,6 +1,8 @@
1
1
  require "open3"
2
2
  # require "httpx"
3
3
  require "pathname"
4
+ require "yaml"
5
+ require "erb"
4
6
 
5
7
  class Orchestra::Cli::Services < Orchestra::Base
6
8
  desc "up", "Start services based on config synced from config bucket"
@@ -99,7 +101,7 @@ class Orchestra::Cli::Services < Orchestra::Base
99
101
 
100
102
  def initialize_data_volumes
101
103
  compose_definition["services"].each do |_, service|
102
- next if service.dig("labels", "envirobly.data-volume.pool").blank?
104
+ next unless service["labels"]
103
105
 
104
106
  zpool = service["labels"]["envirobly.data-volume.pool"]
105
107
  mountpoint = service["labels"]["envirobly.data-volume.pool.mountpoint"]
@@ -107,6 +109,8 @@ class Orchestra::Cli::Services < Orchestra::Base
107
109
  dataset_mountpoint = service["labels"]["envirobly.data-volume.dataset.mountpoint"]
108
110
  device = service["labels"]["envirobly.data-volume.device"]
109
111
 
112
+ next if zpool.nil? || mountpoint.nil? || zfs_dataset.nil? || dataset_mountpoint.nil? || device.nil?
113
+
110
114
  if zfs_dataset_exist?(zfs_dataset)
111
115
  log " ZFS dataset exists"
112
116
  next
@@ -1,5 +1,6 @@
1
1
  require "singleton"
2
2
 
3
+ # @deprecated in favor of Ruby's Logger
3
4
  class Orchestra::Logger
4
5
  include Singleton
5
6
 
@@ -1,3 +1,3 @@
1
1
  module Orchestra
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
data/lib/orchestra.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Orchestra
2
2
  end
3
3
 
4
- require "active_support"
5
- require "active_support/core_ext"
4
+ # require "active_support"
5
+ # require "active_support/core_ext"
6
6
  require "zeitwerk"
7
7
 
8
8
  loader = Zeitwerk::Loader.for_gem
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: envirobly-orchestra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Starsi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-21 00:00:00.000000000 Z
11
+ date: 2024-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '7.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '7.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: thor
29
15
  requirement: !ruby/object:Gem::Requirement