foreman-tasks 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/foreman_tasks/tasks.css.scss +9 -0
- data/app/helpers/foreman_tasks/foreman_tasks_helper.rb +35 -0
- data/app/models/foreman_tasks/concerns/action_triggering.rb +5 -0
- data/app/models/foreman_tasks/task.rb +4 -0
- data/app/views/foreman_tasks/tasks/_details.html.erb +76 -73
- data/app/views/foreman_tasks/tasks/_locks.html.erb +16 -10
- data/app/views/foreman_tasks/tasks/_raw.html.erb +15 -3
- data/app/views/foreman_tasks/tasks/index.html.erb +1 -12
- data/app/views/foreman_tasks/tasks/show.html.erb +2 -0
- data/foreman-tasks.gemspec +1 -1
- data/lib/foreman_tasks/dynflow.rb +4 -0
- data/lib/foreman_tasks/dynflow/configuration.rb +2 -2
- data/lib/foreman_tasks/engine.rb +0 -1
- data/lib/foreman_tasks/test_helpers.rb +23 -0
- data/lib/foreman_tasks/version.rb +1 -1
- metadata +6 -8
- data/app/lib/actions/foreman/architecture/create.rb +0 -29
- data/app/lib/actions/foreman/architecture/destroy.rb +0 -28
- data/app/lib/actions/foreman/architecture/update.rb +0 -21
- data/app/models/foreman_tasks/concerns/architecture_action_subject.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 389ffc4bd5e783510bbc816f36d6d5d34348e6a5
|
4
|
+
data.tar.gz: 86f92a216b1429f52d5b0ab3fe1abc06f46151ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2dcec67bfe4d2dbda1ac3debced3e5a40121c22e324927f67bfda3371b847aa93568ad219fc8ca4c09c8140d8488a08184b333b4d2f372d42aa7f66c037c90b
|
7
|
+
data.tar.gz: b82fa528ef6d581c2c98b375f27f705d0a9e1e6928630f84e0cd6349eaf1a0f747f57d6caff01421d0e8d06f59415581ed8d90221ce15fd03bd80f51810d977e
|
@@ -16,6 +16,41 @@ module ForemanTasks
|
|
16
16
|
content_tag(:i, ' '.html_safe, :class => "glyphicon #{icon}") + content_tag(:span, recurring_logic.humanized_state, :class => status)
|
17
17
|
end
|
18
18
|
|
19
|
+
def task_result_icon_class(task)
|
20
|
+
return 'task-status pficon-help' if task.state != 'stopped'
|
21
|
+
|
22
|
+
icon_class = case task.result
|
23
|
+
when 'success'
|
24
|
+
'pficon-ok'
|
25
|
+
when 'error'
|
26
|
+
'pficon-error-circle-o'
|
27
|
+
when 'warning'
|
28
|
+
'pficon-ok status-warn'
|
29
|
+
else
|
30
|
+
'pficon-help'
|
31
|
+
end
|
32
|
+
|
33
|
+
"task-status #{icon_class}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def time_in_words_span(time)
|
37
|
+
if time.nil?
|
38
|
+
_('N/A')
|
39
|
+
else
|
40
|
+
content_tag :span, (time > Time.now.utc ? _('in %s') : _('%s ago')) % time_ago_in_words(time),
|
41
|
+
{ :'data-original-title' => time.try(:in_time_zone), :rel => 'twipsy' }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def duration_in_words_span(start, finish)
|
46
|
+
if start.nil?
|
47
|
+
_('N/A')
|
48
|
+
else
|
49
|
+
content_tag :span, distance_of_time_in_words(start, finish),
|
50
|
+
{ :'data-original-title' => number_with_delimiter((finish - start).to_i) + _(' seconds'), :rel => 'twipsy' }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
19
54
|
def recurring_logic_action_buttons(recurring_logic)
|
20
55
|
buttons = []
|
21
56
|
if authorized_for(:permission => :edit_recurring_logics, :auth_object => recurring_logic)
|
@@ -141,6 +141,11 @@ module ForemanTasks
|
|
141
141
|
# we don't want to start executing the task calling to external services
|
142
142
|
# when inside some other transaction. Might lead to unexpected results
|
143
143
|
def ensure_not_in_transaction!
|
144
|
+
# we don't care about transactions when using InThreadWorld
|
145
|
+
if defined?(::Dynflow::Testing::InThreadWorld) &&
|
146
|
+
ForemanTasks.dynflow.world.is_a?(::Dynflow::Testing::InThreadWorld)
|
147
|
+
return
|
148
|
+
end
|
144
149
|
if self.class.connection.open_transactions > 0
|
145
150
|
raise 'Executing dynflow action inside a transaction is not a good idea'
|
146
151
|
end
|
@@ -13,6 +13,12 @@
|
|
13
13
|
cancel_foreman_tasks_task_path(@task),
|
14
14
|
class: ['btn', 'btn-sm', 'btn-primary', ('disabled' unless @task.cancellable?)].compact,
|
15
15
|
method: :post) %>
|
16
|
+
<% if @task.parent_task %>
|
17
|
+
<%= link_to(_("Parent task"), foreman_tasks_task_path(@task.parent_task), class: ['btn', 'btn-sm', 'btn-default']) %>
|
18
|
+
<% end %>
|
19
|
+
<% if @task.sub_tasks.any? %>
|
20
|
+
<%= link_to(_("Sub tasks"), sub_tasks_foreman_tasks_task_path(@task), class: ['btn', 'btn-sm', 'btn-default']) %>
|
21
|
+
<% end %>
|
16
22
|
<% if Setting['dynflow_allow_dangerous_actions'] %>
|
17
23
|
<%= link_to(_('Unlock'),
|
18
24
|
'',
|
@@ -79,72 +85,68 @@
|
|
79
85
|
</div>
|
80
86
|
</div>
|
81
87
|
|
82
|
-
<div>
|
83
|
-
<
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
<
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
</
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
<
|
111
|
-
|
112
|
-
|
113
|
-
</div>
|
114
|
-
|
115
|
-
<
|
116
|
-
|
117
|
-
|
118
|
-
<
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
<
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
<
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
</div>
|
134
|
-
<% end %>
|
135
|
-
<% if @task.sub_tasks.any? %>
|
136
|
-
<div>
|
137
|
-
<span class="param-name"><%= link_to(_("Sub tasks"), sub_tasks_foreman_tasks_task_path(@task)) %></span>
|
88
|
+
<div class="row">
|
89
|
+
<div class="col-md-6">
|
90
|
+
<div>
|
91
|
+
<span class="param-name list-group-item-heading"><%= _("Name") %>:</span>
|
92
|
+
<% task_label = format_task_input(@task, true) %>
|
93
|
+
<span class="param-value" data-original-title="<%= task_label %>" rel="twipsy"> <%= truncate(task_label, :length => 50) %></span>
|
94
|
+
</div>
|
95
|
+
<div>
|
96
|
+
<span class="param-name list-group-item-heading"><%= _("Result") %>:</span>
|
97
|
+
<span class="param-value">
|
98
|
+
<% if @task.state != 'stopped' %>
|
99
|
+
<%= content_tag(:i, ' '.html_safe, :class => 'task-status pficon-help') %>
|
100
|
+
<% else %>
|
101
|
+
<%= content_tag(:i, ' '.html_safe, :class => task_result_icon_class(@task)) + content_tag(:span, @task.result) %>
|
102
|
+
<% end %>
|
103
|
+
</span>
|
104
|
+
</div>
|
105
|
+
<div>
|
106
|
+
<span class="param-name list-group-item-heading"><%= _("Triggered by") %>:</span>
|
107
|
+
<span class="param-value">
|
108
|
+
<% if @task.owner.present? && @task.username != User::ANONYMOUS_API_ADMIN && @task.username != User::ANONYMOUS_ADMIN %>
|
109
|
+
<%= link_to_if_authorized(@task.username, hash_for_edit_user_path(@task.owner)) %>
|
110
|
+
<% else %>
|
111
|
+
<%= @task.username %>
|
112
|
+
<% end %>
|
113
|
+
</span>
|
114
|
+
</div>
|
115
|
+
<div>
|
116
|
+
<span class="param-name list-group-item-heading"><%= _("Execution type") %>:</span>
|
117
|
+
<span class="param-value"><%= _(@task.execution_type) %></span>
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
<div class="col-md-6">
|
122
|
+
<div>
|
123
|
+
<span class="param-name list-group-item-heading"><%= _("Start at") %>:</span>
|
124
|
+
<span class="param-value"><%= @task.start_at.nil? ? '-' : time_in_words_span(@task.start_at) %></span>
|
125
|
+
</div>
|
126
|
+
<div>
|
127
|
+
<span class="param-name list-group-item-heading"><%= _("Started at") %>:</span>
|
128
|
+
<span class="param-value"><%= time_in_words_span @task.started_at.try(:in_time_zone) %></span>
|
129
|
+
</div>
|
130
|
+
<div>
|
131
|
+
<span class="param-name list-group-item-heading"><%= _("Ended at") %>:</span>
|
132
|
+
<span class="param-value"><%= time_in_words_span @task.ended_at.try(:in_time_zone) %></span>
|
133
|
+
</div>
|
134
|
+
<div>
|
135
|
+
<span class="param-name list-group-item-heading"><%= _("Start before") %>:</span>
|
136
|
+
<span class="param-value"><%= @task.start_before.nil? ? '-' : time_in_words_span(@task.start_before) %></span>
|
137
|
+
</div>
|
138
|
+
</div>
|
138
139
|
</div>
|
139
|
-
|
140
|
+
|
141
|
+
<br />
|
142
|
+
|
140
143
|
<div class="row">
|
141
|
-
<div class="col-xs-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
case @task.result
|
144
|
+
<div class="col-xs-12">
|
145
|
+
<% progress = 100 * @task.progress %>
|
146
|
+
<% progress_class = if @task.state == 'running'
|
147
|
+
nil
|
148
|
+
else
|
149
|
+
case @task.result
|
148
150
|
when 'success'
|
149
151
|
'progress-bar-success'
|
150
152
|
when 'error'
|
@@ -153,27 +155,28 @@
|
|
153
155
|
'progress-bar-warning'
|
154
156
|
else
|
155
157
|
nil
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
158
|
+
end
|
159
|
+
end %>
|
160
|
+
|
161
|
+
<div class="progress-description <%= 'active' if @task.state == 'running' %>">
|
162
|
+
<span class="list-group-item-heading">State:</span> <%= @task.state %>
|
163
|
+
</div>
|
164
|
+
<div class="progress progress-striped progress-label-top-right">
|
165
|
+
<div class="progress-bar <%= progress_class %>"
|
160
166
|
role="progressbar"
|
161
167
|
aria-valuenow="<%= progress %>"
|
162
168
|
aria-valuemin="0"
|
163
169
|
aria-valuemax="100"
|
164
170
|
style="width: <%= progress %>%;">
|
165
|
-
<span
|
171
|
+
<span><%= progress %>% Complete</span>
|
166
172
|
</div>
|
167
173
|
</div>
|
168
174
|
</div>
|
169
|
-
<div class="col-xs-1">
|
170
|
-
<%= progress.round %>%
|
171
|
-
</div>
|
172
175
|
</div>
|
173
176
|
|
174
177
|
<% unless @task.humanized[:output].blank? %>
|
175
178
|
<div>
|
176
|
-
<span class="param-name"><%= _("Output") %>:</span>
|
179
|
+
<span class="param-name list-group-item-heading"><%= _("Output") %>:</span>
|
177
180
|
<span class="param-value">
|
178
181
|
<pre><%= @task.humanized[:output] %></pre>
|
179
182
|
</span>
|
@@ -1,13 +1,19 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<%= alert(:close => false, :class => 'alert-info', :header => '',
|
2
|
+
:text => _("You can find resource locks on this page. Exclusive lock marked with locked icon means that no other task can use locked resource while this task is running. Non-exclusive lock marked with unlocked icon means other tasks can access the resource freely, it is only used to indicate the relation of this task with the resource")) %>
|
3
|
+
|
4
|
+
<div class="container-fluid container-cards-pf">
|
5
|
+
<div class="row row-cards-pf">
|
3
6
|
<% @task.locks.each do |lock| %>
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
<div class="col-xs-6 col-sm-4 col-md-4">
|
8
|
+
<div class="card-pf card-pf-accented card-pf-aggregate-status">
|
9
|
+
<h2 class="card-pf-title">
|
10
|
+
<span class="fa <%= lock.exclusive ? 'fa-lock' : 'fa-unlock-alt' %>"></span> <%= lock.name %>
|
11
|
+
</h2>
|
12
|
+
<div class="card-pf-body">
|
13
|
+
<%= format('%s id:%s', lock.resource_type, lock.resource_id) %><br>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
11
17
|
<% end %>
|
12
|
-
</
|
18
|
+
</div>
|
13
19
|
</div>
|
@@ -1,16 +1,28 @@
|
|
1
1
|
<div>
|
2
|
-
<span class="param-name"><%= _("
|
2
|
+
<span class="param-name list-group-item-heading"><%= _("Id") %>:</span>
|
3
|
+
<span class="param-value"><%= @task.id %></span>
|
4
|
+
</div>
|
5
|
+
<div>
|
6
|
+
<span class="param-name list-group-item-heading"><%= _("Label") %>:</span>
|
7
|
+
<span class="param-value"><%= @task.label %></span>
|
8
|
+
</div>
|
9
|
+
<div>
|
10
|
+
<span class="param-name list-group-item-heading"><%= _("Duration") %>:</span>
|
11
|
+
<span class="param-value"><%= duration_in_words_span(@task.started_at, @task.ended_at || Time.now.utc) %></span>
|
12
|
+
</div>
|
13
|
+
<div>
|
14
|
+
<span class="param-name list-group-item-heading"><%= _("Raw input") %>:</span>
|
3
15
|
<span class="param-value">
|
4
16
|
<pre><%= @task.input.pretty_inspect %></pre>
|
5
17
|
</span>
|
6
18
|
</div>
|
7
19
|
<div>
|
8
|
-
<span class="param-name"><%= _("Raw output") %>:</span>
|
20
|
+
<span class="param-name list-group-item-heading"><%= _("Raw output") %>:</span>
|
9
21
|
<span class="param-value">
|
10
22
|
<pre><%= @task.output.pretty_inspect %></pre>
|
11
23
|
</span>
|
12
24
|
</div>
|
13
25
|
<div>
|
14
|
-
<span class="param-name"><%= _("External Id") %>:</span>
|
26
|
+
<span class="param-name list-group-item-heading"><%= _("External Id") %>:</span>
|
15
27
|
<span class="param-value"><%= @task.external_id %></span>
|
16
28
|
</div>
|
@@ -1,17 +1,6 @@
|
|
1
1
|
<% title _("Tasks") %>
|
2
2
|
<% title_actions SETTINGS[:version].short <= '1.13' ? help_path : help_button %>
|
3
|
-
|
4
|
-
<style>
|
5
|
-
.param-name {
|
6
|
-
display: inline-block;
|
7
|
-
width: 10em;
|
8
|
-
}
|
9
|
-
|
10
|
-
.task-details pre {
|
11
|
-
white-space: pre;
|
12
|
-
word-break: normal;
|
13
|
-
}
|
14
|
-
</style>
|
3
|
+
<% stylesheet 'foreman_tasks/tasks' %>
|
15
4
|
|
16
5
|
<script>
|
17
6
|
|
data/foreman-tasks.gemspec
CHANGED
@@ -29,7 +29,7 @@ DESC
|
|
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.17'
|
33
33
|
s.add_dependency "sequel" # for Dynflow process persistence
|
34
34
|
s.add_dependency "sinatra" # for Dynflow web console
|
35
35
|
s.add_dependency "daemons" # for running remote executor
|
@@ -94,8 +94,6 @@ module ForemanTasks
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
protected
|
98
|
-
|
99
97
|
# generates the options hash consumable by the Dynflow's world
|
100
98
|
def world_config
|
101
99
|
::Dynflow::Config.new.tap do |config|
|
@@ -112,6 +110,8 @@ module ForemanTasks
|
|
112
110
|
end
|
113
111
|
end
|
114
112
|
|
113
|
+
protected
|
114
|
+
|
115
115
|
def default_sequel_adapter_options
|
116
116
|
db_config = ActiveRecord::Base.configurations[Rails.env].dup
|
117
117
|
db_config['adapter'] = 'postgres' if db_config['adapter'] == 'postgresql'
|
data/lib/foreman_tasks/engine.rb
CHANGED
@@ -131,7 +131,6 @@ module ForemanTasks
|
|
131
131
|
::PuppetclassesController.send :include, ForemanTasks::Concerns::EnvironmentsExtension
|
132
132
|
::EnvironmentsController.send :include, ForemanTasks::Concerns::EnvironmentsExtension
|
133
133
|
::Host::Base.send :include, ForemanTasks::Concerns::HostActionSubject
|
134
|
-
::Architecture.send :include, ForemanTasks::Concerns::ArchitectureActionSubject
|
135
134
|
end
|
136
135
|
end
|
137
136
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'dynflow/testing'
|
2
|
+
module ForemanTasks
|
3
|
+
module TestHelpers
|
4
|
+
def self.test_in_thread_world
|
5
|
+
world_config = ForemanTasks.dynflow.config.world_config
|
6
|
+
@test_in_thread_world ||= ::Dynflow::Testing::InThreadWorld.new(world_config)
|
7
|
+
end
|
8
|
+
|
9
|
+
module WithInThreadExecutor
|
10
|
+
extend ActiveSupport::Concern
|
11
|
+
included do
|
12
|
+
setup do
|
13
|
+
@old_dynflow_world = ForemanTasks.dynflow.world
|
14
|
+
ForemanTasks.dynflow.world = ForemanTasks::TestHelpers.test_in_thread_world
|
15
|
+
end
|
16
|
+
|
17
|
+
teardown do
|
18
|
+
ForemanTasks.dynflow.world = @old_dynflow_world
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
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.8.
|
4
|
+
version: 0.8.4
|
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-11-
|
11
|
+
date: 2016-11-15 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.17
|
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.17
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sequel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- README.md
|
115
115
|
- app/assets/javascripts/trigger_form.js
|
116
116
|
- app/assets/stylesheets/foreman_tasks/application.css.scss
|
117
|
+
- app/assets/stylesheets/foreman_tasks/tasks.css.scss
|
117
118
|
- app/assets/stylesheets/foreman_tasks/trigger_form.css
|
118
119
|
- app/controllers/foreman_tasks/api/recurring_logics_controller.rb
|
119
120
|
- app/controllers/foreman_tasks/api/tasks_controller.rb
|
@@ -128,9 +129,6 @@ files:
|
|
128
129
|
- app/lib/actions/base.rb
|
129
130
|
- app/lib/actions/bulk_action.rb
|
130
131
|
- app/lib/actions/entry_action.rb
|
131
|
-
- app/lib/actions/foreman/architecture/create.rb
|
132
|
-
- app/lib/actions/foreman/architecture/destroy.rb
|
133
|
-
- app/lib/actions/foreman/architecture/update.rb
|
134
132
|
- app/lib/actions/foreman/host/import_facts.rb
|
135
133
|
- app/lib/actions/foreman/puppetclass/import.rb
|
136
134
|
- app/lib/actions/helpers/args_serialization.rb
|
@@ -146,7 +144,6 @@ files:
|
|
146
144
|
- app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb
|
147
145
|
- app/models/foreman_tasks/concerns/action_subject.rb
|
148
146
|
- app/models/foreman_tasks/concerns/action_triggering.rb
|
149
|
-
- app/models/foreman_tasks/concerns/architecture_action_subject.rb
|
150
147
|
- app/models/foreman_tasks/concerns/host_action_subject.rb
|
151
148
|
- app/models/foreman_tasks/lock.rb
|
152
149
|
- app/models/foreman_tasks/recurring_logic.rb
|
@@ -223,6 +220,7 @@ files:
|
|
223
220
|
- lib/foreman_tasks/tasks/dynflow.rake
|
224
221
|
- lib/foreman_tasks/tasks/export_tasks.rake
|
225
222
|
- lib/foreman_tasks/test_extensions.rb
|
223
|
+
- lib/foreman_tasks/test_helpers.rb
|
226
224
|
- lib/foreman_tasks/triggers.rb
|
227
225
|
- lib/foreman_tasks/version.rb
|
228
226
|
- lib/tasks/gettext.rake
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Actions
|
2
|
-
module Foreman
|
3
|
-
module Architecture
|
4
|
-
class Create < Actions::EntryAction
|
5
|
-
|
6
|
-
def plan(architecture)
|
7
|
-
action_subject(architecture, :changes => architecture.changes)
|
8
|
-
end
|
9
|
-
|
10
|
-
def humanized_name
|
11
|
-
_("Create architecture")
|
12
|
-
end
|
13
|
-
|
14
|
-
def humanized_input
|
15
|
-
input[:architecture] && input[:architecture][:name]
|
16
|
-
end
|
17
|
-
|
18
|
-
def cli_example
|
19
|
-
return unless input[:architecture]
|
20
|
-
<<-EXAMPLE
|
21
|
-
hammer architecture create --id '#{task_input[:architecture][:id]}' \
|
22
|
-
--name '#{task_input[:architecture][:name]}'
|
23
|
-
EXAMPLE
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Actions
|
2
|
-
module Foreman
|
3
|
-
module Architecture
|
4
|
-
class Destroy < Actions::EntryAction
|
5
|
-
|
6
|
-
def plan(architecture)
|
7
|
-
action_subject(architecture)
|
8
|
-
end
|
9
|
-
|
10
|
-
def humanized_name
|
11
|
-
_("Delete architecture")
|
12
|
-
end
|
13
|
-
|
14
|
-
def humanized_input
|
15
|
-
input[:architecture] && input[:architecture][:name]
|
16
|
-
end
|
17
|
-
|
18
|
-
def cli_example
|
19
|
-
return unless input[:architecture]
|
20
|
-
<<-EXAMPLE
|
21
|
-
hammer architecture delete --id '#{task_input[:architecture][:id]}'
|
22
|
-
EXAMPLE
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Actions
|
2
|
-
module Foreman
|
3
|
-
module Architecture
|
4
|
-
class Update < Actions::EntryAction
|
5
|
-
|
6
|
-
def plan(architecture)
|
7
|
-
action_subject(architecture, :changes => architecture.changes)
|
8
|
-
end
|
9
|
-
|
10
|
-
def humanized_name
|
11
|
-
_("Update architecture")
|
12
|
-
end
|
13
|
-
|
14
|
-
def humanized_input
|
15
|
-
input[:architecture] && input[:architecture][:name]
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module ForemanTasks
|
2
|
-
module Concerns
|
3
|
-
module ArchitectureActionSubject
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
include ForemanTasks::Concerns::ActionSubject
|
6
|
-
include ForemanTasks::Concerns::ActionTriggering
|
7
|
-
|
8
|
-
def create_action
|
9
|
-
::Actions::Foreman::Architecture::Create
|
10
|
-
end
|
11
|
-
|
12
|
-
def update_action
|
13
|
-
::Actions::Foreman::Architecture::Update
|
14
|
-
end
|
15
|
-
|
16
|
-
def destroy_action
|
17
|
-
::Actions::Foreman::Architecture::Destroy
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|