foreman_virt_who_configure 5.0.1 → 5.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edf7bd97575c466c53bb5d115dbc85bb61b2c2c1a7e1629cfbd876155b2170ef
4
- data.tar.gz: 16ae299cb9c3679cf8fb5adb005aa48acbd59881d7c121a0bf53b6c088167ed2
3
+ metadata.gz: 97185d5e0f8d38b97daa23a6ec09d19b761d69f0ac3704cae39638e6ca3f7f21
4
+ data.tar.gz: 4e0330f2a3376cbed87c8b7968e1a01b00492b5acd5bf34c3ac234f9251686b5
5
5
  SHA512:
6
- metadata.gz: 0c83b9e5e993163f601efd574a18a889a28c79df5a5c0c30481b75f1be4fe1d4c9e9a46e0db28d7da31e4675c4c15e026698e72aaba00e817af0008bbdf03943
7
- data.tar.gz: b3a23b2126364629eb14bc1a7223868a7cbc4fed5e9197fb3371a470da99e66a8ad6421731fcd50cbc5e84d968de25e8298727ace9e850bc9270dd699d775211
6
+ metadata.gz: ca933a91d4dea9db513ee3168b47da2cd9ec19d9c8f45a42686d3e5f9eccd91451f698f62220dd4339278c2edf46b4016e8b4b054cc028edb474f739676791f0
7
+ data.tar.gz: 77ba78da132880f23ed5f18ca71b20baa3af3497a91c19c10992505ab7f97245e4b8e89e27f4a55c23f058e4cb4b7a430eee0eb7a4f5cb7287b39bc9dfa1380b
@@ -82,5 +82,29 @@ module ForemanVirtWhoConfigure
82
82
  config_attribute_label(attribute, label) + config_attribute_value(attribute, value)
83
83
  end
84
84
  end
85
+
86
+ # True when the remote execution plugin is loaded and the current user may
87
+ # launch jobs. The "Deploy on host" button is only useful in that case.
88
+ def deploy_on_host_available?
89
+ defined?(ForemanRemoteExecution) && User.current.can?(:create_job_invocations)
90
+ end
91
+
92
+ # Links to Foreman's native "Run job" wizard, pre-selecting the virt-who
93
+ # deploy job template (via its registered remote execution feature) and
94
+ # filling in this configuration's id. The user picks the target host(s) in
95
+ # the wizard, so we deliberately do not pass host_ids here.
96
+ def deploy_on_host_button(config, options = {})
97
+ return unless deploy_on_host_available?
98
+
99
+ link_to(
100
+ _('Deploy config'),
101
+ new_job_invocation_path(
102
+ :feature => 'deploy_virt_who_config',
103
+ :inputs => { :virt_who_config_id => config.id }
104
+ ),
105
+ { :class => 'btn btn-default',
106
+ :title => _('Select a host and deploy this virt-who configuration using a remote execution job') }.merge(options)
107
+ )
108
+ end
85
109
  end
86
110
  end
@@ -61,8 +61,29 @@
61
61
 
62
62
  <div class="tab-pane in" id="deploy">
63
63
  <div class="clearfix">
64
+ <% if deploy_on_host_available? %>
65
+ <div class="form-group">
66
+ <div class="row">
67
+ <div class="col-md-12">
68
+ <h3><%= _('Deploy on a registered host') %></h3>
69
+ </div>
70
+ <div class="col-md-6">
71
+ <%= _("Deploy this configuration to a registered host using a remote execution job. You will be able to select the target host on the next page.") %>
72
+ </div>
73
+ </div>
74
+ <div class="row" style="margin-top: 15px;">
75
+ <div class="col-md-8">
76
+ <%= deploy_on_host_button(@config, :class => 'btn btn-primary') %>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ <hr />
81
+ <% end %>
64
82
  <div class="form-group">
65
83
  <div class="row">
84
+ <div class="col-md-12">
85
+ <h3><%= _('Deploy manually') %></h3>
86
+ </div>
66
87
  <div class="col-md-6">
67
88
  <%= _("Use the script below to deploy this configuration. It requires root privileges. Run it on the target host which has access to katello-host-tools repository and will run virt-who reporting, preferably the smart proxy:") %>
68
89
  </div>
data/config/routes.rb CHANGED
@@ -13,12 +13,15 @@ Rails.application.routes.draw do
13
13
 
14
14
  namespace :api, :defaults => {:format => 'json'} do
15
15
  scope "(:apiv)", :module => :v2, :defaults => {:apiv => 'v2'}, :apiv => /v1|v2/, :constraints => ApiConstraints.new(:version => 2, :default => true) do
16
- resources :configs do
16
+ resources :configs, :except => [:new, :edit] do
17
17
  get :deploy_script, :on => :member
18
18
  end
19
19
 
20
20
  if SETTINGS[:organizations_enabled]
21
- resources :organizations, :except => [:new, :edit] do
21
+ # Only the nested configs routes are provided here; the plugin has no
22
+ # organizations controller of its own, so the organization resource
23
+ # itself must not generate any routes.
24
+ resources :organizations, :only => [] do
22
25
  # scoped by organization
23
26
  resources :configs, :only => [:index, :show]
24
27
  end
@@ -33,7 +33,7 @@ module ForemanVirtWhoConfigure
33
33
  # Add permissions
34
34
  security_block :foreman_virt_who_configure do
35
35
  permission_options = { :resource_type => 'ForemanVirtWhoConfigure::Config' }
36
- permission :view_virt_who_config, { :'foreman_virt_who_configure/configs' => [:index, :show, :auto_complete_search, :deploy_script],
36
+ permission :view_virt_who_config, { :'foreman_virt_who_configure/configs' => [:index, :show, :welcome, :auto_complete_search, :deploy_script],
37
37
  :'foreman_virt_who_configure/api/v2/configs' => [:index, :show, :deploy_script] }, permission_options
38
38
  permission :create_virt_who_config, { :'foreman_virt_who_configure/configs' => [:new, :create],
39
39
  :'foreman_virt_who_configure/api/v2/configs' => [:create] }, permission_options
@@ -1,3 +1,3 @@
1
1
  module ForemanVirtWhoConfigure
2
- VERSION = '5.0.1'.freeze
2
+ VERSION = '5.0.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_virt_who_configure
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman virt-who-configure team
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-10-23 00:00:00.000000000 Z
10
+ date: 2026-11-16 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: katello