hammer_cli_foreman_remote_execution 0.1.1 → 0.2.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
  SHA256:
3
- metadata.gz: bfe330b86da113a5a6376d1aabc5acda1187048eba2d40f89b1807977e61b2d1
4
- data.tar.gz: 3c4bc1f61da2e243f5826811ae5edd3e555d989d51f28b589921302f09507700
3
+ metadata.gz: 00e0ed2d507a59921d5e74fea3c867a905275f3cfe08dead49f16ac2c65c270a
4
+ data.tar.gz: 13b14ae95a38f37186d530c94693cb169ae242302b14fd7cc8a6aa3f78c13863
5
5
  SHA512:
6
- metadata.gz: 2d8bea4d75e163357cebe8d7843947fe8eb92bdadbc6b576b9159efa4c701f5e1bb7a70b4c0b4dc43bd50b72fd553f99a5e910ddb00257664a9f383b46afaef4
7
- data.tar.gz: e021f8c88f05b847d08abfd96020dd557eeba971a3a6b8d2c915015b62fbd7115a8a481a09dccd32a4262bcc97742dfd205b601cc492a9e9eaaa2206d08d9b01
6
+ metadata.gz: '0779211fbcabdcba9288f5f79ea652f60f6deb8fc0f25d36a16dd7293df196224d2c263e967a2b0cd30c384cea02f2bcb107cee773862befd6563ea0f287641a'
7
+ data.tar.gz: ac9781413c16f4af51d31896adb1328ed64e112b68dff79159db3409bdf183086a4ec4f50abd8c6d39fed3f6e01fb18a44d3ec9c16e4dadab980905bf9bf7aed
data/.travis.yml CHANGED
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  language: ruby
3
3
  rvm:
4
- - 2.1.0
5
- - 2.2.0
6
- - 2.3.0
4
+ - 2.4.0
5
+ - 2.5.0
6
+ - 2.6.0
7
7
  sudo: false
8
8
  before_install:
9
9
  - gem update bundler
data/.tx/config CHANGED
@@ -1,7 +1,7 @@
1
1
  [main]
2
2
  host = https://www.transifex.com
3
3
 
4
- [foreman.hammer_cli_foreman_tasks]
4
+ [foreman.hammer-cli-foreman-remote-execution]
5
5
  file_filter = locale/<lang>/hammer-cli-foreman-remote-execution.edit.po
6
6
  source_file = locale/hammer-cli-foreman-remote-exectution.pot
7
7
  source_lang = en
@@ -16,6 +16,6 @@ Gem::Specification.new do |s|
16
16
  s.test_files = `git ls-files test`.split("\n")
17
17
  s.extra_rdoc_files = `git ls-files doc`.split("\n") + Dir['README*', 'LICENSE']
18
18
 
19
- s.add_dependency 'hammer_cli_foreman', '>= 0.1.3', '< 3.0.0'
19
+ s.add_dependency 'hammer_cli_foreman', '>= 0.1.3', '< 4.0.0'
20
20
  s.add_dependency 'hammer_cli_foreman_tasks', '~> 0.0.3'
21
21
  end
@@ -9,6 +9,8 @@ module HammerCLIForemanRemoteExecution
9
9
  require 'hammer_cli_foreman_remote_execution/template_input'
10
10
  require 'hammer_cli_foreman_remote_execution/foreign_input_set'
11
11
  require 'hammer_cli_foreman_remote_execution/remote_execution_feature'
12
+ require 'hammer_cli_foreman_remote_execution/interface_extensions'
13
+ require 'hammer_cli_foreman_remote_execution/subnet_extensions'
12
14
 
13
15
  def self.exception_handler_class
14
16
  HammerCLIForeman::ExceptionHandler
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'hammer_cli_foreman/interface'
4
+
5
+ module HammerCLIForemanRemoteExecution
6
+ class InterfaceExtensionsInfo < ::HammerCLI::CommandExtensions
7
+ output do |definition|
8
+ definition.append do
9
+ field :execution, _('Execution'), Fields::Boolean
10
+ end
11
+ end
12
+ end
13
+
14
+ module InterfaceExtensionsList
15
+ def format_type(nic)
16
+ type = super(nic)
17
+ if nic['execution']
18
+ if nic['primary'] || nic['provision']
19
+ type[-1] = ', '+_('execution') +')'
20
+ else
21
+ type += ' ('+_('execution') +')'
22
+ end
23
+ end
24
+ type
25
+ end
26
+ end
27
+
28
+ ::HammerCLIForeman::Interface.singleton_class.prepend InterfaceExtensionsList
29
+ ::HammerCLIForeman::Interface::InfoCommand.extend_with(InterfaceExtensionsInfo.new)
30
+ end
@@ -8,18 +8,25 @@ module HammerCLIForemanRemoteExecution
8
8
  end
9
9
  end
10
10
 
11
- class ListCommand < HammerCLIForeman::ListCommand
12
- output do
13
- field :id, _('ID')
14
- field :description, _('Description')
15
- field :status_label, _('Status')
16
- field :succeeded, _('Success')
17
- field :failed, _('Failed')
18
- field :pending, _('Pending')
19
- field :total, _('Total')
20
- field :start_at, _('Start')
21
- field :randomized_ordering, _('Randomized ordering')
11
+ module BaseOutput
12
+ def self.included(base)
13
+ base.output do
14
+ field :id, _('ID')
15
+ field :description, _('Description')
16
+ field :status_label, _('Status')
17
+ field :succeeded, _('Success')
18
+ field :failed, _('Failed')
19
+ field :pending, _('Pending')
20
+ field :total, _('Total')
21
+ field :start_at, _('Start')
22
+ field :randomized_ordering, _('Randomized ordering')
23
+ field :inputs, _('Inputs'), nil, :hide_blank => true
24
+ end
22
25
  end
26
+ end
27
+
28
+ class ListCommand < HammerCLIForeman::ListCommand
29
+ include BaseOutput
23
30
 
24
31
  def extend_data(invocation)
25
32
  JobInvocation.extend_data(invocation)
@@ -30,20 +37,56 @@ module HammerCLIForemanRemoteExecution
30
37
 
31
38
  class InfoCommand < HammerCLIForeman::InfoCommand
32
39
  extend WithoutNameOption
33
- output ListCommand.output_definition do
34
- field :job_category, _('Job Category')
35
- field :mode, _('Mode')
36
- field :cron_line, _('Cron line')
37
- field :recurring_logic_id, _('Recurring logic ID')
38
- field :hosts, _('Hosts')
40
+ include BaseOutput
41
+ option '--show-inputs', :flag, _('Show the complete input of the job')
42
+ option '--show-host-status', :flag, _('Show job status for the hosts')
43
+
44
+ extend_output_definition do |definition|
45
+ definition.insert(:before, :total) do
46
+ field :missing, _('Missing')
47
+ end
48
+ definition.append do
49
+ field :job_category, _('Job Category')
50
+ field :mode, _('Mode')
51
+ field :cron_line, _('Cron line')
52
+ field :recurring_logic_id, _('Recurring logic ID')
53
+ field :hosts, _('Hosts')
54
+ end
55
+ end
56
+
57
+ def adapter
58
+ if option_id
59
+ :yaml
60
+ else
61
+ :base
62
+ end
39
63
  end
40
64
 
41
65
  def extend_data(invocation)
66
+ if option_show_inputs?
67
+ invocation['template_invocations']&.each do |template|
68
+ input_values = template['template_invocation_input_values']
69
+ values_for_host = {}
70
+ input_values&.each do |input_value|
71
+ values_for_host[input_value['template_input_name']] = input_value['value']
72
+ end
73
+ hosts = invocation.dig('targeting', 'hosts')
74
+ host_index = hosts&.index { |h| h['id'] == template['host_id'] }
75
+ invocation['targeting']['hosts'][host_index][:inputs] = values_for_host if host_index
76
+ end
77
+ end
42
78
  JobInvocation.extend_data(invocation)
43
79
  end
44
80
 
45
81
  build_options do |o|
46
82
  o.expand(:none)
83
+ o.without(:host_status)
84
+ end
85
+
86
+ def request_params
87
+ params = super
88
+ params[:host_status] = true if option_show_host_status?
89
+ params
47
90
  end
48
91
  end
49
92
 
@@ -186,10 +229,12 @@ module HammerCLIForemanRemoteExecution
186
229
 
187
230
  def self.extend_data(invocation)
188
231
  if (targeting = invocation['targeting']) && invocation['targeting']['hosts']
189
- invocation['randomized_ordering'] = targeting['randomized_ordering']
190
- if (hosts = targeting['hosts'])
191
- invocation['hosts'] = "\n" + hosts.map { |host| " - #{host['name']}" }.join("\n")
232
+ invocation['randomized_ordering'] = targeting['randomized_ordering'] || false
233
+
234
+ hosts = targeting['hosts'].map do |host|
235
+ { 'Name' => host['name'], 'Job status' => host['job_status'], 'Inputs' => host[:inputs] }.compact
192
236
  end
237
+ invocation['hosts'] = hosts
193
238
  end
194
239
 
195
240
  if invocation['recurrence']
@@ -0,0 +1,16 @@
1
+ require 'hammer_cli_foreman/subnet'
2
+
3
+ module HammerCLIForemanRemoteExecution
4
+ class SubnetExtensions < ::HammerCLI::CommandExtensions
5
+ output do |definition|
6
+ definition.insert(:after, _("Smart Proxies"))do
7
+ collection :remote_execution_proxies, _('Remote execution proxies'), :numbered => false do
8
+ field :id, _('Id')
9
+ field :name, _('Name')
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+ ::HammerCLIForeman::Subnet::InfoCommand.extend_with(SubnetExtensions.new)
16
+ end
@@ -1,5 +1,5 @@
1
1
  module HammerCLIForemanRemoteExecution
2
2
  def self.version
3
- @version ||= Gem::Version.new '0.1.1'
3
+ @version ||= Gem::Version.new '0.2.2'
4
4
  end
5
5
  end
data/locale/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  Updating the translations
2
2
  -------------------------
3
3
 
4
- 1. Check if there are any new languages with progress more than 50% on [transifex](https://www.transifex.com/projects/p/foreman/resource/hammer-cli-foreman/). If so, do the following for each of the new languages:
4
+ 1. Check if there are any new languages with progress more than 50% on [transifex](https://www.transifex.com/projects/p/foreman/resource/hammer-cli-foreman-remote-execution/). If so, do the following for each of the new languages:
5
5
 
6
6
  ```
7
7
  mkdir locale/<lang>
8
- cp locale/hammer-cli-foreman.pot locale/<lang>/hammer-cli-foreman.po
8
+ cp locale/hammer-cli-foreman-remote-execution.pot locale/<lang>/hammer-cli-foreman-remote-execution.po
9
9
  ```
10
10
  2. Make sure you have `transifex-client` installed
11
11
 
@@ -3,10 +3,9 @@
3
3
  # This file is distributed under the same license as the hammer_cli_foreman_tasks package.
4
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
  #
6
- #, fuzzy
7
6
  msgid ""
8
7
  msgstr ""
9
- "Project-Id-Version: hammer_cli_foreman_tasks 0.0.9\n"
8
+ "Project-Id-Version: hammer-cli-foreman-remote-execution 0.2.0\n"
10
9
  "Report-Msgid-Bugs-To: \n"
11
10
  "PO-Revision-Date: 2016-02-18 10:36-0500\n"
12
11
  "Last-Translator: Wiederoder <stefanwiederoder@googlemail.com>, 2017\n"
@@ -17,77 +16,247 @@ msgstr ""
17
16
  "Language: de\n"
18
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
18
 
19
+ msgid "Manage foreign input sets"
20
+ msgstr ""
21
+
20
22
  msgid "ID"
21
23
  msgstr "ID"
22
24
 
25
+ #, fuzzy
26
+ msgid "Target template ID"
27
+ msgstr "ID"
28
+
29
+ msgid "Target template name"
30
+ msgstr ""
31
+
32
+ msgid "Name"
33
+ msgstr "Name"
34
+
35
+ msgid "Include all"
36
+ msgstr ""
37
+
38
+ msgid "Include"
39
+ msgstr ""
40
+
41
+ msgid "Exclude"
42
+ msgstr ""
43
+
44
+ msgid "Foreign input set updated"
45
+ msgstr ""
46
+
47
+ msgid "Could not update the input set"
48
+ msgstr ""
49
+
50
+ msgid "Foreign input set created"
51
+ msgstr ""
52
+
53
+ msgid "Could not create the input set"
54
+ msgstr ""
55
+
56
+ msgid "Foreign input set deleted"
57
+ msgstr ""
58
+
59
+ msgid "Could not delete the input set"
60
+ msgstr ""
61
+
62
+ msgid "Description"
63
+ msgstr ""
64
+
65
+ #, fuzzy
66
+ msgid "Status"
67
+ msgstr "Status"
68
+
69
+ msgid "Success"
70
+ msgstr ""
71
+
72
+ msgid "Failed"
73
+ msgstr ""
74
+
75
+ msgid "Pending"
76
+ msgstr ""
77
+
78
+ msgid "Total"
79
+ msgstr ""
80
+
81
+ #, fuzzy
82
+ msgid "Start"
83
+ msgstr "Status"
84
+
85
+ msgid "Job Category"
86
+ msgstr ""
87
+
88
+ msgid "Mode"
89
+ msgstr ""
90
+
23
91
  msgid "Cron line"
24
92
  msgstr "Cron-Zeile"
25
93
 
26
- msgid "End time"
27
- msgstr "Endzeit"
94
+ #, fuzzy
95
+ msgid "Recurring logic ID"
96
+ msgstr "ID"
28
97
 
29
- msgid "Iteration"
30
- msgstr "Wiederholung"
98
+ msgid "Hosts"
99
+ msgstr ""
31
100
 
32
- msgid "State"
33
- msgstr "Status"
101
+ msgid "View the output for a host"
102
+ msgstr ""
34
103
 
35
- msgid "Recurring logic cancelled."
36
- msgstr "Wiederholungslogik abgebrochen."
104
+ msgid "Do not wait for job to complete, shows current output only"
105
+ msgstr ""
37
106
 
38
- msgid "Could not cancel the recurring logic."
39
- msgstr "Wiederholungslogik konnte nicht abgebrochen werden."
107
+ msgid "The job is scheduled to start at %{timestamp}"
108
+ msgstr ""
40
109
 
41
- msgid "Recurring logic related actions."
42
- msgstr "Aktionen im Zusammenhang mit Wiederholungslogik"
110
+ msgid "Job invocation %{id} created"
111
+ msgstr ""
43
112
 
44
- msgid "Show the progress of the task"
45
- msgstr "Fortschritt der Aufgabe anzeigen"
113
+ msgid "Schedule the execution for a later time"
114
+ msgstr ""
46
115
 
47
- msgid "Name"
48
- msgstr "Name"
116
+ msgid "Execution should be cancelled if it cannot be started before --start-at"
117
+ msgstr ""
118
+
119
+ msgid "Create a recurring execution"
120
+ msgstr ""
121
+
122
+ msgid "Perform no more executions after this time, used with --cron-line"
123
+ msgstr ""
124
+
125
+ msgid "Specify inputs from command line"
126
+ msgstr ""
127
+
128
+ msgid "Read input values from files"
129
+ msgstr ""
130
+
131
+ msgid "Dynamic search queries are evaluated at run time"
132
+ msgstr ""
133
+
134
+ msgid "Cancel the job"
135
+ msgstr ""
136
+
137
+ msgid "Job invocation %{id} cancelled"
138
+ msgstr ""
139
+
140
+ msgid "Could not cancel the job invocation"
141
+ msgstr ""
142
+
143
+ msgid "Rerun the job"
144
+ msgstr ""
145
+
146
+ msgid "Job invocation was rerun as %{id}"
147
+ msgstr ""
148
+
149
+ msgid "Manage job invocations"
150
+ msgstr ""
151
+
152
+ msgid "Provider"
153
+ msgstr ""
154
+
155
+ msgid "Type"
156
+ msgstr ""
157
+
158
+ msgid "Inputs"
159
+ msgstr ""
160
+
161
+ msgid "View job template content"
162
+ msgstr ""
163
+
164
+ msgid "Path to a file that contains the template"
165
+ msgstr ""
166
+
167
+ msgid "Job template created"
168
+ msgstr ""
169
+
170
+ msgid "Could not create the job template"
171
+ msgstr ""
172
+
173
+ msgid "Path to a file that contains the template - must include ERB metadata"
174
+ msgstr ""
175
+
176
+ msgid "Job template imported"
177
+ msgstr ""
178
+
179
+ msgid "Could not import the job template"
180
+ msgstr ""
181
+
182
+ msgid "Export a template including all metadata"
183
+ msgstr ""
49
184
 
50
- msgid "Owner"
51
- msgstr "Besitzer"
185
+ msgid "Job template updated"
186
+ msgstr ""
52
187
 
53
- msgid "Started at"
54
- msgstr "Gestartet um"
188
+ msgid "Could not update the job template"
189
+ msgstr ""
55
190
 
56
- msgid "Ended at"
57
- msgstr "Beendet um"
191
+ msgid "Job template deleted"
192
+ msgstr ""
58
193
 
59
- msgid "Result"
60
- msgstr "Ergebnis"
194
+ msgid "Could not delete the job template"
195
+ msgstr ""
61
196
 
62
- msgid "Task action"
63
- msgstr "Aufgabenaktion"
197
+ msgid "Manage job templates"
198
+ msgstr ""
64
199
 
65
- msgid "Task errors"
66
- msgstr "Aufgabenfehler"
200
+ msgid ""
201
+ "Comma-separated list of key=file, where file is a path to a text file to be re"
202
+ "ad"
203
+ msgstr ""
67
204
 
68
- msgid "Resume all tasks paused in error state"
69
- msgstr "Alle in Fehler-Status angehaltenen Aufgaben fortsetzen"
205
+ #, fuzzy
206
+ msgid ""
207
+ "Cron line format 'a b c d e', where:\n"
208
+ " a. is minute (range: 0-59)\n"
209
+ " b. is hour (range: 0-23)\n"
210
+ " c. is day of month (range: 1-31)\n"
211
+ " d. is month (range: 1-12)\n"
212
+ " e. is day of week (range: 0-6)"
213
+ msgstr "Cron-Zeile"
70
214
 
71
- msgid "Total tasks found paused in error state"
72
- msgstr "Alle in Fehler-Status gefundenen Aufgaben "
215
+ msgid "Manage remote execution features"
216
+ msgstr ""
73
217
 
74
- msgid "Total tasks resumed"
75
- msgstr "Insgesamt fortgesetzte Aufgaben"
218
+ msgid "Job template name"
219
+ msgstr ""
76
220
 
77
- msgid "Resumed tasks"
78
- msgstr "Fortgesetzte Aufgaben"
221
+ msgid "Label"
222
+ msgstr ""
79
223
 
80
- msgid "Task identifier"
81
- msgstr "Aufgabenbezeichner"
224
+ #, fuzzy
225
+ msgid "Job template ID"
226
+ msgstr "ID"
82
227
 
83
- msgid "Total tasks failed to resume"
84
- msgstr "Gesamtzahl der Aufgaben, die nicht fortgesetzt werden konnten"
228
+ msgid "Remote execution feature updated"
229
+ msgstr ""
85
230
 
86
- msgid "Failed tasks"
87
- msgstr "Fehlgeschlagene Aufgaben"
231
+ msgid "Could not update the remote execution feature"
232
+ msgstr ""
88
233
 
89
- msgid "Total tasks skipped"
90
- msgstr "Insgesamt übersprungene Aufgaben"
234
+ msgid "Manage template inputs"
235
+ msgstr ""
91
236
 
92
- msgid "Skipped tasks"
93
- msgstr "Übersprungene Aufgaben"
237
+ msgid "Input type"
238
+ msgstr ""
239
+
240
+ msgid "Fact name"
241
+ msgstr ""
242
+
243
+ msgid "Variable name"
244
+ msgstr ""
245
+
246
+ msgid "Puppet parameter name"
247
+ msgstr ""
248
+
249
+ msgid "Options"
250
+ msgstr ""
251
+
252
+ msgid "Template input created"
253
+ msgstr ""
254
+
255
+ msgid "Could not create the template input"
256
+ msgstr ""
257
+
258
+ msgid "Template input deleted"
259
+ msgstr ""
260
+
261
+ msgid "Could not delete the template input"
262
+ msgstr ""