foreman-tasks 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +2 -1
- data/app/models/foreman_tasks/task.rb +3 -1
- data/extra/dynflow-debug.sh +28 -7
- data/foreman-tasks.gemspec +1 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/test/unit/recurring_logic_test.rb +2 -1
- data/test/unit/task_test.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e10fb3f1d62ca016568197df4df727b25c73b68
|
4
|
+
data.tar.gz: 506d7b4cc63c11fbd931667258122ee48f03a504
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fe503d8cbfce8eec1ea48f0add2442d1df0acb2729f53d391dfd5068ebf975722f69ffd0801780fae770c02958b3909c466668d368ad39ca345ca6acb9dd2d9
|
7
|
+
data.tar.gz: 910f71926669c46ef32a8c55a1b666c2a74ac810d176e27c0dfcf451e49b814af871ebf0639d70dc1378d01be48167c0d53c4bf3bd514e02d8302f6c3bb49355
|
@@ -156,7 +156,8 @@ module ForemanTasks
|
|
156
156
|
task = ForemanTasks::Task::DynflowTask.find(params[:callback][:task_id])
|
157
157
|
ForemanTasks.dynflow.world.event(task.external_id,
|
158
158
|
params[:callback][:step_id].to_i,
|
159
|
-
::
|
159
|
+
# We need to call .to_unsafe_h to unwrap the hash from ActionController::Parameters
|
160
|
+
::Actions::ProxyAction::CallbackData.new(params[:data].to_unsafe_h))
|
160
161
|
render :json => { :message => 'processing' }.to_json
|
161
162
|
end
|
162
163
|
|
@@ -51,7 +51,7 @@ module ForemanTasks
|
|
51
51
|
:rename => 'owner.id',
|
52
52
|
:ext_method => :search_by_owner,
|
53
53
|
:validator => ->(value) { ScopedSearch::Validators::INTEGER.call(value) || value == 'current_user' }
|
54
|
-
scoped_search :relation => :owners, :on => :login, :complete_value => true, :rename => 'owner.login', :ext_method => :search_by_owner
|
54
|
+
scoped_search :relation => :owners, :on => :login, :complete_value => true, :rename => 'owner.login', :ext_method => :search_by_owner, :aliases => [:user]
|
55
55
|
scoped_search :relation => :owners, :on => :firstname, :complete_value => true, :rename => 'owner.firstname', :ext_method => :search_by_owner
|
56
56
|
scoped_search :relation => :task_groups, :on => :id, :complete_value => true, :rename => 'task_group.id', :validator => ScopedSearch::Validators::INTEGER
|
57
57
|
|
@@ -133,6 +133,7 @@ module ForemanTasks
|
|
133
133
|
def self.search_by_owner(key, operator, value)
|
134
134
|
return { :conditions => '0 = 1' } if value == 'current_user' && User.current.nil?
|
135
135
|
|
136
|
+
key = 'owners.login' if key == 'user'
|
136
137
|
key_name = connection.quote_column_name(key.sub(/^.*\./, ''))
|
137
138
|
joins = <<-SQL
|
138
139
|
INNER JOIN foreman_tasks_locks AS foreman_tasks_locks_owner
|
@@ -176,6 +177,7 @@ module ForemanTasks
|
|
176
177
|
def add_missing_task_groups(groups)
|
177
178
|
groups = [groups] unless groups.is_a? Array
|
178
179
|
(groups - task_groups).each { |group| task_groups << group }
|
180
|
+
save!
|
179
181
|
end
|
180
182
|
|
181
183
|
def sub_tasks_counts
|
data/extra/dynflow-debug.sh
CHANGED
@@ -3,17 +3,38 @@
|
|
3
3
|
# This file provides additional debug information for foreman-debug tool and is
|
4
4
|
# symlinked as /usr/share/foreman/script/foreman-debug.d/60-dynflow_debug
|
5
5
|
|
6
|
+
FOREMAN_PSQL_COMMAND=$(ruby -ryaml <<-END
|
7
|
+
db = YAML.load_file('/etc/foreman/database.yml')['production']
|
8
|
+
puts [
|
9
|
+
"PGPASSWORD='#{db['password']}'",
|
10
|
+
'psql',
|
11
|
+
'-U', "'#{db.fetch('username')}'",
|
12
|
+
'-h', "'#{db['host'] || 'localhost'}'",
|
13
|
+
'-p', "'#{(db['port'] || 5432).to_s}'",
|
14
|
+
'-d', "'#{db.fetch('database')}'"
|
15
|
+
].join(' ')
|
16
|
+
END
|
17
|
+
)
|
18
|
+
|
19
|
+
FOREMAN_DB_ADAPTER=$(ruby -ryaml <<-END
|
20
|
+
puts YAML.load_file('/etc/foreman/database.yml')['production']['adapter']
|
21
|
+
END
|
22
|
+
)
|
23
|
+
|
6
24
|
export_csv() {
|
7
|
-
echo "COPY ($1) TO STDOUT WITH CSV;" |
|
25
|
+
echo "COPY ($1) TO STDOUT WITH CSV;" | eval $FOREMAN_PSQL_COMMAND > $2
|
8
26
|
}
|
9
27
|
|
10
28
|
add_files /var/log/foreman/dynflow_executor*.log*
|
11
29
|
add_files /var/log/foreman/dynflow_executor*.output*
|
12
30
|
|
13
|
-
# Foreman Tasks fast export (for HTML version use foreman-rake foreman_tasks:export_tasks)
|
14
|
-
|
15
|
-
|
16
|
-
export_csv "select
|
17
|
-
export_csv "select
|
18
|
-
export_csv "select
|
31
|
+
# Foreman Tasks fast export (Postgresql only; for HTML version use foreman-rake foreman_tasks:export_tasks)
|
32
|
+
|
33
|
+
if [ "$FOREMAN_DB_ADAPTER" == "postgresql" ]; then
|
34
|
+
export_csv "select dynflow_execution_plans.* from foreman_tasks_tasks join dynflow_execution_plans on (foreman_tasks_tasks.external_id = dynflow_execution_plans.uuid) where foreman_tasks_tasks.started_at > 'now'::timestamp - '${DYNFLOW_EXPORT_MONTHS:-6} months'::interval" "$DIR/dynflow_execution_plans.csv"
|
35
|
+
export_csv "select dynflow_actions.* from foreman_tasks_tasks join dynflow_actions on (foreman_tasks_tasks.external_id = dynflow_actions.execution_plan_uuid) where foreman_tasks_tasks.started_at > 'now'::timestamp - '${DYNFLOW_EXPORT_MONTHS:-6} months'::interval" "$DIR/dynflow_actions.csv"
|
36
|
+
export_csv "select dynflow_steps.* from foreman_tasks_tasks join dynflow_steps on (foreman_tasks_tasks.external_id = dynflow_steps.execution_plan_uuid) where foreman_tasks_tasks.started_at > 'now'::timestamp - '${DYNFLOW_EXPORT_MONTHS:-6} months'::interval" "$DIR/dynflow_steps.csv"
|
37
|
+
export_csv "select * from dynflow_schema_info" "$DIR/dynflow_schema_info.csv"
|
38
|
+
export_csv "select * from foreman_tasks_tasks" "$DIR/foreman_tasks_tasks.csv"
|
39
|
+
fi
|
19
40
|
|
data/foreman-tasks.gemspec
CHANGED
@@ -29,7 +29,7 @@ same resource. It also optionally provides Dynflow infrastructure for using it f
|
|
29
29
|
s.extra_rdoc_files = Dir['README*', 'LICENSE']
|
30
30
|
|
31
31
|
s.add_dependency "foreman-tasks-core"
|
32
|
-
s.add_dependency "dynflow", '~> 0.8.
|
32
|
+
s.add_dependency "dynflow", '~> 0.8.29'
|
33
33
|
s.add_dependency "sinatra" # for Dynflow web console
|
34
34
|
s.add_dependency "parse-cron", '~> 0.1.4'
|
35
35
|
s.add_dependency "get_process_mem" # for memory polling
|
@@ -91,7 +91,8 @@ class RecurringLogicsTest < ActiveSupport::TestCase
|
|
91
91
|
it 'can be created from triggering' do
|
92
92
|
triggering = FactoryGirl.build(:triggering, :recurring, :end_time_limited)
|
93
93
|
logic = ForemanTasks::RecurringLogic.new_from_triggering(triggering)
|
94
|
-
|
94
|
+
# Mysql coerces the times a bit
|
95
|
+
logic.end_time.must_be_close_to(triggering.end_time, 1.second)
|
95
96
|
end
|
96
97
|
|
97
98
|
describe 'validation' do
|
data/test/unit/task_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foreman-tasks-core
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.8.
|
33
|
+
version: 0.8.29
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.8.
|
40
|
+
version: 0.8.29
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sinatra
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|