foreman-tasks 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -43,13 +43,15 @@ module Actions
|
|
43
43
|
link: link_to_resource(type, data, other_data) }
|
44
44
|
end
|
45
45
|
|
46
|
+
# TODO: this probably is not the best place for this logic, find
|
47
|
+
# out where to put this
|
46
48
|
def link_to_resource(type, data, other_data)
|
47
49
|
case type
|
48
50
|
when :product
|
49
|
-
"#/products/#{data[:
|
51
|
+
"#/products/#{data[:id]}/info" if data[:id]
|
50
52
|
when :repository
|
51
|
-
if other_data[:product] && other_data[:product][:
|
52
|
-
"#/products/#{other_data[:product][:
|
53
|
+
if other_data[:product] && other_data[:product][:id] && data[:id]
|
54
|
+
"#/products/#{other_data[:product][:id]}/repositories/#{data[:id]}"
|
53
55
|
end
|
54
56
|
when :system
|
55
57
|
if data[:uuid]
|
@@ -57,7 +59,7 @@ module Actions
|
|
57
59
|
end
|
58
60
|
when :organization
|
59
61
|
if data[:label]
|
60
|
-
"/
|
62
|
+
"/organizations/#{data[:id]}/edit"
|
61
63
|
end
|
62
64
|
end
|
63
65
|
end
|
@@ -19,10 +19,6 @@ module ForemanTasks
|
|
19
19
|
# between this process and the external executor
|
20
20
|
attr_accessor :remote_socket_path
|
21
21
|
|
22
|
-
# what persistence adapater should be used, by default, it uses Sequlel
|
23
|
-
# adapter based on Rails app database.yml configuration
|
24
|
-
attr_accessor :persistence_adapter
|
25
|
-
|
26
22
|
# what transaction adapater should be used, by default, it uses the ActiveRecord
|
27
23
|
# based adapter, expecting ActiveRecord is used as ORM in the application
|
28
24
|
attr_accessor :transaction_adapter
|
@@ -37,7 +33,6 @@ module ForemanTasks
|
|
37
33
|
self.pool_size = 5
|
38
34
|
self.remote = Rails.env.production?
|
39
35
|
self.remote_socket_path = File.join(Rails.root, "tmp", "sockets", "dynflow_socket")
|
40
|
-
self.persistence_adapter = default_persistence_adapter
|
41
36
|
self.transaction_adapter = ::Dynflow::TransactionAdapters::ActiveRecord.new
|
42
37
|
self.eager_load_paths = []
|
43
38
|
self.lazy_initialization = !Rails.env.production?
|
@@ -59,15 +54,11 @@ module ForemanTasks
|
|
59
54
|
def world_options
|
60
55
|
{ logger_adapter: ::Dynflow::LoggerAdapters::Delegator.new(action_logger, dynflow_logger),
|
61
56
|
pool_size: 5,
|
62
|
-
persistence_adapter:
|
57
|
+
persistence_adapter: initialize_persistence,
|
63
58
|
transaction_adapter: transaction_adapter,
|
64
59
|
executor: -> world { initialize_executor world } }
|
65
60
|
end
|
66
61
|
|
67
|
-
def default_persistence_adapter
|
68
|
-
ForemanTasks::Dynflow::Persistence.new(default_sequel_adapter_options)
|
69
|
-
end
|
70
|
-
|
71
62
|
def default_sequel_adapter_options
|
72
63
|
db_config = ActiveRecord::Base.configurations[Rails.env].dup
|
73
64
|
db_config['adapter'] = 'postgres' if db_config['adapter'] == 'postgresql'
|
@@ -91,5 +82,10 @@ module ForemanTasks
|
|
91
82
|
::Dynflow::Executors::Parallel.new(world, self.pool_size)
|
92
83
|
end
|
93
84
|
end
|
85
|
+
|
86
|
+
# Sequel adapter based on Rails app database.yml configuration
|
87
|
+
def initialize_persistence
|
88
|
+
ForemanTasks::Dynflow::Persistence.new(default_sequel_adapter_options)
|
89
|
+
end
|
94
90
|
end
|
95
91
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|