wco_models 3.1.0.151 → 3.1.0.152
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/app/models/wco/log.rb +2 -2
- data/app/models/wco/utils.rb +9 -0
- data/app/models/wco_hosting/appliance.rb +15 -13
- data/app/models/wco_hosting/appliance_tmpl.rb +2 -6
- data/app/models/wco_hosting/environment.rb +2 -0
- data/app/models/wco_hosting/file.rb +16 -0
- data/app/models/wco_hosting/runner.rb +1 -0
- data/app/models/wco_hosting/serverhost.rb +1 -0
- data/app/models/wco_hosting/task.rb +3 -0
- data/app/models/wco_hosting/task_tmpl.rb +9 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5d5b1cf16d12082c6fcd8ffd3d9ae8fef4292c97037c1a8de4a20c0f02a19e1
|
4
|
+
data.tar.gz: 7638d870fac8f5f138ed527a950088b8565afd03a80a56b78768f24e9248b682
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4216429fb7f42bc863364edd7dc164305436b3c5ac832565cfccaaf88faf8b2aca62f4351c99b27958ca8f64b892c4f91de51c63c140b057d019037f3148831
|
7
|
+
data.tar.gz: b3db0b20fcb09447fac2d5dadee3d0f966b06a8715ba95291578ecad10e56f41fb95283b987d702ad63a3b120a690c84fa838f86928b299af7341b02a753fed2
|
data/app/models/wco/log.rb
CHANGED
@@ -6,8 +6,8 @@ class Wco::Log
|
|
6
6
|
include Mongoid::Paranoia
|
7
7
|
store_in collection: 'wco_logs'
|
8
8
|
|
9
|
-
field :label, type: :string
|
10
|
-
field :message, type: :string
|
9
|
+
field :label, type: :string ## can be the stream: 'stdout' or 'stderr'
|
10
|
+
field :message, type: :string ## can be json
|
11
11
|
|
12
12
|
belongs_to :obj, polymorphic: true, optional: true
|
13
13
|
|
data/app/models/wco/utils.rb
CHANGED
@@ -17,6 +17,15 @@ module Wco::Utils
|
|
17
17
|
out.with_indifferent_access
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.included(base)
|
21
|
+
base.extend(ClassMethods)
|
22
|
+
end
|
23
|
+
module ClassMethods
|
24
|
+
def list
|
25
|
+
[[nil,nil]] + all.map { |a| [ a, a.id ] }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
20
29
|
private
|
21
30
|
|
22
31
|
def set_slug
|
@@ -3,21 +3,25 @@ class WcoHosting::Appliance
|
|
3
3
|
include Mongoid::Document
|
4
4
|
include Mongoid::Timestamps
|
5
5
|
include Mongoid::Paranoia
|
6
|
+
include Wco::Utils
|
6
7
|
store_in collection: 'wco_appliances'
|
7
8
|
|
8
9
|
has_many :logs, as: :obj, class_name: 'Wco::Log'
|
9
|
-
|
10
|
-
field :stderr, type: :string, default: ''
|
10
|
+
has_many :files, class_name: 'WcoHosting::File'
|
11
11
|
|
12
|
+
field :rc_json, type: Object, default: '{}'
|
13
|
+
def rc
|
14
|
+
OpenStruct.new JSON.parse rc_json
|
15
|
+
end
|
12
16
|
|
13
17
|
belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :appliances
|
14
18
|
belongs_to :subscription, class_name: 'Wco::Subscription' # , inverse_of: :appliance
|
15
19
|
|
16
|
-
field :service_name
|
17
|
-
before_validation :set_service_name, on: :create, unless: ->{ service_name }
|
18
|
-
def set_service_name
|
19
|
-
|
20
|
-
end
|
20
|
+
# field :service_name
|
21
|
+
# before_validation :set_service_name, on: :create, unless: ->{ service_name }
|
22
|
+
# def set_service_name
|
23
|
+
# self[:service_name] = host.gsub(".", "_")
|
24
|
+
# end
|
21
25
|
|
22
26
|
|
23
27
|
belongs_to :environment, class_name: 'WcoHosting::Environment', inverse_of: :appliances, optional: true
|
@@ -26,9 +30,9 @@ class WcoHosting::Appliance
|
|
26
30
|
end
|
27
31
|
|
28
32
|
field :subdomain
|
29
|
-
|
33
|
+
belongs_to :domain, class_name: 'WcoHosting::Domain'
|
30
34
|
def host
|
31
|
-
"#{subdomain}.#{domain}"
|
35
|
+
"#{subdomain}.#{domain.name}"
|
32
36
|
end
|
33
37
|
|
34
38
|
field :n_retries, type: :integer, default: 3
|
@@ -37,9 +41,7 @@ class WcoHosting::Appliance
|
|
37
41
|
def tmpl
|
38
42
|
appliance_tmpl
|
39
43
|
end
|
40
|
-
|
41
|
-
tmpl.kind
|
42
|
-
end
|
44
|
+
delegate :kind, to: :appliance_tmpl
|
43
45
|
|
44
46
|
belongs_to :serverhost, class_name: 'WcoHosting::Serverhost', optional: true
|
45
47
|
|
@@ -51,7 +53,7 @@ class WcoHosting::Appliance
|
|
51
53
|
field :state, default: STATE_PENDING
|
52
54
|
|
53
55
|
def to_s
|
54
|
-
|
56
|
+
appliance_tmpl # kind
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
@@ -4,6 +4,7 @@ class WcoHosting::ApplianceTmpl
|
|
4
4
|
include Mongoid::Document
|
5
5
|
include Mongoid::Timestamps
|
6
6
|
include Mongoid::Paranoia
|
7
|
+
include Wco::Utils
|
7
8
|
store_in collection: 'wco_appliance_tmpls'
|
8
9
|
|
9
10
|
field :kind, type: :string
|
@@ -75,9 +76,7 @@ class WcoHosting::ApplianceTmpl
|
|
75
76
|
has_many :appliances, class_name: 'WcoHosting::Appliance'
|
76
77
|
has_many :subscriptions, as: :product, class_name: 'Wco::Subscription'
|
77
78
|
has_many :prices, as: :product, class_name: 'Wco::Price'
|
78
|
-
|
79
|
-
# has_and_belongs_to_many :leadsets, class_name: 'Wco::Leadset'
|
80
|
-
# has_many :appliance_tmpl_leadsets, class_name: 'WcoHosting::ApplianceTmplLeadset'
|
79
|
+
has_and_belongs_to_many :task_tmpls, class_name: 'WcoHosting::TaskTmpl'
|
81
80
|
|
82
81
|
field :product_id # stripe
|
83
82
|
|
@@ -91,9 +90,6 @@ class WcoHosting::ApplianceTmpl
|
|
91
90
|
self.product_id = stripe_product.id
|
92
91
|
end
|
93
92
|
|
94
|
-
def self.list
|
95
|
-
[[nil,nil]] + all.map { |a| [ a.kind, a.id ] }
|
96
|
-
end
|
97
93
|
def to_s
|
98
94
|
"#{kind}-#{version}"
|
99
95
|
end
|
@@ -3,6 +3,7 @@ class WcoHosting::Environment
|
|
3
3
|
include Mongoid::Document
|
4
4
|
include Mongoid::Timestamps
|
5
5
|
include Mongoid::Paranoia
|
6
|
+
include Wco::Utils
|
6
7
|
store_in collection: 'wco_environments'
|
7
8
|
|
8
9
|
belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :environments
|
@@ -16,6 +17,7 @@ class WcoHosting::Environment
|
|
16
17
|
## variable @env in execution environments
|
17
18
|
field :env_json, type: Object, default: '{}'
|
18
19
|
|
20
|
+
|
19
21
|
def to_s
|
20
22
|
name
|
21
23
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
class WcoHosting::File
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
include Mongoid::Paranoia
|
6
|
+
store_in collection: 'wco_hosting_files'
|
7
|
+
|
8
|
+
belongs_to :serverhost, class_name: 'WcoHosting::Serverhost'
|
9
|
+
belongs_to :appliance, class_name: 'WcoHosting::Appliance'
|
10
|
+
|
11
|
+
field :path, type: :string
|
12
|
+
field :template_erb, type: :string
|
13
|
+
field :pre_exe, type: :string
|
14
|
+
field :post_exe, type: :string
|
15
|
+
|
16
|
+
end
|
@@ -8,4 +8,13 @@ class WcoHosting::TaskTmpl
|
|
8
8
|
field :slug
|
9
9
|
validates :slug, presence: true
|
10
10
|
|
11
|
+
has_many :tasks, class_name: 'WcoHosting::Task'
|
12
|
+
has_and_belongs_to_many :appliance_tmpls, class_name: 'WcoHosting::ApplianceTmpl'
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
slug
|
16
|
+
end
|
17
|
+
def self.list
|
18
|
+
[[nil,nil]] + all.map { |t| [t, t.id] }
|
19
|
+
end
|
11
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wco_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.0.
|
4
|
+
version: 3.1.0.152
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pudeyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -475,6 +475,7 @@ files:
|
|
475
475
|
- app/models/wco_hosting/appliance_tmpl.rb
|
476
476
|
- app/models/wco_hosting/domain.rb
|
477
477
|
- app/models/wco_hosting/environment.rb
|
478
|
+
- app/models/wco_hosting/file.rb
|
478
479
|
- app/models/wco_hosting/runner.rb
|
479
480
|
- app/models/wco_hosting/serverhost.rb
|
480
481
|
- app/models/wco_hosting/subdomain.rb
|