foreman-tasks 0.7.19 → 0.7.20

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: 8bbd40d07b988d8b36e5f1d55152521fafbea8b1
4
- data.tar.gz: f8a5d50f3fb07ff87aa30c9ba09ec61fe6fdf310
3
+ metadata.gz: d050fd7d55d78ed330c5da74b31f7a340f652d85
4
+ data.tar.gz: 35e4c705611f00c5323dcdcca943d41a71dc988a
5
5
  SHA512:
6
- metadata.gz: c96d92ad1ca7384ef68f31a33591264ab743d134faaa5c5cd65dc2781a6f9b95494b1034e9aa16eedc2dc2ebd6d56586642a8520090d6520db7adc012c69dc14
7
- data.tar.gz: 48126f7110b2f2f0ce10daa31c904af9f902d0528eb0510297be896518ef88aaa26fbcdd9ef4d08082c41721bb3dd1ae60fb8c3d47049ac58d60f19a7ea2b803
6
+ metadata.gz: 962203d2e16abf60f2b3b491bc3e14a1c229241609ff0701b3a736058d4bcd257ec2ec0174ffabdd938e7e1da60264ae118fc399ebd1d1f550d1d28142db0265
7
+ data.tar.gz: 612fa5a8838f36dd8b5cb4ad2321791ecf450d6bc5c6872092ad730f94a8da36ff660b3644887377307cebe0b070e9dc267d32e2562f933651c0816a71e84d3c
data/README.md CHANGED
@@ -32,7 +32,9 @@ Add the following to bundler.d/Gemfile.local.rb in your Foreman installation dir
32
32
 
33
33
  $ gem 'foreman-tasks'
34
34
 
35
- Then run `bundle install` and `foreman-rake db:migrate` from the same directory
35
+ Then run `bundle install` and `foreman-rake db:migrate` from the same directory. Note that you must start the
36
+ dynflow executor (background processor) manually. You can find example service script in
37
+ extra/dynflow-executor.example in this repository.
36
38
 
37
39
  --------------
38
40
 
@@ -1,6 +1,7 @@
1
1
  module ForemanTasks
2
2
  module TasksHelper
3
3
  def format_task_input(task, include_action = false)
4
+ return '-' unless task
4
5
  parts = []
5
6
  parts << task.get_humanized(:name) if include_action
6
7
  parts << Array(task.get_humanized(:input)).map do |part|
@@ -123,5 +123,11 @@ module ForemanTasks
123
123
  :state => data[:state].to_s,
124
124
  :result => data[:result].to_s)
125
125
  end
126
+
127
+ private
128
+
129
+ def self.model_name
130
+ superclass.model_name
131
+ end
126
132
  end
127
133
  end
@@ -0,0 +1,77 @@
1
+ # Author: Riley Shott
2
+ # https://gist.github.com/Ginja/fb123759d48b04b5f338
3
+ # dynflow-executor - starts or stops the Dynflow executor for Foreman tasks
4
+ #
5
+ # chkconfig: 345 99 20
6
+ # description: dynflow-executor is a rake task that comes with \
7
+ # the foreman-tasks gem
8
+ # processname: dynflow-executor
9
+ # pidfile: /usr/local/foreman/tmp/pids/dynflow_executor_monitor.pid
10
+ # pidfile: /usr/local/foreman/tmp/pids/dynflow_executor.pid
11
+
12
+ # Source function library.
13
+ . /etc/rc.d/init.d/functions
14
+
15
+ foreman_user='foreman'
16
+ rvm='/usr/local/.rvm/bin/rvm'
17
+ gemset='ruby-2.1.5@foreman-1.9.1'
18
+ foreman_app_path='/usr/local/foreman'
19
+ dynflow_executor="$(cd $foreman_app_path && $rvm $gemset do bundle show foreman-tasks)/bin/dynflow-executor"
20
+ rvm_do_dynflow="RAILS_ENV=production ${rvm} ${gemset} do ${dynflow_executor}"
21
+ prog=$(basename $dynflow_executor)
22
+
23
+ [ -f /etc/sysconfig/dynflow-executor ] && . /etc/sysconfig/dynflow-executor
24
+
25
+ start() {
26
+ [ -x $dynflow_executor ] || exit 5
27
+ echo -n $"Starting $prog: "
28
+ su - $foreman_user -c "cd ${foreman_app_path} && ${rvm_do_dynflow} start"
29
+ RETVAL=$?
30
+ if [ $RETVAL -eq 0 ]
31
+ then success
32
+ else failure
33
+ fi
34
+ echo
35
+ return $RETVAL
36
+ }
37
+
38
+ stop() {
39
+ echo -n $"Stopping $prog: "
40
+ cd "${foreman_app_path}"
41
+ su - $foreman_user -c "cd ${foreman_app_path} && ${rvm_do_dynflow} stop"
42
+ RETVAL=$?
43
+ if [ $RETVAL -eq 0 ]
44
+ then success
45
+ else failure
46
+ fi
47
+ echo
48
+ return $RETVAL
49
+ }
50
+
51
+ status() {
52
+ pgrep -f -u $foreman_user dynflow_executor -l
53
+ }
54
+
55
+ restart() {
56
+ stop
57
+ sleep 2
58
+ start
59
+ }
60
+
61
+ case "$1" in
62
+ start)
63
+ $1
64
+ ;;
65
+ stop)
66
+ $1
67
+ ;;
68
+ status)
69
+ $1
70
+ ;;
71
+ restart)
72
+ $1
73
+ ;;
74
+ *)
75
+ echo $"Usage: $0 {start|stop|status|restart}"
76
+ exit 2
77
+ esac
@@ -81,7 +81,7 @@ namespace :foreman_tasks do
81
81
  end
82
82
 
83
83
  def load_action(step)
84
- world.persistence.load_action(step)
84
+ world.persistence.load_action_for_presentation(@plan, step.action_id, step)
85
85
  end
86
86
 
87
87
  def step_error(step)
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = "0.7.19"
2
+ VERSION = "0.7.20"
3
3
  end
@@ -15,6 +15,9 @@ module ForemanTasks
15
15
  format_task_input(@task, true).must_equal("Create user 'Anonymous Admin'")
16
16
  end
17
17
 
18
+ it 'displays the dash if task is nil' do
19
+ format_task_input(nil, true).must_equal('-')
20
+ end
18
21
  end
19
22
 
20
23
  describe 'when formatting input' do
@@ -37,5 +40,7 @@ module ForemanTasks
37
40
  format_task_input(@task, true).must_equal("Create #{response}")
38
41
  end
39
42
  end
43
+
44
+ end
40
45
  end
41
46
  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.7.19
4
+ version: 0.7.20
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: 2016-06-28 00:00:00.000000000 Z
11
+ date: 2016-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow
@@ -185,6 +185,7 @@ files:
185
185
  - deploy/foreman-tasks.init
186
186
  - deploy/foreman-tasks.service
187
187
  - deploy/foreman-tasks.sysconfig
188
+ - extra/dynflow-executor.example
188
189
  - foreman-tasks.gemspec
189
190
  - lib/foreman-tasks.rb
190
191
  - lib/foreman_tasks.rb