avm 0.34.0 → 0.36.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/entries/auto_values/uri_entry.rb +24 -0
- data/lib/avm/entries/uri_builder.rb +85 -0
- data/lib/avm/instances/base/auto_values/install.rb +6 -9
- data/lib/avm/instances/base/auto_values.rb +2 -8
- data/lib/avm/instances/base.rb +1 -1
- data/lib/avm/instances/entry_keys.rb +1 -1
- data/lib/avm/instances/runner.rb +4 -2
- data/lib/avm/version.rb +1 -1
- data/lib/avm/with/application_stereotype.rb +1 -3
- metadata +32 -19
- data/lib/avm/instances/base/auto_values/system.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7efc64412c406ca9b9575a704de3e3eaa48328ce07f95a9406f55edd323a6843
|
4
|
+
data.tar.gz: 82b77ad19908de1401ba655e7ec16ddc5c4a119b9d4c52b47baa259c40db77ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37a7790ce5e98c0cfe0eca56d22fbbd44689ce63bb5796eacb5c762f0c8b9765972ac7c4666b401ecfa21f0feb2807e26361c9fe99a8c384732a29ece0943255
|
7
|
+
data.tar.gz: e85973d4cc9064ac60e34697cdca985ffcce20f300560e91b6d134000fb5b628e603750db44e2f184397fa806b6b87b6bb33d834e9119fc04fca04e28e3a1197
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/entries/uri_builder'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Entries
|
8
|
+
module AutoValues
|
9
|
+
class UriEntry
|
10
|
+
common_constructor :entries_provider, :suffix
|
11
|
+
|
12
|
+
def found?
|
13
|
+
value.present?
|
14
|
+
end
|
15
|
+
|
16
|
+
def value
|
17
|
+
::Avm::Entries::UriBuilder.from_all_fields do |field_name|
|
18
|
+
entries_provider.entry([suffix, field_name]).value
|
19
|
+
end.to_uri.to_s
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Entries
|
7
|
+
class UriBuilder
|
8
|
+
require_sub __FILE__
|
9
|
+
|
10
|
+
FIELDS = %w[scheme user password host port path query fragment].freeze
|
11
|
+
FIELDS_TRANSLATIONS = {
|
12
|
+
username: :user, hostname: :host
|
13
|
+
}.freeze
|
14
|
+
ENTRIES_FIELDS = FIELDS.map do |field|
|
15
|
+
FIELDS_TRANSLATIONS.key(field.to_sym).if_present(field).to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
class << self
|
19
|
+
def from_all_fields(&block)
|
20
|
+
r = new
|
21
|
+
ENTRIES_FIELDS.each do |field_name|
|
22
|
+
field_value = block.call(field_name)
|
23
|
+
r.field_set(field_name, field_value) if field_value.present?
|
24
|
+
end
|
25
|
+
r
|
26
|
+
end
|
27
|
+
|
28
|
+
def from_source(source)
|
29
|
+
if source.is_a?(::Addressable::URI)
|
30
|
+
from_source_uri(source)
|
31
|
+
elsif source.blank?
|
32
|
+
new
|
33
|
+
else
|
34
|
+
raise "Unexpected source: #{source}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def from_source_uri(source_uri)
|
39
|
+
new(source_uri.to_hash)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
common_constructor :data, default: [{}]
|
44
|
+
|
45
|
+
def field_get(name)
|
46
|
+
data[name.to_sym].if_present(&:to_s)
|
47
|
+
end
|
48
|
+
|
49
|
+
def field_set(field, value)
|
50
|
+
tfield = translate_field(field)
|
51
|
+
if FIELDS.include?(tfield)
|
52
|
+
main_field_set(tfield, value)
|
53
|
+
else
|
54
|
+
sub_field_set(tfield, value)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def translate_field(field)
|
59
|
+
if FIELDS_TRANSLATIONS.key?(field.to_sym)
|
60
|
+
FIELDS_TRANSLATIONS.fetch(field.to_sym).to_s
|
61
|
+
else
|
62
|
+
field.to_s
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# @return [Addressable::URI, nil]
|
67
|
+
def to_uri
|
68
|
+
to_required_uri
|
69
|
+
rescue ::Addressable::URI::InvalidURIError
|
70
|
+
nil
|
71
|
+
end
|
72
|
+
|
73
|
+
# @return [Addressable::URI]
|
74
|
+
def to_required_uri
|
75
|
+
::Addressable::URI.new(FIELDS.map { |f| [f.to_sym, field_get(f)] }.to_h)
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def main_field_set(name, value)
|
81
|
+
data[name.to_sym] = value
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -7,8 +7,10 @@ module Avm
|
|
7
7
|
class Base
|
8
8
|
module AutoValues
|
9
9
|
module Install
|
10
|
-
def
|
11
|
-
|
10
|
+
def auto_install_groupname
|
11
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
|
12
|
+
::Avm::Instances::EntryKeys::INSTALL_GROUPNAME) ||
|
13
|
+
read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
|
12
14
|
end
|
13
15
|
|
14
16
|
def auto_install_hostname
|
@@ -33,13 +35,8 @@ module Avm
|
|
33
35
|
end
|
34
36
|
|
35
37
|
def auto_install_url_by_parts
|
36
|
-
|
37
|
-
|
38
|
-
.if_present(a) { |v| "#{v}@#{a}" }
|
39
|
-
a = read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_PORT)
|
40
|
-
.if_present(a) { |v| "#{a}:#{v}" }
|
41
|
-
"ssh://#{a}"
|
42
|
-
end
|
38
|
+
require 'avm/entries/auto_values/uri_entry'
|
39
|
+
::Avm::Entries::AutoValues::UriEntry.new(self, 'install').value
|
43
40
|
end
|
44
41
|
end
|
45
42
|
end
|
@@ -6,14 +6,8 @@ module Avm
|
|
6
6
|
module Instances
|
7
7
|
class Base
|
8
8
|
module AutoValues
|
9
|
-
require_sub __FILE__
|
10
|
-
|
11
|
-
common_concern do
|
12
|
-
%w[Admin Data Database Filesystem Install Mailer Ruby Source System Web]
|
13
|
-
.each do |class_name|
|
14
|
-
include const_get(class_name)
|
15
|
-
end
|
16
|
-
end
|
9
|
+
require_sub __FILE__, include_modules: true
|
10
|
+
common_concern
|
17
11
|
end
|
18
12
|
end
|
19
13
|
end
|
data/lib/avm/instances/base.rb
CHANGED
@@ -53,7 +53,7 @@ module Avm
|
|
53
53
|
def host_env_uncached
|
54
54
|
install_uri = entry(::Avm::Instances::EntryKeys::INSTALL_URL).value.to_uri
|
55
55
|
case install_uri.scheme
|
56
|
-
when '
|
56
|
+
when 'file' then ::EacRubyUtils::Envs.local
|
57
57
|
when 'ssh' then ::EacRubyUtils::Envs.ssh(install_uri)
|
58
58
|
else raise("Unmapped access value: \"#{install_uri}\"")
|
59
59
|
end
|
@@ -49,7 +49,7 @@ module Avm
|
|
49
49
|
database: URI_FIELDS + %w[id limit name system timeout extra],
|
50
50
|
docker: %w[registry],
|
51
51
|
fs: %w[url],
|
52
|
-
install: URI_FIELDS + %w[id],
|
52
|
+
install: URI_FIELDS + %w[id groupname],
|
53
53
|
mailer: {
|
54
54
|
'' => %w[id from reply_to],
|
55
55
|
smtp: URI_FIELDS + %w[address domain authentication openssl_verify_mode starttls_auto tls]
|
data/lib/avm/instances/runner.rb
CHANGED
@@ -7,10 +7,12 @@ module Avm
|
|
7
7
|
module Instances
|
8
8
|
class Runner < ::Avm::Runners::Base
|
9
9
|
class << self
|
10
|
-
def
|
11
|
-
::Avm.
|
10
|
+
def application_stereotype
|
11
|
+
::Avm::Registry.application_stereotypes.detect(stereotype_name)
|
12
12
|
end
|
13
13
|
|
14
|
+
delegate :instance_class, to: :application_stereotype
|
15
|
+
|
14
16
|
def stereotype_module
|
15
17
|
::Avm.const_get(stereotype_name)
|
16
18
|
end
|
data/lib/avm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.36.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_cli
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '0.27'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.27.
|
22
|
+
version: 0.27.8
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '0.27'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.27.
|
32
|
+
version: 0.27.8
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: eac_config
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,62 +50,74 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.4'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.4.2
|
54
57
|
type: :runtime
|
55
58
|
prerelease: false
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
57
60
|
requirements:
|
58
61
|
- - "~>"
|
59
62
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0.
|
63
|
+
version: '0.4'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.4.2
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
68
|
name: eac_git
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
64
70
|
requirements:
|
65
71
|
- - "~>"
|
66
72
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0.
|
73
|
+
version: '0.12'
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.12.1
|
68
77
|
type: :runtime
|
69
78
|
prerelease: false
|
70
79
|
version_requirements: !ruby/object:Gem::Requirement
|
71
80
|
requirements:
|
72
81
|
- - "~>"
|
73
82
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0.
|
83
|
+
version: '0.12'
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.12.1
|
75
87
|
- !ruby/object:Gem::Dependency
|
76
88
|
name: eac_ruby_utils
|
77
89
|
requirement: !ruby/object:Gem::Requirement
|
78
90
|
requirements:
|
79
91
|
- - "~>"
|
80
92
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0.
|
93
|
+
version: '0.98'
|
82
94
|
type: :runtime
|
83
95
|
prerelease: false
|
84
96
|
version_requirements: !ruby/object:Gem::Requirement
|
85
97
|
requirements:
|
86
98
|
- - "~>"
|
87
99
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0.
|
100
|
+
version: '0.98'
|
89
101
|
- !ruby/object:Gem::Dependency
|
90
102
|
name: eac_templates
|
91
103
|
requirement: !ruby/object:Gem::Requirement
|
92
104
|
requirements:
|
93
105
|
- - "~>"
|
94
106
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0.
|
107
|
+
version: '0.3'
|
96
108
|
- - ">="
|
97
109
|
- !ruby/object:Gem::Version
|
98
|
-
version: 0.
|
110
|
+
version: 0.3.1
|
99
111
|
type: :runtime
|
100
112
|
prerelease: false
|
101
113
|
version_requirements: !ruby/object:Gem::Requirement
|
102
114
|
requirements:
|
103
115
|
- - "~>"
|
104
116
|
- !ruby/object:Gem::Version
|
105
|
-
version: '0.
|
117
|
+
version: '0.3'
|
106
118
|
- - ">="
|
107
119
|
- !ruby/object:Gem::Version
|
108
|
-
version: 0.
|
120
|
+
version: 0.3.1
|
109
121
|
- !ruby/object:Gem::Dependency
|
110
122
|
name: filesize
|
111
123
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,20 +138,20 @@ dependencies:
|
|
126
138
|
requirements:
|
127
139
|
- - "~>"
|
128
140
|
- !ruby/object:Gem::Version
|
129
|
-
version: '1.
|
141
|
+
version: '1.4'
|
130
142
|
- - ">="
|
131
143
|
- !ruby/object:Gem::Version
|
132
|
-
version: 1.
|
144
|
+
version: 1.4.2
|
133
145
|
type: :runtime
|
134
146
|
prerelease: false
|
135
147
|
version_requirements: !ruby/object:Gem::Requirement
|
136
148
|
requirements:
|
137
149
|
- - "~>"
|
138
150
|
- !ruby/object:Gem::Version
|
139
|
-
version: '1.
|
151
|
+
version: '1.4'
|
140
152
|
- - ">="
|
141
153
|
- !ruby/object:Gem::Version
|
142
|
-
version: 1.
|
154
|
+
version: 1.4.2
|
143
155
|
- !ruby/object:Gem::Dependency
|
144
156
|
name: minitar
|
145
157
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,8 +228,10 @@ files:
|
|
216
228
|
- lib/avm/entries.rb
|
217
229
|
- lib/avm/entries/auto_values.rb
|
218
230
|
- lib/avm/entries/auto_values/entry.rb
|
231
|
+
- lib/avm/entries/auto_values/uri_entry.rb
|
219
232
|
- lib/avm/entries/base.rb
|
220
233
|
- lib/avm/entries/entry.rb
|
234
|
+
- lib/avm/entries/uri_builder.rb
|
221
235
|
- lib/avm/executables.rb
|
222
236
|
- lib/avm/instances.rb
|
223
237
|
- lib/avm/instances/base.rb
|
@@ -230,7 +244,6 @@ files:
|
|
230
244
|
- lib/avm/instances/base/auto_values/mailer.rb
|
231
245
|
- lib/avm/instances/base/auto_values/ruby.rb
|
232
246
|
- lib/avm/instances/base/auto_values/source.rb
|
233
|
-
- lib/avm/instances/base/auto_values/system.rb
|
234
247
|
- lib/avm/instances/base/auto_values/web.rb
|
235
248
|
- lib/avm/instances/base/dockerizable.rb
|
236
249
|
- lib/avm/instances/base/entry_keys.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'addressable'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Instances
|
7
|
-
class Base
|
8
|
-
module AutoValues
|
9
|
-
module System
|
10
|
-
def auto_system_username
|
11
|
-
inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'system.username') ||
|
12
|
-
read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
|
13
|
-
end
|
14
|
-
|
15
|
-
def auto_system_groupname
|
16
|
-
inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'system.groupname') ||
|
17
|
-
read_entry_optional('system.username')
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|