foreman_ansible 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/ansible_inventories_controller.rb +51 -0
  3. data/app/controllers/api/v2/ansible_roles_controller.rb +6 -2
  4. data/app/controllers/api/v2/ansible_variables_controller.rb +2 -0
  5. data/app/views/foreman_ansible/job_templates/ansible_roles_-_ansible_default.erb +1 -1
  6. data/app/views/foreman_ansible/job_templates/run_command_-_ansible_default.erb +3 -2
  7. data/config/routes.rb +9 -0
  8. data/lib/foreman_ansible/register.rb +8 -3
  9. data/lib/foreman_ansible/version.rb +1 -1
  10. data/locale/de/foreman_ansible.edit.po +271 -170
  11. data/locale/de/foreman_ansible.po +19 -1
  12. data/locale/en/foreman_ansible.edit.po +56 -32
  13. data/locale/en/foreman_ansible.po +19 -1
  14. data/locale/es/foreman_ansible.edit.po +296 -175
  15. data/locale/es/foreman_ansible.po +19 -1
  16. data/locale/foreman_ansible.pot +60 -32
  17. data/locale/fr/foreman_ansible.edit.po +310 -187
  18. data/locale/fr/foreman_ansible.po +19 -1
  19. data/locale/it/foreman_ansible.edit.po +214 -120
  20. data/locale/it/foreman_ansible.po +19 -1
  21. data/locale/ja/foreman_ansible.edit.po +276 -182
  22. data/locale/ja/foreman_ansible.po +19 -1
  23. data/locale/ko/foreman_ansible.edit.po +196 -116
  24. data/locale/ko/foreman_ansible.po +19 -1
  25. data/locale/pt_BR/foreman_ansible.edit.po +294 -173
  26. data/locale/pt_BR/foreman_ansible.po +19 -1
  27. data/locale/ru/foreman_ansible.edit.po +207 -113
  28. data/locale/ru/foreman_ansible.po +19 -1
  29. data/locale/zh_CN/foreman_ansible.edit.po +272 -183
  30. data/locale/zh_CN/foreman_ansible.po +19 -1
  31. data/locale/zh_TW/foreman_ansible.edit.po +196 -116
  32. data/locale/zh_TW/foreman_ansible.po +19 -1
  33. data/test/factories/ansible_variables.rb +1 -1
  34. data/test/functional/api/v2/ansible_inventories_controller_test.rb +51 -0
  35. metadata +5 -2
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_ansible 3.0.0\n"
8
+ "Project-Id-Version: foreman_ansible 3.0.2\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"
@@ -209,9 +209,15 @@ msgstr ""
209
209
  msgid "IDs of associated ansible roles"
210
210
  msgstr ""
211
211
 
212
+ msgid "IDs of hostgroups included in inventory"
213
+ msgstr ""
214
+
212
215
  msgid "IDs of hostgroups to play roles on"
213
216
  msgstr ""
214
217
 
218
+ msgid "IDs of hosts included in inventory"
219
+ msgstr ""
220
+
215
221
  msgid "IDs of hosts to play roles on"
216
222
  msgstr ""
217
223
 
@@ -446,6 +452,12 @@ msgstr ""
446
452
  msgid "Set the order in which values are resolved."
447
453
  msgstr ""
448
454
 
455
+ msgid "Show Ansible inventory for hostgroups"
456
+ msgstr ""
457
+
458
+ msgid "Show Ansible inventory for hosts"
459
+ msgstr ""
460
+
449
461
  msgid "Show role"
450
462
  msgstr ""
451
463
 
@@ -458,6 +470,9 @@ msgstr ""
458
470
  msgid "Smart Proxy to import from"
459
471
  msgstr ""
460
472
 
473
+ msgid "Smart proxy id is required"
474
+ msgstr ""
475
+
461
476
  msgid "Specify Matchers"
462
477
  msgstr ""
463
478
 
@@ -524,5 +539,8 @@ msgstr ""
524
539
  msgid "When enabled the parameter is hidden in the UI"
525
540
  msgstr ""
526
541
 
542
+ msgid "Whether to override variable or not"
543
+ msgstr ""
544
+
527
545
  msgid "WinRM cert Validation"
528
546
  msgstr ""
@@ -5,6 +5,6 @@ FactoryBot.define do
5
5
  sequence(:key) { |n| "ansible_variable_#{n}" }
6
6
  sequence(:default_value) { |n| "default_value_#{n}" }
7
7
  ansible_role
8
- imported true
8
+ imported { true }
9
9
  end
10
10
  end
@@ -0,0 +1,51 @@
1
+ require 'test_plugin_helper'
2
+
3
+ module Api
4
+ module V2
5
+ class AnsibleInventoriesControllerTest < ActionController::TestCase
6
+ setup do
7
+ @hostgroup = FactoryBot.create(:hostgroup)
8
+ @host1 = FactoryBot.create(:host, :hostgroup_id => @hostgroup.id)
9
+ @host2 = FactoryBot.create(:host, :hostgroup_id => @hostgroup.id)
10
+ @host3 = FactoryBot.create(:host)
11
+ end
12
+
13
+ test 'should show inventory for hosts by GET' do
14
+ hosts = [@host1, @host3]
15
+ get :hosts, :params => { :host_ids => hosts.pluck(:id) }, :session => set_session_user
16
+ hosts_inventory_assertions(hosts)
17
+ end
18
+
19
+ test 'should show inventory for hosts by POST' do
20
+ hosts = [@host1, @host3]
21
+ post :hosts, :params => { :host_ids => hosts.pluck(:id) }, :session => set_session_user
22
+ hosts_inventory_assertions(hosts)
23
+ end
24
+
25
+ test 'should show inventory for hostgroup by GET' do
26
+ get :hostgroups, :params => { :hostgroup_ids => [@hostgroup.id] }, :session => set_session_user
27
+ hosts_inventory_assertions(@hostgroup.hosts)
28
+ end
29
+
30
+ test 'should show inventory for hostgroup by POST' do
31
+ get :hostgroups, :params => { :hostgroup_ids => [@hostgroup.id] }, :session => set_session_user
32
+ hosts_inventory_assertions(@hostgroup.hosts)
33
+ end
34
+
35
+ private
36
+
37
+ def hosts_inventory_assertions(hosts)
38
+ response = JSON.parse(@response.body)
39
+ all_hosts = response['all']['hosts']
40
+ hosts.each do |host|
41
+ assert all_hosts.include?(host.name)
42
+ end
43
+ hostvars = response["_meta"]["hostvars"]
44
+ hosts.each do |host|
45
+ assert hostvars[host.name]
46
+ end
47
+ assert_equal hosts.count, hostvars.keys.count
48
+ end
49
+ end
50
+ end
51
+ end
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: 3.0.2
4
+ version: 3.0.3
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: 2019-05-02 00:00:00.000000000 Z
11
+ date: 2019-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -120,6 +120,7 @@ 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_inventories_controller.rb
123
124
  - app/controllers/api/v2/ansible_override_values_controller.rb
124
125
  - app/controllers/api/v2/ansible_roles_controller.rb
125
126
  - app/controllers/api/v2/ansible_variables_controller.rb
@@ -293,6 +294,7 @@ files:
293
294
  - test/fixtures/sample_facts.json
294
295
  - test/functional/ansible_roles_controller_test.rb
295
296
  - test/functional/ansible_variables_controller_test.rb
297
+ - test/functional/api/v2/ansible_inventories_controller_test.rb
296
298
  - test/functional/api/v2/ansible_roles_controller_test.rb
297
299
  - test/functional/api/v2/ansible_variables_controller_test.rb
298
300
  - test/functional/api/v2/hostgroups_controller_test.rb
@@ -415,6 +417,7 @@ test_files:
415
417
  - test/test_plugin_helper.rb
416
418
  - test/functional/hosts_controller_test.rb
417
419
  - test/functional/api/v2/hosts_controller_test.rb
420
+ - test/functional/api/v2/ansible_inventories_controller_test.rb
418
421
  - test/functional/api/v2/ansible_roles_controller_test.rb
419
422
  - test/functional/api/v2/ansible_variables_controller_test.rb
420
423
  - test/functional/api/v2/hostgroups_controller_test.rb