foreman_ansible 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -4
  3. data/app/controllers/api/v2/ansible_override_values_controller.rb +53 -0
  4. data/app/controllers/api/v2/ansible_roles_controller.rb +2 -1
  5. data/app/controllers/api/v2/ansible_variables_controller.rb +32 -4
  6. data/app/controllers/concerns/foreman/controller/parameters/ansible_override_value.rb +36 -0
  7. data/app/models/concerns/foreman_ansible/host_managed_extensions.rb +56 -37
  8. data/app/services/foreman_ansible/inventory_creator.rb +10 -5
  9. data/app/services/foreman_ansible/operating_system_parser.rb +10 -0
  10. data/app/services/foreman_ansible/roles_importer.rb +1 -2
  11. data/app/views/ansible_variables/index.html.erb +1 -1
  12. data/app/views/api/v2/ansible_override_values/show.json.rabl +3 -0
  13. data/app/views/api/v2/ansible_variables/destroy.json.rabl +3 -0
  14. data/app/views/api/v2/ansible_variables/show.json.rabl +5 -4
  15. data/config/routes.rb +3 -1
  16. data/lib/foreman_ansible/engine.rb +2 -2
  17. data/lib/foreman_ansible/version.rb +1 -1
  18. data/locale/action_names.rb +3 -3
  19. data/locale/de/foreman_ansible.edit.po +238 -87
  20. data/locale/de/foreman_ansible.po +77 -2
  21. data/locale/en/foreman_ansible.edit.po +238 -87
  22. data/locale/en/foreman_ansible.po +77 -2
  23. data/locale/es/foreman_ansible.edit.po +238 -87
  24. data/locale/es/foreman_ansible.po +77 -2
  25. data/locale/foreman_ansible.pot +126 -24
  26. data/locale/fr/foreman_ansible.edit.po +238 -87
  27. data/locale/fr/foreman_ansible.po +77 -2
  28. data/locale/it/foreman_ansible.edit.po +238 -87
  29. data/locale/it/foreman_ansible.po +77 -2
  30. data/locale/ja/foreman_ansible.edit.po +238 -87
  31. data/locale/ja/foreman_ansible.po +77 -2
  32. data/locale/ko/foreman_ansible.edit.po +238 -87
  33. data/locale/ko/foreman_ansible.po +77 -2
  34. data/locale/pt_BR/foreman_ansible.edit.po +238 -87
  35. data/locale/pt_BR/foreman_ansible.po +77 -2
  36. data/locale/ru/foreman_ansible.edit.po +238 -87
  37. data/locale/ru/foreman_ansible.po +77 -2
  38. data/locale/zh_CN/foreman_ansible.edit.po +238 -87
  39. data/locale/zh_CN/foreman_ansible.po +77 -2
  40. data/locale/zh_TW/foreman_ansible.edit.po +238 -87
  41. data/locale/zh_TW/foreman_ansible.po +77 -2
  42. data/test/functional/api/v2/ansible_roles_controller_test.rb +8 -7
  43. data/test/unit/services/fact_parser_test.rb +7 -3
  44. data/test/unit/services/inventory_creator_test.rb +15 -1
  45. metadata +8 -4
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_ansible 2.2.6\n"
8
+ "Project-Id-Version: foreman_ansible 2.3.0\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2018-03-12 12:24-0400\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -50,6 +50,9 @@ msgstr ""
50
50
  msgid "Ansible role"
51
51
  msgstr ""
52
52
 
53
+ msgid "Ansible role names to import"
54
+ msgstr ""
55
+
53
56
  msgid "Ansible support in Foreman"
54
57
  msgstr ""
55
58
 
@@ -98,6 +101,12 @@ msgstr ""
98
101
  msgid "Could not run Ansible roles for %{host}"
99
102
  msgstr ""
100
103
 
104
+ msgid "Create an override value for a specific ansible variable"
105
+ msgstr ""
106
+
107
+ msgid "Default value of variable"
108
+ msgstr ""
109
+
101
110
  msgid "Default verbosity level"
102
111
  msgstr ""
103
112
 
@@ -110,6 +119,12 @@ msgstr ""
110
119
  msgid "Deletes Ansible variable"
111
120
  msgstr ""
112
121
 
122
+ msgid "Description of variable"
123
+ msgstr ""
124
+
125
+ msgid "Destroy an override value"
126
+ msgstr ""
127
+
113
128
  msgid "Disable host configuration status turning to out of sync for %{cfgmgmt} after report does not arrive within configured interval"
114
129
  msgstr ""
115
130
 
@@ -128,6 +143,9 @@ msgstr ""
128
143
  msgid "Error loading data from proxy"
129
144
  msgstr ""
130
145
 
146
+ msgid "Fetch Ansible roles available to be imported"
147
+ msgstr ""
148
+
131
149
  msgid "Foreman"
132
150
  msgstr ""
133
151
 
@@ -155,6 +173,12 @@ msgstr ""
155
173
  msgid "IDs of associated ansible roles"
156
174
  msgstr ""
157
175
 
176
+ msgid "IDs of hostgroups to play roles on"
177
+ msgstr ""
178
+
179
+ msgid "IDs of hosts to play roles on"
180
+ msgstr ""
181
+
158
182
  msgid "If ERB is used in a parameter value, the validation of the value will happen during the ENC request. If the value is invalid, the ENC request will fail."
159
183
  msgstr ""
160
184
 
@@ -185,6 +209,9 @@ msgstr ""
185
209
  msgid "Imported at"
186
210
  msgstr ""
187
211
 
212
+ msgid "Include default value when merging all matching values"
213
+ msgstr ""
214
+
188
215
  msgid "Insights remediation on %{hosts_count} host(s) has finished successfully"
189
216
  msgstr ""
190
217
 
@@ -218,6 +245,15 @@ msgstr ""
218
245
  msgid "List Ansible variables"
219
246
  msgstr ""
220
247
 
248
+ msgid "List all Ansible roles for a host"
249
+ msgstr ""
250
+
251
+ msgid "List all Ansible roles for a hostgroup"
252
+ msgstr ""
253
+
254
+ msgid "Merge all matching values (only array/hash type)"
255
+ msgstr ""
256
+
221
257
  msgid "Message"
222
258
  msgstr ""
223
259
 
@@ -227,6 +263,9 @@ msgstr ""
227
263
  msgid "Name"
228
264
  msgstr ""
229
265
 
266
+ msgid "Name of variable"
267
+ msgstr ""
268
+
230
269
  msgid "Nest"
231
270
  msgstr ""
232
271
 
@@ -262,6 +301,12 @@ msgstr ""
262
301
  msgid "Operation"
263
302
  msgstr ""
264
303
 
304
+ msgid "Override match"
305
+ msgstr ""
306
+
307
+ msgid "Override value, required if omit is false"
308
+ msgstr ""
309
+
265
310
  msgid "Play Ansible roles"
266
311
  msgstr ""
267
312
 
@@ -301,6 +346,12 @@ msgstr ""
301
346
  msgid "Remove"
302
347
  msgstr ""
303
348
 
349
+ msgid "Remove duplicate values (only array type)"
350
+ msgstr ""
351
+
352
+ msgid "Role ID"
353
+ msgstr ""
354
+
304
355
  msgid "Roles"
305
356
  msgstr ""
306
357
 
@@ -325,9 +376,18 @@ msgstr ""
325
376
  msgid "Show variable"
326
377
  msgstr ""
327
378
 
379
+ msgid "Smart Proxy to fetch from"
380
+ msgstr ""
381
+
328
382
  msgid "Smart Proxy to import from"
329
383
  msgstr ""
330
384
 
385
+ msgid "The order in which values are resolved"
386
+ msgstr ""
387
+
388
+ msgid "There are no Ansible roles to play"
389
+ msgstr ""
390
+
331
391
  msgid "This list of roles will be applied when the host finishes<br/> provisioning. Users can also play these roles through the API<br/>or by clicking on the Play Roles button on the Host page "
332
392
  msgstr ""
333
393
 
@@ -346,6 +406,12 @@ msgstr ""
346
406
  msgid "Type"
347
407
  msgstr ""
348
408
 
409
+ msgid "Types of validation values"
410
+ msgstr ""
411
+
412
+ msgid "Types of variable values"
413
+ msgstr ""
414
+
349
415
  msgid "Unable to get roles from Ansible"
350
416
  msgstr ""
351
417
 
@@ -355,12 +421,18 @@ msgstr ""
355
421
  msgid "Update"
356
422
  msgstr ""
357
423
 
424
+ msgid "Updates Ansible variable"
425
+ msgstr ""
426
+
358
427
  msgid "Use this connection type by default when running Ansible playbooks. You can override this on hosts by adding a parameter \"ansible_connection\""
359
428
  msgstr ""
360
429
 
361
430
  msgid "Use this to supply a path to an SSH Private Key that Ansible will use in lieu of a password Override with \"ansible_ssh_private_key_file\" host parameter"
362
431
  msgstr ""
363
432
 
433
+ msgid "Used to enforce certain values for the parameter values"
434
+ msgstr ""
435
+
364
436
  msgid "Variables"
365
437
  msgstr ""
366
438
 
@@ -370,7 +442,10 @@ msgstr ""
370
442
  msgid "Variable|Role"
371
443
  msgstr ""
372
444
 
373
- msgid "Whether to put Ansible parameters in the \"hostvars\" top-level key of the inventory. By default it is true, so that Host Parameters can be used directly in the playbooks.When false, Host Parameters can only be accessed throughforeman_params[\"host_parameter\"] in the playbooks."
445
+ msgid "When enabled the parameter is hidden in the UI"
446
+ msgstr ""
447
+
448
+ msgid "Whether to put Ansible parameters in the \"hostvars\" top-level key of the inventory. By default it is true, so that Host Parameters can be used directly in the playbooks. When false, Host Parameters can only be accessed through foreman_params[\"host_parameter\"] in the playbooks."
374
449
  msgstr ""
375
450
 
376
451
  msgid "WinRM cert Validation"
@@ -45,13 +45,14 @@ module Api
45
45
  }, :session => set_session_user
46
46
  assert_response :success
47
47
  end
48
- end
49
-
50
- test 'should fetch' do
51
- get :fetch, :session => set_session_user
52
- response = JSON.parse(@response.body)
53
- refute_empty response['results']
54
- assert_response :success
48
+ test 'should fetch' do
49
+ get :fetch, :params => {
50
+ :proxy_id => @proxy.id
51
+ }, :session => set_session_user
52
+ response = JSON.parse(@response.body)
53
+ assert_not_empty response['results']
54
+ assert_response :success
55
+ end
55
56
  end
56
57
  end
57
58
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require 'test_plugin_helper'
2
3
 
3
4
  module ForemanAnsible
4
5
  # Checks sample Ansible facts to see if it can assign them to
@@ -122,9 +123,12 @@ module ForemanAnsible
122
123
  end
123
124
 
124
125
  test 'Parses debian unstable aka sid correctly' do
125
- os = @facts_parser.operatingsystem
126
- assert_equal '10', os.major
127
- assert_equal 'Debian', os.name
126
+ as_admin do
127
+ os = @facts_parser.operatingsystem
128
+
129
+ assert_equal '10', os.major
130
+ assert_equal 'Debian', os.name
131
+ end
128
132
  end
129
133
  end
130
134
 
@@ -10,7 +10,8 @@ module ForemanAnsible
10
10
  setup do
11
11
  @host = FactoryBot.build(:host)
12
12
  @template_invocation = OpenStruct.new(
13
- :job_invocation => OpenStruct.new(:password => 'foobar'),
13
+ :job_invocation => OpenStruct.new(:password => 'foobar',
14
+ :sudo_password => 'foobar'),
14
15
  :effective_user => 'foobar'
15
16
  )
16
17
  end
@@ -30,6 +31,7 @@ module ForemanAnsible
30
31
  end
31
32
 
32
33
  test 'settings are respected if param cannot be found' do
34
+ AnsibleProvider.stubs(:find_ip_or_hostname).with(@host).returns(@host.name)
33
35
  extra_options = { 'ansible_user' => 'someone', 'ansible_port' => 2000 }
34
36
  Setting.expects(:[]).with('Enable_Smart_Variables_in_ENC').
35
37
  returns(nil).at_least_once
@@ -41,6 +43,8 @@ module ForemanAnsible
41
43
  returns('root').at_least_once
42
44
  Setting.expects(:[]).with('remote_execution_ssh_password').
43
45
  returns('asafepassword').at_least_once
46
+ Setting.expects(:[]).with('remote_execution_sudo_password').
47
+ returns('foobar').at_least_once
44
48
  Setting.expects(:[]).with('ansible_winrm_server_cert_validation').
45
49
  returns(true).at_least_once
46
50
  Setting.expects(:[]).with('ansible_connection').
@@ -69,6 +73,8 @@ module ForemanAnsible
69
73
  connection_params['ansible_port']
70
74
  assert_equal Setting['remote_execution_ssh_password'],
71
75
  connection_params['ansible_ssh_pass']
76
+ assert_equal Setting['remote_execution_sudo_password'],
77
+ connection_params['ansible_sudo_pass']
72
78
  assert_equal Setting['ansible_winrm_server_cert_validation'],
73
79
  connection_params['ansible_winrm_server_cert_validation']
74
80
  end
@@ -80,8 +86,16 @@ module ForemanAnsible
80
86
  inventory.rex_ssh_password(@host))
81
87
  end
82
88
 
89
+ test 'job invocation sudo password is passed when available' do
90
+ inventory = ForemanAnsible::InventoryCreator.new(@host,
91
+ @template_invocation)
92
+ assert_equal(@template_invocation.job_invocation.sudo_password,
93
+ inventory.rex_sudo_password(@host))
94
+ end
95
+
83
96
  test 'ssh private key is passed when available' do
84
97
  host = FactoryBot.build(:host)
98
+ AnsibleProvider.stubs(:find_ip_or_hostname).with(host).returns(host.name)
85
99
  path_to_key = '/path/to/private/key'
86
100
  inventory = ForemanAnsible::InventoryCreator.new(host,
87
101
  @template_invocation)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Lobato Garcia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-22 00:00:00.000000000 Z
11
+ date: 2019-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -72,7 +72,7 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.6.3
75
+ version: 1.7.0
76
76
  - - "<"
77
77
  - !ruby/object:Gem::Version
78
78
  version: '2.0'
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- version: 1.6.3
85
+ version: 1.7.0
86
86
  - - "<"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '2.0'
@@ -120,8 +120,10 @@ files:
120
120
  - app/assets/stylesheets/foreman_ansible/foreman-ansible.css
121
121
  - app/controllers/ansible_roles_controller.rb
122
122
  - app/controllers/ansible_variables_controller.rb
123
+ - app/controllers/api/v2/ansible_override_values_controller.rb
123
124
  - app/controllers/api/v2/ansible_roles_controller.rb
124
125
  - app/controllers/api/v2/ansible_variables_controller.rb
126
+ - app/controllers/concerns/foreman/controller/parameters/ansible_override_value.rb
125
127
  - app/controllers/concerns/foreman/controller/parameters/ansible_variable.rb
126
128
  - app/controllers/foreman_ansible/api/v2/hostgroups_controller_extensions.rb
127
129
  - app/controllers/foreman_ansible/api/v2/hostgroups_param_group_extensions.rb
@@ -177,10 +179,12 @@ files:
177
179
  - app/views/ansible_variables/edit.html.erb
178
180
  - app/views/ansible_variables/import.html.erb
179
181
  - app/views/ansible_variables/index.html.erb
182
+ - app/views/api/v2/ansible_override_values/show.json.rabl
180
183
  - app/views/api/v2/ansible_roles/import.json.rabl
181
184
  - app/views/api/v2/ansible_roles/index.json.rabl
182
185
  - app/views/api/v2/ansible_roles/obsolete.json.rabl
183
186
  - app/views/api/v2/ansible_roles/show.json.rabl
187
+ - app/views/api/v2/ansible_variables/destroy.json.rabl
184
188
  - app/views/api/v2/ansible_variables/import.json.rabl
185
189
  - app/views/api/v2/ansible_variables/index.json.rabl
186
190
  - app/views/api/v2/ansible_variables/obsolete.json.rabl