foreman_remote_execution 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +3 -0
- data/app/controllers/api/v2/template_invocations_controller.rb +46 -0
- data/app/controllers/job_invocations_controller.rb +6 -0
- data/app/models/job_invocation_composer.rb +5 -1
- data/app/models/remote_execution_provider.rb +1 -1
- data/app/views/api/v2/template_invocations/base.json.rabl +5 -0
- data/app/views/api/v2/template_invocations/template_invocations.json.rabl +3 -0
- data/app/views/job_invocations/welcome.html.erb +14 -0
- data/app/views/template_invocations/show.html.erb +10 -1
- data/config/routes.rb +1 -0
- data/db/seeds.d/70-job_templates.rb +5 -1
- data/foreman_remote_execution.gemspec +1 -0
- data/lib/foreman_remote_execution/engine.rb +2 -0
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/de/foreman_remote_execution.po +165 -27
- data/locale/en/foreman_remote_execution.po +161 -23
- data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/en_GB/foreman_remote_execution.po +162 -24
- data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/es/foreman_remote_execution.po +165 -27
- data/locale/foreman_remote_execution.pot +282 -189
- data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/fr/foreman_remote_execution.po +165 -27
- data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ja/foreman_remote_execution.po +165 -27
- data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ko/foreman_remote_execution.po +165 -27
- data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/pt_BR/foreman_remote_execution.po +165 -27
- data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ru/foreman_remote_execution.po +165 -27
- data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_CN/foreman_remote_execution.po +165 -27
- data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_TW/foreman_remote_execution.po +165 -27
- data/test/functional/api/v2/template_invocations_controller_test.rb +33 -0
- data/test/unit/remote_execution_provider_test.rb +6 -1
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4f9842eca9c6a28b109c5e9b7056a362908a8463
|
4
|
+
data.tar.gz: 8cf8bfd85fd584a9e18b756c4d7cf0d9e4adcc4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 720b43d0d18f4521e329f0a690b8482048ee07297cf78ec6057bf20c05fe7c8da79d68f77406fbf637138d298fc4c68e3f4883df36916c36d4236e2e9e8e21c8
|
7
|
+
data.tar.gz: 5e2bd57fd39c8ecd7b09eb1ecca377edf608e8dd50007c9995af78a2f68b7828337582ea036b6dda37bdddf5f3e6bee2496cb8d75e9eb323c2bfad2937f0efd3
|
data/.rubocop.yml
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Api
|
4
|
+
module V2
|
5
|
+
class TemplateInvocationsController < ::Api::V2::BaseController
|
6
|
+
|
7
|
+
before_action :find_job_invocation, :only => %w{template_invocations}
|
8
|
+
|
9
|
+
api :GET, '/job_invocations/:job_invocation_id/template_invocations',
|
10
|
+
N_('List template invocations belonging to job invocation')
|
11
|
+
param_group :search_and_pagination, ::Api::V2::BaseController
|
12
|
+
param :job_invocation_id, :identifier, :required => true
|
13
|
+
def template_invocations
|
14
|
+
@template_invocations = resource_scope.paginate(paginate_options)
|
15
|
+
render :layout => 'api/v2/layouts/index_layout'
|
16
|
+
end
|
17
|
+
|
18
|
+
def resource_scope
|
19
|
+
if params[:action] == 'template_invocations'
|
20
|
+
resource_scope_for_template_invocations
|
21
|
+
else
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def resource_scope_for_template_invocations
|
29
|
+
@job_invocation.template_invocations.search_for(*search_options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def find_job_invocation
|
33
|
+
@job_invocation = JobInvocation.find(params[:id])
|
34
|
+
end
|
35
|
+
|
36
|
+
def action_permission
|
37
|
+
case params[:action]
|
38
|
+
when 'template_invocations'
|
39
|
+
:view
|
40
|
+
else
|
41
|
+
super
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -13,6 +13,12 @@ class JobInvocationsController < ApplicationController
|
|
13
13
|
:bookmark_id => params[:bookmark_id]
|
14
14
|
}
|
15
15
|
}
|
16
|
+
# replace an empty string search with a dummy search query to match all hosts
|
17
|
+
# but only if search query was entered (based on presence of :search parameter)
|
18
|
+
if params.key?(:search)
|
19
|
+
query = params[:search].empty? ? "name != ''" : params[:search]
|
20
|
+
ui_params[:targeting].update(:search_query => query)
|
21
|
+
end
|
16
22
|
|
17
23
|
if (template = JobTemplate.find_by(id: params[:template_id]))
|
18
24
|
ui_params[:job_invocation] = {
|
@@ -8,7 +8,7 @@ class JobInvocationComposer
|
|
8
8
|
|
9
9
|
def params
|
10
10
|
{ :job_category => job_invocation_base[:job_category],
|
11
|
-
:targeting => ui_params.fetch(:targeting, {})
|
11
|
+
:targeting => targeting(ui_params.fetch(:targeting, {})),
|
12
12
|
:triggering => triggering,
|
13
13
|
:host_ids => ui_params[:host_ids],
|
14
14
|
:remote_execution_feature_id => job_invocation_base[:remote_execution_feature_id],
|
@@ -82,6 +82,10 @@ class JobInvocationComposer
|
|
82
82
|
return trig unless trig.key?(:end_time) && trig[:end_time].keys == keys
|
83
83
|
trig.merge(:end_time => Time.local(*trig[:end_time].values_at(*keys)))
|
84
84
|
end
|
85
|
+
|
86
|
+
def targeting(targeting_params)
|
87
|
+
targeting_params.merge(:user_id => User.current.id)
|
88
|
+
end
|
85
89
|
end
|
86
90
|
|
87
91
|
class ApiParams
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="blank-slate-pf">
|
2
|
+
<div class="blank-slate-pf-icon">
|
3
|
+
<%= icon_text("globe", "", :kind => "fa") %>
|
4
|
+
</div>
|
5
|
+
<h1><%= _('Job Invocations') %></h1>
|
6
|
+
<p>
|
7
|
+
<%= _("Foreman can run arbitrary commands on remote hosts using different providers, such as SSH or Ansible. Communication goes through the Smart Proxy so Foreman does not have to have direct access to the target hosts and can scale to control many hosts.") %></br>
|
8
|
+
</p>
|
9
|
+
<p><%= link_to _('Learn more about this in the documentation.'),
|
10
|
+
documentation_url('1.ForemanRemoteExecution1.3Manual', :root_url => 'https://www.theforeman.org/plugins/foreman_remote_execution/1.3/index.html#'), :rel => 'external' %></p>
|
11
|
+
<div class="blank-slate-pf-main-action">
|
12
|
+
<%= new_link(_("Run Job"), {}, { :class => "btn-lg" }) %>
|
13
|
+
</div>
|
14
|
+
</div>
|
@@ -1,4 +1,13 @@
|
|
1
|
-
<%
|
1
|
+
<% items = [{ :caption => @template_invocation.job_invocation.description,
|
2
|
+
:url => job_invocation_path(@template_invocation.job_invocation_id) },
|
3
|
+
{ :caption => _('Template Invocation for %s') % @template_invocation.host.name }] %>
|
4
|
+
|
5
|
+
<% breadcrumbs(:resource_url => template_invocations_api_job_invocation_path(@template_invocation.job_invocation_id),
|
6
|
+
:name_field => 'host_name',
|
7
|
+
:switcher_item_url => template_invocation_path(':id'),
|
8
|
+
:items => items)
|
9
|
+
%>
|
10
|
+
|
2
11
|
<% stylesheet 'foreman_remote_execution/template_invocation' %>
|
3
12
|
<% javascript 'foreman_remote_execution/template_invocation' %>
|
4
13
|
|
data/config/routes.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
organizations = Organization.unscoped.all
|
2
|
+
locations = Location.unscoped.all
|
1
3
|
User.as_anonymous_admin do
|
2
4
|
JobTemplate.without_auditing do
|
3
5
|
Dir[File.join("#{ForemanRemoteExecution::Engine.root}/app/views/templates/**/*.erb")].each do |template|
|
4
6
|
sync = !Rails.env.test? && Setting[:remote_execution_sync_templates]
|
5
|
-
JobTemplate.import_raw!(File.read(template), :default => true, :locked => true, :update => sync)
|
7
|
+
template = JobTemplate.import_raw!(File.read(template), :default => true, :locked => true, :update => sync)
|
8
|
+
template.organizations = organizations if SETTINGS[:organizations_enabled] && template.present?
|
9
|
+
template.locations = locations if SETTINGS[:locations_enabled] && template.present?
|
6
10
|
end
|
7
11
|
end
|
8
12
|
end
|
@@ -4,6 +4,7 @@ require 'date'
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'foreman_remote_execution'
|
6
6
|
s.version = ForemanRemoteExecution::VERSION
|
7
|
+
s.license = 'GPL-3.0'
|
7
8
|
s.date = Date.today.to_s
|
8
9
|
s.authors = ['Foreman Remote Execution team']
|
9
10
|
s.email = ['foreman-dev@googlegroups.com']
|
@@ -59,6 +59,8 @@ module ForemanRemoteExecution
|
|
59
59
|
'api/v2/job_invocations' => [:create, :rerun] }, :resource_type => 'JobInvocation'
|
60
60
|
permission :view_job_invocations, { :job_invocations => [:index, :chart, :show, :auto_complete_search], :template_invocations => [:show],
|
61
61
|
'api/v2/job_invocations' => [:index, :show, :output] }, :resource_type => 'JobInvocation'
|
62
|
+
permission :view_template_invocations, { :template_invocations => [:show],
|
63
|
+
'api/v2/template_invocations' => [:template_invocations] }, :resource_type => 'TemplateInvocation'
|
62
64
|
permission :create_template_invocations, {}, :resource_type => 'TemplateInvocation'
|
63
65
|
permission :cancel_job_invocations, { :job_invocations => [:cancel], 'api/v2/job_invocations' => [:cancel] }, :resource_type => 'JobInvocation'
|
64
66
|
# this permissions grants user to get auto completion hints when setting up filters
|
Binary file
|