smart_proxy_dynflow_core 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,74 @@
1
+ require 'ostruct'
2
+
3
+ module SmartProxyDynflowCore
4
+ class Settings < OpenStruct
5
+
6
+ DEFAULT_SETTINGS = {
7
+ :database => '/var/lib/foreman-proxy/dynflow/dynflow.sqlite',
8
+ :callback_url => 'https://127.0.0.1:8443',
9
+ :console_auth => true,
10
+ :foreman_url => 'http://127.0.0.1:3000',
11
+ :listen => '127.0.0.1',
12
+ :port => '8008',
13
+ :use_https => false,
14
+ :ssl_ca_file => nil,
15
+ :ssl_private_key => nil,
16
+ :ssl_certificate => nil,
17
+ :standalone => false,
18
+ :plugins => {}
19
+ }
20
+
21
+ def initialize(settings = {})
22
+ super(DEFAULT_SETTINGS.merge(settings))
23
+ end
24
+
25
+ def self.instance
26
+ SmartProxyDynflowCore::SETTINGS
27
+ end
28
+
29
+ def self.load_global_settings(path)
30
+ if File.exists? File.join(path)
31
+ YAML.load_file(path).each do |key, value|
32
+ SETTINGS[key] = value
33
+ end
34
+ end
35
+ end
36
+
37
+ def self.load_from_proxy(plugin)
38
+ [:ssl_certificate, :ssl_ca_file, :ssl_private_key, :foreman_url].each do |key|
39
+ SETTINGS[key] = Proxy::SETTINGS[key]
40
+ end
41
+ SETTINGS.callback_url = SETTINGS.foreman_url
42
+ [:database, :core_url, :console_auth].each do |key|
43
+ SETTINGS[key] = plugin.settings[key]
44
+ end
45
+ SETTINGS.plugins.values.each { |plugin| plugin.load_settings_from_proxy }
46
+ end
47
+
48
+ def self.load_plugin_settings(path)
49
+ settings = YAML.load_file(path)
50
+ name = File.basename(path).gsub(/\.yml$/, '')
51
+ if SETTINGS.plugins.key? name
52
+ settings = SETTINGS.plugins[name].to_h.merge(settings)
53
+ end
54
+ SETTINGS.plugins[name] = OpenStruct.new settings
55
+ end
56
+
57
+ # Implement hash-like access for 1.9.3 and older
58
+ if RUBY_VERSION.split('.').first.to_i < 2
59
+ def [](key)
60
+ self.send key
61
+ end
62
+
63
+ def []=(key, value)
64
+ self.send "#{key}=", value
65
+ end
66
+
67
+ def to_h
68
+ marshal_dump
69
+ end
70
+ end
71
+ end
72
+ end
73
+
74
+ SmartProxyDynflowCore::SETTINGS = SmartProxyDynflowCore::Settings.new
@@ -0,0 +1,27 @@
1
+ require 'dynflow/testing'
2
+
3
+ unless defined? DYNFLOW_TESTING_LOG_LEVEL
4
+ DYNFLOW_TESTING_LOG_LEVEL = 4
5
+ end
6
+
7
+ module SmartProxyDynflowCore
8
+ class Dynflow
9
+ # Helper for usage in other dependent plugins that need Dynflow
10
+ # related things, such as testing instance of world etc.
11
+ module Testing
12
+ class << self
13
+ def create_world(&block)
14
+ Core.ensure_initialized
15
+ Core.instance.create_world do |config|
16
+ config.exit_on_terminate = false
17
+ config.auto_terminate = false
18
+ config.logger_adapter = ::Dynflow::LoggerAdapters::Simple.new $stderr, DYNFLOW_TESTING_LOG_LEVEL
19
+ block.call(config) if block
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ Concurrent.disable_at_exit_handlers!
@@ -0,0 +1,3 @@
1
+ module SmartProxyDynflowCore
2
+ VERSION = '0.0.7'
3
+ end
metadata ADDED
@@ -0,0 +1,242 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smart_proxy_dynflow_core
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.7
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Nečas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mocha
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rack-test
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.32.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.32.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: dynflow
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.8.4
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.8.4
125
+ - !ruby/object:Gem::Dependency
126
+ name: sequel
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: sqlite3
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: sinatra
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '1.4'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '1.4'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rack
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rest-client
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ description: " Use the Dynflow inside Foreman smart proxy\n"
196
+ email:
197
+ - inecas@redhat.com
198
+ executables: []
199
+ extensions: []
200
+ extra_rdoc_files: []
201
+ files:
202
+ - Gemfile
203
+ - LICENSE
204
+ - bin/smart_proxy_dynflow_core
205
+ - bundler.d/dynflow.rb
206
+ - config/settings.yml.example
207
+ - lib/smart_proxy_dynflow_core.rb
208
+ - lib/smart_proxy_dynflow_core/api.rb
209
+ - lib/smart_proxy_dynflow_core/bundler_helper.rb
210
+ - lib/smart_proxy_dynflow_core/callback.rb
211
+ - lib/smart_proxy_dynflow_core/core.rb
212
+ - lib/smart_proxy_dynflow_core/helpers.rb
213
+ - lib/smart_proxy_dynflow_core/launcher.rb
214
+ - lib/smart_proxy_dynflow_core/settings.rb
215
+ - lib/smart_proxy_dynflow_core/testing.rb
216
+ - lib/smart_proxy_dynflow_core/version.rb
217
+ homepage: https://github.com/theforeman/smart_proxy_dynflow
218
+ licenses:
219
+ - GPLv3
220
+ metadata: {}
221
+ post_install_message:
222
+ rdoc_options: []
223
+ require_paths:
224
+ - lib
225
+ required_ruby_version: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ required_rubygems_version: !ruby/object:Gem::Requirement
231
+ requirements:
232
+ - - ">="
233
+ - !ruby/object:Gem::Version
234
+ version: '0'
235
+ requirements: []
236
+ rubyforge_project:
237
+ rubygems_version: 2.4.8
238
+ signing_key:
239
+ specification_version: 4
240
+ summary: Dynflow runtime for Foreman smart proxy
241
+ test_files: []
242
+ has_rdoc: