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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f1ef8e297d56025b9460e44ca7e96e753307d55
4
- data.tar.gz: a26e87a7cd3abda09035c1b63747234a77c0562f
3
+ metadata.gz: 2e10fb3f1d62ca016568197df4df727b25c73b68
4
+ data.tar.gz: 506d7b4cc63c11fbd931667258122ee48f03a504
5
5
  SHA512:
6
- metadata.gz: 0bf2da8785b5fb0504c110b4089b2a27fcb30173a6c060f0171295d77c4d3240192406822a38872edeb102beacfdd0f3fd462a03bcb5d2c9992de2a1b08b3fab
7
- data.tar.gz: f95dcdf3437613f5c702df30248c6f962db176e88e2474edba21db0d97d362af4d554ccaecee5726fdef27686f2869eef2fb7853ce9fa26fb3458ade1f947a66
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
- ::Actions::ProxyAction::CallbackData.new(params[:data]))
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
@@ -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;" | su - postgres -c '/usr/bin/psql -d foreman' > $2
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
- 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"
15
- 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"
16
- 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"
17
- export_csv "select * from dynflow_schema_info" "$DIR/dynflow_schema_info.csv"
18
- export_csv "select * from foreman_tasks_tasks" "$DIR/foreman_tasks_tasks.csv"
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
 
@@ -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.26'
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
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '0.10.1'.freeze
2
+ VERSION = '0.10.2'.freeze
3
3
  end
@@ -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
- logic.end_time.must_equal triggering.end_time
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
@@ -122,6 +122,7 @@ class TasksTest < ActiveSupport::TestCase
122
122
  it 'can indicate it is recurring' do
123
123
  refute task.recurring?
124
124
  task.add_missing_task_groups(logic.task_group)
125
+ task.reload
125
126
  assert task.recurring?
126
127
  end
127
128
  end
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.1
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-12 00:00:00.000000000 Z
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.26
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.26
40
+ version: 0.8.29
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sinatra
43
43
  requirement: !ruby/object:Gem::Requirement