hammer_cli_foreman_remote_execution 0.2.3 → 0.3.1
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/.github/workflows/ci_test.yml +22 -0
- data/.rubocop.yml +7 -4
- data/.rubocop_todo.yml +81 -0
- data/.tx/config +5 -4
- data/Gemfile +10 -9
- data/Rakefile +9 -25
- data/hammer_cli_foreman_remote_execution.gemspec +6 -2
- data/lib/hammer_cli_foreman_remote_execution/foreign_input_set.rb +2 -0
- data/lib/hammer_cli_foreman_remote_execution/i18n.rb +5 -7
- data/lib/hammer_cli_foreman_remote_execution/interface_extensions.rb +2 -2
- data/lib/hammer_cli_foreman_remote_execution/job_invocation.rb +6 -4
- data/lib/hammer_cli_foreman_remote_execution/job_template.rb +8 -6
- data/lib/hammer_cli_foreman_remote_execution/options/normalizers.rb +5 -3
- data/lib/hammer_cli_foreman_remote_execution/remote_execution_feature.rb +4 -1
- data/lib/hammer_cli_foreman_remote_execution/subnet_extensions.rb +3 -1
- data/lib/hammer_cli_foreman_remote_execution/template_input.rb +2 -0
- data/lib/hammer_cli_foreman_remote_execution/version.rb +3 -1
- data/lib/hammer_cli_foreman_remote_execution.rb +2 -0
- data/locale/Makefile +2 -53
- data/locale/ca/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/ca/hammer_cli_foreman_remote_execution.po +311 -0
- data/locale/cs_CZ/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/{de/hammer-cli-foreman-remote-execution.po → cs_CZ/hammer_cli_foreman_remote_execution.po} +104 -67
- data/locale/de/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/de/hammer_cli_foreman_remote_execution.po +311 -0
- data/locale/en/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/en/{hammer-cli-foreman-remote-execution.po → hammer_cli_foreman_remote_execution.po} +55 -16
- data/locale/es/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/es/hammer_cli_foreman_remote_execution.po +308 -0
- data/locale/fr/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/fr/hammer_cli_foreman_remote_execution.po +315 -0
- data/locale/{hammer-cli-foreman-remote-execution.pot → hammer_cli_foreman_remote_execution.pot} +113 -57
- data/locale/it/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/it/{hammer-cli-foreman-remote-execution.po → hammer_cli_foreman_remote_execution.po} +74 -37
- data/locale/ja/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/ja/hammer_cli_foreman_remote_execution.po +306 -0
- data/locale/ka/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/ka/hammer_cli_foreman_remote_execution.po +307 -0
- data/locale/ko/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/ko/hammer_cli_foreman_remote_execution.po +305 -0
- data/locale/pt_BR/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/pt_BR/hammer_cli_foreman_remote_execution.po +308 -0
- data/locale/ru/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/ru/hammer_cli_foreman_remote_execution.po +311 -0
- data/locale/zh_CN/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/zh_CN/hammer_cli_foreman_remote_execution.po +303 -0
- data/locale/zh_TW/LC_MESSAGES/hammer_cli_foreman_remote_execution.mo +0 -0
- data/locale/zh_TW/{hammer-cli-foreman-remote-execution.po → hammer_cli_foreman_remote_execution.po} +113 -73
- data/test/unit/foreign_input_set_test.rb +11 -9
- data/test/unit/job_invocation_test.rb +20 -16
- data/test/unit/job_template_test.rb +27 -22
- data/test/unit/remote_execution_feature_test.rb +9 -8
- data/test/unit/template_input_test.rb +13 -11
- metadata +39 -17
- data/locale/es/hammer-cli-foreman-remote-execution.po +0 -262
- data/locale/fr/hammer-cli-foreman-remote-execution.po +0 -262
- data/locale/ja/hammer-cli-foreman-remote-execution.po +0 -262
- data/locale/ko/hammer-cli-foreman-remote-execution.po +0 -262
- data/locale/pt_BR/hammer-cli-foreman-remote-execution.po +0 -263
- data/locale/ru/hammer-cli-foreman-remote-execution.po +0 -264
- data/locale/zh_CN/hammer-cli-foreman-remote-execution.po +0 -263
data/locale/zh_TW/{hammer-cli-foreman-remote-execution.po → hammer_cli_foreman_remote_execution.po}
RENAMED
@@ -1,16 +1,17 @@
|
|
1
1
|
# SOME DESCRIPTIVE TITLE.
|
2
2
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
3
|
-
# This file is distributed under the same license as the
|
4
|
-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
3
|
+
# This file is distributed under the same license as the hammer-cli-foreman-remote-execution package.
|
5
4
|
#
|
5
|
+
# Translators:
|
6
6
|
msgid ""
|
7
7
|
msgstr ""
|
8
|
-
"Project-Id-Version:
|
8
|
+
"Project-Id-Version: hammer_cli_foreman_remote_execution 0.3.0\n"
|
9
9
|
"Report-Msgid-Bugs-To: \n"
|
10
|
-
"
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
10
|
+
"POT-Creation-Date: 2023-07-12 15:59+0000\n"
|
11
|
+
"PO-Revision-Date: 2016-02-12 07:57+0000\n"
|
12
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13
|
+
"Language-Team: Chinese (Taiwan) (http://app.transifex.com/foreman/foreman/"
|
14
|
+
"language/zh_TW/)\n"
|
14
15
|
"MIME-Version: 1.0\n"
|
15
16
|
"Content-Type: text/plain; charset=UTF-8\n"
|
16
17
|
"Content-Transfer-Encoding: 8bit\n"
|
@@ -18,119 +19,139 @@ msgstr ""
|
|
18
19
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
19
20
|
|
20
21
|
msgid "Manage foreign input sets"
|
21
|
-
msgstr ""
|
22
|
+
msgstr "管理外部輸入集"
|
22
23
|
|
23
24
|
msgid "ID"
|
24
25
|
msgstr "ID"
|
25
26
|
|
26
|
-
#, fuzzy
|
27
27
|
msgid "Target template ID"
|
28
|
-
msgstr "ID"
|
28
|
+
msgstr "目標範本 ID"
|
29
29
|
|
30
30
|
msgid "Target template name"
|
31
|
-
msgstr ""
|
31
|
+
msgstr "目標範本名稱"
|
32
32
|
|
33
33
|
msgid "Name"
|
34
34
|
msgstr "名稱"
|
35
35
|
|
36
36
|
msgid "Include all"
|
37
|
-
msgstr ""
|
37
|
+
msgstr "包含所有"
|
38
38
|
|
39
39
|
msgid "Include"
|
40
|
-
msgstr ""
|
40
|
+
msgstr "包含"
|
41
41
|
|
42
42
|
msgid "Exclude"
|
43
|
-
msgstr ""
|
43
|
+
msgstr "排除"
|
44
44
|
|
45
45
|
msgid "Foreign input set updated"
|
46
|
-
msgstr ""
|
46
|
+
msgstr "外部輸入集已更新"
|
47
47
|
|
48
48
|
msgid "Could not update the input set"
|
49
|
-
msgstr ""
|
49
|
+
msgstr "無法更新輸入集"
|
50
50
|
|
51
51
|
msgid "Foreign input set created"
|
52
|
-
msgstr ""
|
52
|
+
msgstr "外部輸入集已建立"
|
53
53
|
|
54
54
|
msgid "Could not create the input set"
|
55
|
-
msgstr ""
|
55
|
+
msgstr "無法建立輸入集"
|
56
56
|
|
57
57
|
msgid "Foreign input set deleted"
|
58
|
-
msgstr ""
|
58
|
+
msgstr "外部輸入集已刪除"
|
59
59
|
|
60
60
|
msgid "Could not delete the input set"
|
61
|
+
msgstr "無法刪除輸入集"
|
62
|
+
|
63
|
+
msgid "Execution"
|
64
|
+
msgstr "執行"
|
65
|
+
|
66
|
+
msgid "execution"
|
61
67
|
msgstr ""
|
62
68
|
|
63
69
|
msgid "Description"
|
64
|
-
msgstr ""
|
70
|
+
msgstr "說明"
|
65
71
|
|
66
|
-
#, fuzzy
|
67
72
|
msgid "Status"
|
68
73
|
msgstr "狀態"
|
69
74
|
|
70
75
|
msgid "Success"
|
71
|
-
msgstr ""
|
76
|
+
msgstr "成功"
|
72
77
|
|
73
78
|
msgid "Failed"
|
74
|
-
msgstr ""
|
79
|
+
msgstr "失敗"
|
75
80
|
|
76
81
|
msgid "Pending"
|
77
|
-
msgstr ""
|
82
|
+
msgstr "等待處理中"
|
78
83
|
|
79
84
|
msgid "Total"
|
80
|
-
msgstr ""
|
85
|
+
msgstr "總數"
|
81
86
|
|
82
|
-
#, fuzzy
|
83
87
|
msgid "Start"
|
84
|
-
msgstr "
|
88
|
+
msgstr "開始"
|
85
89
|
|
86
|
-
msgid "
|
90
|
+
msgid "Randomized ordering"
|
87
91
|
msgstr ""
|
88
92
|
|
89
|
-
msgid "
|
93
|
+
msgid "Inputs"
|
94
|
+
msgstr "輸入"
|
95
|
+
|
96
|
+
msgid "Show the complete input of the job"
|
97
|
+
msgstr ""
|
98
|
+
|
99
|
+
msgid "Show job status for the hosts"
|
90
100
|
msgstr ""
|
91
101
|
|
102
|
+
msgid "Missing"
|
103
|
+
msgstr ""
|
104
|
+
|
105
|
+
msgid "Job Category"
|
106
|
+
msgstr "工作類別"
|
107
|
+
|
108
|
+
msgid "Mode"
|
109
|
+
msgstr "模式"
|
110
|
+
|
92
111
|
msgid "Cron line"
|
93
112
|
msgstr "Cron 行"
|
94
113
|
|
95
|
-
#, fuzzy
|
96
114
|
msgid "Recurring logic ID"
|
97
|
-
msgstr "ID"
|
115
|
+
msgstr "週期性的邏輯 ID"
|
98
116
|
|
99
|
-
msgid "
|
117
|
+
msgid "Time to pickup"
|
100
118
|
msgstr ""
|
101
119
|
|
120
|
+
msgid "Hosts"
|
121
|
+
msgstr "主機"
|
122
|
+
|
102
123
|
msgid "View the output for a host"
|
103
|
-
msgstr ""
|
124
|
+
msgstr "檢視主機輸出"
|
104
125
|
|
105
126
|
msgid "Do not wait for job to complete, shows current output only"
|
106
|
-
msgstr ""
|
127
|
+
msgstr "不等待工作完成,僅顯示現有輸出"
|
107
128
|
|
108
129
|
msgid "The job is scheduled to start at %{timestamp}"
|
109
130
|
msgstr ""
|
110
131
|
|
111
132
|
msgid "Job invocation %{id} created"
|
112
|
-
msgstr ""
|
133
|
+
msgstr "工作祈願 %{id} 已建立"
|
113
134
|
|
114
135
|
msgid "Schedule the execution for a later time"
|
115
|
-
msgstr ""
|
136
|
+
msgstr "排程執行工作至晚一點的時間"
|
116
137
|
|
117
138
|
msgid "Execution should be cancelled if it cannot be started before --start-at"
|
118
|
-
msgstr ""
|
139
|
+
msgstr "如果不能在 --start-at 之前開始,就應該取消執行"
|
119
140
|
|
120
141
|
msgid "Create a recurring execution"
|
121
|
-
msgstr ""
|
142
|
+
msgstr "建立週期性執行"
|
122
143
|
|
123
144
|
msgid "Perform no more executions after this time, used with --cron-line"
|
124
|
-
msgstr ""
|
145
|
+
msgstr "此時間之後不再進行任何執行,與 --cron-line 合用"
|
125
146
|
|
126
147
|
msgid "Specify inputs from command line"
|
127
|
-
msgstr ""
|
148
|
+
msgstr "從命令列指定輸入"
|
128
149
|
|
129
150
|
msgid "Read input values from files"
|
130
|
-
msgstr ""
|
151
|
+
msgstr "從檔案讀取輸入值"
|
131
152
|
|
132
153
|
msgid "Dynamic search queries are evaluated at run time"
|
133
|
-
msgstr ""
|
154
|
+
msgstr "在執行時評量動態搜尋查詢"
|
134
155
|
|
135
156
|
msgid "Cancel the job"
|
136
157
|
msgstr ""
|
@@ -142,34 +163,31 @@ msgid "Could not cancel the job invocation"
|
|
142
163
|
msgstr ""
|
143
164
|
|
144
165
|
msgid "Rerun the job"
|
145
|
-
msgstr ""
|
166
|
+
msgstr "重新執行工作"
|
146
167
|
|
147
168
|
msgid "Job invocation was rerun as %{id}"
|
148
169
|
msgstr ""
|
149
170
|
|
150
171
|
msgid "Manage job invocations"
|
151
|
-
msgstr ""
|
172
|
+
msgstr "管理工作祈願"
|
152
173
|
|
153
174
|
msgid "Provider"
|
154
|
-
msgstr ""
|
175
|
+
msgstr "供應商"
|
155
176
|
|
156
177
|
msgid "Type"
|
157
|
-
msgstr ""
|
158
|
-
|
159
|
-
msgid "Inputs"
|
160
|
-
msgstr ""
|
178
|
+
msgstr "類型"
|
161
179
|
|
162
180
|
msgid "View job template content"
|
163
|
-
msgstr ""
|
181
|
+
msgstr "新工作範本內容"
|
164
182
|
|
165
183
|
msgid "Path to a file that contains the template"
|
166
|
-
msgstr ""
|
184
|
+
msgstr "包含範本的檔案之路徑"
|
167
185
|
|
168
186
|
msgid "Job template created"
|
169
|
-
msgstr ""
|
187
|
+
msgstr "已建立工作範本"
|
170
188
|
|
171
189
|
msgid "Could not create the job template"
|
172
|
-
msgstr ""
|
190
|
+
msgstr "無法建立工作範本"
|
173
191
|
|
174
192
|
msgid "Path to a file that contains the template - must include ERB metadata"
|
175
193
|
msgstr ""
|
@@ -184,26 +202,25 @@ msgid "Export a template including all metadata"
|
|
184
202
|
msgstr ""
|
185
203
|
|
186
204
|
msgid "Job template updated"
|
187
|
-
msgstr ""
|
205
|
+
msgstr "已更新工作範本"
|
188
206
|
|
189
207
|
msgid "Could not update the job template"
|
190
|
-
msgstr ""
|
208
|
+
msgstr "無法更新工作範本"
|
191
209
|
|
192
210
|
msgid "Job template deleted"
|
193
|
-
msgstr ""
|
211
|
+
msgstr "已刪除工作範本"
|
194
212
|
|
195
213
|
msgid "Could not delete the job template"
|
196
|
-
msgstr ""
|
214
|
+
msgstr "無法刪除工作範本"
|
197
215
|
|
198
216
|
msgid "Manage job templates"
|
199
|
-
msgstr ""
|
217
|
+
msgstr "管理工作範本"
|
200
218
|
|
201
219
|
msgid ""
|
202
|
-
"Comma-separated list of key=file, where file is a path to a text file to be
|
203
|
-
"
|
204
|
-
msgstr ""
|
220
|
+
"Comma-separated list of key=file, where file is a path to a text file to be "
|
221
|
+
"read"
|
222
|
+
msgstr "key=file 清單,以逗號隔開;其中 file 是要讀取的文字檔案路徑"
|
205
223
|
|
206
|
-
#, fuzzy
|
207
224
|
msgid ""
|
208
225
|
"Cron line format 'a b c d e', where:\n"
|
209
226
|
" a. is minute (range: 0-59)\n"
|
@@ -211,7 +228,13 @@ msgid ""
|
|
211
228
|
" c. is day of month (range: 1-31)\n"
|
212
229
|
" d. is month (range: 1-12)\n"
|
213
230
|
" e. is day of week (range: 0-6)"
|
214
|
-
msgstr "
|
231
|
+
msgstr ""
|
232
|
+
"Cron 行格式 'a b c d e',其中:\n"
|
233
|
+
" a. 分鐘(範圍:0-59)\n"
|
234
|
+
" b. 小時(範圍:0-23)\n"
|
235
|
+
" c. 日期(範圍:1-31)\n"
|
236
|
+
" d. 月份(範圍:1-12)\n"
|
237
|
+
" e. 星期幾(0-6)"
|
215
238
|
|
216
239
|
msgid "Manage remote execution features"
|
217
240
|
msgstr ""
|
@@ -220,9 +243,8 @@ msgid "Job template name"
|
|
220
243
|
msgstr ""
|
221
244
|
|
222
245
|
msgid "Label"
|
223
|
-
msgstr ""
|
246
|
+
msgstr "標籤"
|
224
247
|
|
225
|
-
#, fuzzy
|
226
248
|
msgid "Job template ID"
|
227
249
|
msgstr "ID"
|
228
250
|
|
@@ -232,32 +254,50 @@ msgstr ""
|
|
232
254
|
msgid "Could not update the remote execution feature"
|
233
255
|
msgstr ""
|
234
256
|
|
235
|
-
msgid "
|
257
|
+
msgid "Smart Proxies"
|
258
|
+
msgstr "智慧型代理伺服器"
|
259
|
+
|
260
|
+
msgid "Remote execution proxies"
|
236
261
|
msgstr ""
|
237
262
|
|
263
|
+
msgid "Id"
|
264
|
+
msgstr "ID"
|
265
|
+
|
266
|
+
msgid "Manage template inputs"
|
267
|
+
msgstr "管理範本輸入"
|
268
|
+
|
238
269
|
msgid "Input type"
|
239
|
-
msgstr ""
|
270
|
+
msgstr "輸入類型"
|
240
271
|
|
241
272
|
msgid "Fact name"
|
242
|
-
msgstr ""
|
273
|
+
msgstr "詳情名稱"
|
243
274
|
|
244
275
|
msgid "Variable name"
|
245
|
-
msgstr ""
|
276
|
+
msgstr "變數名稱"
|
246
277
|
|
247
278
|
msgid "Puppet parameter name"
|
248
|
-
msgstr ""
|
279
|
+
msgstr "Puppet 參數名稱"
|
249
280
|
|
250
281
|
msgid "Options"
|
282
|
+
msgstr "選項"
|
283
|
+
|
284
|
+
msgid "Default value"
|
251
285
|
msgstr ""
|
252
286
|
|
253
|
-
msgid "Template input created"
|
287
|
+
msgid "Template input created."
|
254
288
|
msgstr ""
|
255
289
|
|
256
290
|
msgid "Could not create the template input"
|
291
|
+
msgstr "無法建立範本輸入"
|
292
|
+
|
293
|
+
msgid "Template input updated."
|
257
294
|
msgstr ""
|
258
295
|
|
259
|
-
msgid "
|
296
|
+
msgid "Could not update the template input"
|
260
297
|
msgstr ""
|
261
298
|
|
262
|
-
msgid "
|
299
|
+
msgid "Template input deleted."
|
263
300
|
msgstr ""
|
301
|
+
|
302
|
+
msgid "Could not delete the template input"
|
303
|
+
msgstr "無法刪除範本輸入"
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
ENV['TEST_API_VERSION'] = '1.17'
|
2
4
|
|
3
5
|
require File.join(Gem.loaded_specs['hammer_cli_foreman'].full_gem_path, 'test/unit/test_helper')
|
@@ -7,10 +9,10 @@ require 'hammer_cli_foreman_remote_execution/template_input'
|
|
7
9
|
describe HammerCLIForemanRemoteExecution::TemplateInput do
|
8
10
|
include CommandTestHelper
|
9
11
|
|
10
|
-
|
12
|
+
describe 'ListCommand' do
|
11
13
|
let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::ListCommand.new('', ctx) }
|
12
14
|
|
13
|
-
|
15
|
+
describe 'output' do
|
14
16
|
with_params ['--template-id=1'] do
|
15
17
|
let(:expected_record_count) { cmd.resource.call(:index, :template_id => 1)['results'].length }
|
16
18
|
it_should_print_n_records
|
@@ -19,32 +21,32 @@ describe HammerCLIForemanRemoteExecution::TemplateInput do
|
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
|
-
|
24
|
+
describe 'InfoCommand' do
|
23
25
|
let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::InfoCommand.new('', ctx) }
|
24
26
|
|
25
|
-
|
27
|
+
describe 'parameters' do
|
26
28
|
it_should_accept 'required parameters', ['--template-id=template', '--name=foo']
|
27
29
|
end
|
28
30
|
|
29
|
-
|
31
|
+
describe 'output' do
|
30
32
|
with_params ['--template-id=1', '--id=1'] do
|
31
33
|
it_should_print_columns ['ID', 'Name', 'Input type', 'Fact name', 'Variable name', 'Puppet parameter name']
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
36
|
-
|
38
|
+
describe 'DeleteCommand' do
|
37
39
|
let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::DeleteCommand.new('', ctx) }
|
38
40
|
|
39
|
-
|
41
|
+
describe 'parameters' do
|
40
42
|
it_should_accept 'required parameters', ['--template-id=template', '--name=foo']
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
|
-
|
46
|
+
describe 'CreateCommand' do
|
45
47
|
let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::CreateCommand.new('', ctx) }
|
46
48
|
|
47
|
-
|
49
|
+
describe 'parameters' do
|
48
50
|
it_should_accept 'create options', ['--template-id=1', "--name=asdf", '--input-type=user']
|
49
51
|
end
|
50
52
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
ENV['TEST_API_VERSION'] = '1.17'
|
2
4
|
|
3
5
|
require File.join(Gem.loaded_specs['hammer_cli_foreman'].full_gem_path, 'test/unit/test_helper')
|
@@ -7,80 +9,82 @@ require 'hammer_cli_foreman_remote_execution'
|
|
7
9
|
describe HammerCLIForemanRemoteExecution::JobInvocation do
|
8
10
|
include CommandTestHelper
|
9
11
|
|
10
|
-
|
12
|
+
describe 'ListCommand' do
|
11
13
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobInvocation::ListCommand.new('', ctx) }
|
12
14
|
|
13
|
-
|
15
|
+
describe 'parameters' do
|
14
16
|
it_should_accept 'no arguments'
|
15
17
|
it_should_accept_search_params
|
16
18
|
end
|
17
19
|
|
18
|
-
|
20
|
+
describe 'output' do
|
19
21
|
let(:expected_record_count) { cmd.resource.call(:index)['results'].length }
|
20
22
|
it_should_print_n_records
|
21
23
|
it_should_print_columns ['ID', 'Description', 'Status', 'Success', 'Failed', 'Pending', 'Total', 'Start']
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
|
27
|
+
describe 'InfoCommand' do
|
26
28
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobInvocation::InfoCommand.new('', ctx) }
|
27
29
|
|
28
30
|
before :each do
|
29
31
|
cmd.stubs(:get_parameters).returns([])
|
30
32
|
end
|
31
33
|
|
32
|
-
|
34
|
+
describe 'parameters' do
|
33
35
|
it_should_accept 'id', ['--id=1']
|
34
36
|
|
35
37
|
it 'should not accept name' do
|
36
38
|
_out, _err = capture_io do
|
37
|
-
cmd.run(%w
|
39
|
+
_(cmd.run(%w[--name foobar])).must_equal HammerCLI::EX_USAGE
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
|
-
|
44
|
+
describe 'output' do
|
43
45
|
with_params ['--id=1'] do
|
44
|
-
it_should_print_columns ['ID','Description','Status','Success','Failed','Pending','Total','Start',
|
46
|
+
it_should_print_columns ['ID', 'Description', 'Status', 'Success', 'Failed', 'Pending', 'Total', 'Start',
|
47
|
+
'Job Category', 'Mode', 'Cron line', 'Recurring logic ID', 'Hosts', 'Randomized ordering']
|
45
48
|
end
|
46
49
|
end
|
47
50
|
end
|
48
51
|
|
49
|
-
|
52
|
+
describe 'CreateCommand' do
|
50
53
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobInvocation::CreateCommand.new('', ctx) }
|
51
54
|
|
52
|
-
|
55
|
+
describe 'parameters' do
|
53
56
|
it 'detects async flag correctly' do
|
54
57
|
refute cmd.option_async?
|
55
58
|
_out, err = capture_io do
|
56
|
-
cmd.run(['--job-template="Run Command - SSH Default', '--inputs=command="hostname"',
|
59
|
+
_(cmd.run(['--job-template="Run Command - SSH Default', '--inputs=command="hostname"',
|
60
|
+
'--search-query="name ~ foreman"', '--start-at="2099-01-01 12:00"', '--async'])).must_equal HammerCLI::EX_OK
|
57
61
|
end
|
58
|
-
err.must_be :empty?
|
62
|
+
_(err).must_be :empty?
|
59
63
|
assert cmd.option_async?
|
60
64
|
end
|
61
65
|
end
|
62
66
|
end
|
63
67
|
|
64
|
-
|
68
|
+
describe 'Cancel Command' do
|
65
69
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobInvocation::CancelCommand.new('', ctx) }
|
66
70
|
|
67
71
|
it_should_accept 'cancel options', ['--id=1', '--force=yes']
|
68
72
|
|
69
73
|
it 'should not accept name' do
|
70
74
|
_out, _err = capture_io do
|
71
|
-
cmd.run(%w
|
75
|
+
_(cmd.run(%w[--name foobar])).must_equal HammerCLI::EX_USAGE
|
72
76
|
end
|
73
77
|
end
|
74
78
|
end
|
75
79
|
|
76
|
-
|
80
|
+
describe 'RerunCommand' do
|
77
81
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobInvocation::RerunCommand.new('', ctx) }
|
78
82
|
|
79
83
|
it_should_accept 'rerun options', ['--id=1', '--failed-only=false']
|
80
84
|
|
81
85
|
it 'should not accept name' do
|
82
86
|
_out, _err = capture_io do
|
83
|
-
cmd.run(%w
|
87
|
+
_(cmd.run(%w[--name foobar])).must_equal HammerCLI::EX_USAGE
|
84
88
|
end
|
85
89
|
end
|
86
90
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
ENV['TEST_API_VERSION'] = '1.17'
|
2
4
|
|
3
5
|
require File.join(Gem.loaded_specs['hammer_cli_foreman'].full_gem_path, 'test/unit/test_helper')
|
@@ -7,100 +9,103 @@ require 'hammer_cli_foreman_remote_execution/job_template'
|
|
7
9
|
describe HammerCLIForemanRemoteExecution::JobTemplate do
|
8
10
|
include CommandTestHelper
|
9
11
|
|
10
|
-
|
12
|
+
describe 'ListCommand' do
|
11
13
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::ListCommand.new('', ctx) }
|
12
14
|
|
13
|
-
|
15
|
+
describe 'parameters' do
|
14
16
|
it_should_accept 'no arguments'
|
15
17
|
it_should_accept_search_params
|
16
18
|
end
|
17
19
|
|
18
|
-
|
20
|
+
describe 'output' do
|
19
21
|
let(:expected_record_count) { cmd.resource.call(:index)['results'].length }
|
20
22
|
it_should_print_n_records
|
21
23
|
it_should_print_columns ['ID', 'Name', 'Job Category', 'Provider', 'Type']
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
|
27
|
+
describe 'InfoCommand' do
|
26
28
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::InfoCommand.new('', ctx) }
|
27
29
|
|
28
30
|
before :each do
|
29
31
|
cmd.stubs(:get_parameters).returns([])
|
30
32
|
end
|
31
33
|
|
32
|
-
|
34
|
+
describe 'parameters' do
|
33
35
|
it_should_accept 'id', ['--id=1']
|
34
36
|
it_should_accept 'name', ['--name=template']
|
35
37
|
end
|
36
38
|
|
37
|
-
|
39
|
+
describe 'output' do
|
38
40
|
with_params ['--id=1'] do
|
39
41
|
it_should_print_columns ['ID', 'Name', 'Job Category', 'Provider', 'Type']
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
|
-
|
46
|
+
describe 'DumpCommand' do
|
45
47
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::DumpCommand.new('', ctx) }
|
46
48
|
|
47
|
-
|
49
|
+
describe 'parameters' do
|
48
50
|
it_should_accept 'id', ['--id=1']
|
49
51
|
it_should_accept 'name', ['--name=template']
|
50
52
|
end
|
51
53
|
|
52
|
-
|
54
|
+
describe 'output' do
|
53
55
|
it 'must dump template' do
|
54
56
|
cmd.stubs(:context).returns(ctx.update(:adapter => :test))
|
55
57
|
out, _err = capture_io do
|
56
58
|
cmd.run(['--id=1'])
|
57
59
|
end
|
58
|
-
out.must_match(/id/)
|
60
|
+
_(out).must_match(/id/)
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
62
64
|
|
63
|
-
|
65
|
+
describe 'ImportCommand' do
|
64
66
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::ImportCommand.new('', ctx) }
|
65
67
|
|
66
|
-
|
67
|
-
it_should_accept 'import options',
|
68
|
+
describe 'parameters' do
|
69
|
+
it_should_accept 'import options',
|
70
|
+
["--file=#{File.join(File.dirname(__FILE__), '..', 'data', 'export.erb')}", '--overwrite=false']
|
68
71
|
end
|
69
72
|
end
|
70
73
|
|
71
|
-
|
74
|
+
describe 'ExportCommand' do
|
72
75
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::ExportCommand.new('', ctx) }
|
73
76
|
|
74
|
-
|
77
|
+
describe 'parameters' do
|
75
78
|
it_should_accept 'id', ['--id=1']
|
76
79
|
it_should_accept 'name', ['--name=template']
|
77
80
|
end
|
78
81
|
|
79
|
-
|
82
|
+
describe 'output' do
|
80
83
|
it 'must export template' do
|
81
84
|
cmd.stubs(:context).returns(ctx.update(:adapter => :test))
|
82
85
|
out, _err = capture_io do
|
83
86
|
cmd.run(['--id=1'])
|
84
87
|
end
|
85
|
-
out.must_match(/id/)
|
88
|
+
_(out).must_match(/id/)
|
86
89
|
end
|
87
90
|
end
|
88
91
|
end
|
89
92
|
|
90
|
-
|
93
|
+
describe 'DeleteCommand' do
|
91
94
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::DeleteCommand.new('', ctx) }
|
92
95
|
|
93
|
-
|
96
|
+
describe 'parameters' do
|
94
97
|
it_should_accept 'name', ['--name=template']
|
95
98
|
it_should_accept 'id', ['--id=1']
|
96
99
|
end
|
97
100
|
end
|
98
101
|
|
99
|
-
|
102
|
+
describe 'CreateCommand' do
|
100
103
|
let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::CreateCommand.new('', ctx) }
|
101
104
|
|
102
|
-
|
103
|
-
it_should_accept 'create options',
|
105
|
+
describe 'parameters' do
|
106
|
+
it_should_accept 'create options',
|
107
|
+
['--name=Test', "--file=#{File.join(File.dirname(__FILE__), '..', 'data', 'template.txt')}", '--job-category=Install',
|
108
|
+
'--provider-type=SSH']
|
104
109
|
end
|
105
110
|
end
|
106
111
|
end
|