foreman_salt 1.1.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -3
  3. data/app/controllers/foreman_salt/api/v2/base_controller.rb +13 -0
  4. data/app/controllers/foreman_salt/api/v2/jobs_controller.rb +9 -17
  5. data/app/controllers/foreman_salt/api/v2/salt_autosign_controller.rb +64 -0
  6. data/app/controllers/foreman_salt/api/v2/salt_environments_controller.rb +46 -0
  7. data/app/controllers/foreman_salt/api/v2/salt_keys_controller.rb +79 -0
  8. data/app/controllers/foreman_salt/api/v2/salt_minions_controller.rb +44 -0
  9. data/app/controllers/foreman_salt/api/v2/salt_states_controller.rb +46 -0
  10. data/app/controllers/foreman_salt/application_controller.rb +0 -1
  11. data/app/controllers/foreman_salt/concerns/hosts_controller_extensions.rb +0 -41
  12. data/app/controllers/foreman_salt/minions_controller.rb +54 -0
  13. data/app/controllers/foreman_salt/salt_autosign_controller.rb +8 -9
  14. data/app/controllers/foreman_salt/salt_environments_controller.rb +1 -1
  15. data/app/controllers/foreman_salt/salt_keys_controller.rb +10 -11
  16. data/app/controllers/foreman_salt/salt_modules_controller.rb +1 -1
  17. data/app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb +10 -10
  18. data/app/helpers/concerns/foreman_salt/smart_proxies_helper_extensions.rb +2 -2
  19. data/app/helpers/foreman_salt/salt_keys_helper.rb +2 -3
  20. data/app/lib/actions/foreman_salt/report_import.rb +1 -2
  21. data/app/lib/proxy_api/salt.rb +1 -1
  22. data/app/models/foreman_salt/concerns/host_managed_extensions.rb +4 -4
  23. data/app/models/foreman_salt/concerns/hostgroup_extensions.rb +2 -2
  24. data/app/models/foreman_salt/concerns/orchestration/salt.rb +1 -1
  25. data/app/models/foreman_salt/fact_name.rb +0 -1
  26. data/app/models/foreman_salt/salt_environment.rb +2 -0
  27. data/app/models/foreman_salt/salt_module.rb +3 -1
  28. data/app/models/setting/salt.rb +12 -0
  29. data/app/overrides/salt_modules_selector.rb +12 -12
  30. data/app/services/foreman_salt/fact_importer.rb +10 -7
  31. data/app/services/foreman_salt/fact_parser.rb +100 -0
  32. data/app/services/foreman_salt/report_importer.rb +17 -14
  33. data/app/services/foreman_salt/smart_proxies/salt_keys.rb +26 -29
  34. data/app/views/foreman_salt/api/v2/salt_autosign/base.json.rabl +3 -0
  35. data/app/views/foreman_salt/api/v2/salt_autosign/create.json.rabl +3 -0
  36. data/app/views/foreman_salt/api/v2/salt_autosign/index.json.rabl +3 -0
  37. data/app/views/foreman_salt/api/v2/salt_autosign/main.json.rabl +3 -0
  38. data/app/views/foreman_salt/api/v2/salt_environments/base.json.rabl +3 -0
  39. data/app/views/foreman_salt/api/v2/salt_environments/create.json.rabl +3 -0
  40. data/app/views/foreman_salt/api/v2/salt_environments/index.json.rabl +3 -0
  41. data/app/views/foreman_salt/api/v2/salt_environments/main.json.rabl +3 -0
  42. data/app/views/foreman_salt/api/v2/salt_environments/show.json.rabl +3 -0
  43. data/app/views/foreman_salt/api/v2/salt_keys/base.json.rabl +3 -0
  44. data/app/views/foreman_salt/api/v2/salt_keys/index.json.rabl +3 -0
  45. data/app/views/foreman_salt/api/v2/salt_keys/main.json.rabl +3 -0
  46. data/app/views/foreman_salt/api/v2/salt_keys/update.json.rabl +3 -0
  47. data/app/views/foreman_salt/api/v2/salt_minions/base.json.rabl +3 -0
  48. data/app/views/foreman_salt/api/v2/salt_minions/index.json.rabl +3 -0
  49. data/app/views/foreman_salt/api/v2/salt_minions/main.json.rabl +3 -0
  50. data/app/views/foreman_salt/api/v2/salt_minions/show.json.rabl +8 -0
  51. data/app/views/foreman_salt/api/v2/salt_states/base.json.rabl +3 -0
  52. data/app/views/foreman_salt/api/v2/salt_states/create.json.rabl +3 -0
  53. data/app/views/foreman_salt/api/v2/salt_states/index.json.rabl +3 -0
  54. data/app/views/foreman_salt/api/v2/salt_states/main.json.rabl +3 -0
  55. data/app/views/foreman_salt/api/v2/salt_states/show.json.rabl +3 -0
  56. data/config/routes.rb +25 -12
  57. data/db/migrate/20140813081913_add_salt_proxy_to_host_and_host_group.rb +0 -1
  58. data/db/migrate/20140817210214_create_salt_modules.rb +1 -1
  59. data/db/migrate/20150220122707_fix_incorrect_report_metrics.rb +22 -0
  60. data/lib/foreman_salt/engine.rb +114 -57
  61. data/lib/foreman_salt/version.rb +1 -1
  62. data/lib/tasks/foreman_salt_tasks.rake +2 -2
  63. data/test/functional/api/v2/salt_autosign_controller_test.rb +27 -0
  64. data/test/functional/api/v2/salt_environments_controller_test.rb +33 -0
  65. data/test/functional/api/v2/salt_keys_controller_test.rb +29 -0
  66. data/test/functional/api/v2/salt_states_controller_test.rb +33 -0
  67. data/test/functional/minions_controller_test.rb +18 -0
  68. data/test/integration/salt_environment_test.rb +0 -1
  69. data/test/integration/salt_keys_test.rb +4 -6
  70. data/test/integration/salt_module_test.rb +0 -1
  71. data/test/unit/grains_centos.json +4 -1
  72. data/test/unit/grains_importer_test.rb +39 -13
  73. data/test/unit/salt_keys_test.rb +4 -6
  74. metadata +44 -5
  75. data/app/controllers/foreman_salt/concerns/smart_proxy_auth_extensions.rb +0 -24
  76. data/test/functional/hosts_controller_test.rb +0 -16
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_salt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Benjamin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-14 00:00:00.000000000 Z
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -34,12 +34,18 @@ files:
34
34
  - LICENSE
35
35
  - README.md
36
36
  - Rakefile
37
+ - app/controllers/foreman_salt/api/v2/base_controller.rb
37
38
  - app/controllers/foreman_salt/api/v2/jobs_controller.rb
39
+ - app/controllers/foreman_salt/api/v2/salt_autosign_controller.rb
40
+ - app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
41
+ - app/controllers/foreman_salt/api/v2/salt_keys_controller.rb
42
+ - app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
43
+ - app/controllers/foreman_salt/api/v2/salt_states_controller.rb
38
44
  - app/controllers/foreman_salt/application_controller.rb
39
45
  - app/controllers/foreman_salt/concerns/hostgroups_controller_extensions.rb
40
46
  - app/controllers/foreman_salt/concerns/hosts_controller_extensions.rb
41
- - app/controllers/foreman_salt/concerns/smart_proxy_auth_extensions.rb
42
47
  - app/controllers/foreman_salt/concerns/unattended_controller_extensions.rb
48
+ - app/controllers/foreman_salt/minions_controller.rb
43
49
  - app/controllers/foreman_salt/salt_autosign_controller.rb
44
50
  - app/controllers/foreman_salt/salt_environments_controller.rb
45
51
  - app/controllers/foreman_salt/salt_keys_controller.rb
@@ -55,14 +61,38 @@ files:
55
61
  - app/models/foreman_salt/fact_name.rb
56
62
  - app/models/foreman_salt/salt_environment.rb
57
63
  - app/models/foreman_salt/salt_module.rb
64
+ - app/models/setting/salt.rb
58
65
  - app/overrides/foreman/salt_modules/_host_tab.html.erb
59
66
  - app/overrides/foreman/salt_modules/_host_tab_pane.html.erb
60
67
  - app/overrides/salt_environment_selector.rb
61
68
  - app/overrides/salt_modules_selector.rb
62
69
  - app/overrides/salt_proxy_selector.rb
63
70
  - app/services/foreman_salt/fact_importer.rb
71
+ - app/services/foreman_salt/fact_parser.rb
64
72
  - app/services/foreman_salt/report_importer.rb
65
73
  - app/services/foreman_salt/smart_proxies/salt_keys.rb
74
+ - app/views/foreman_salt/api/v2/salt_autosign/base.json.rabl
75
+ - app/views/foreman_salt/api/v2/salt_autosign/create.json.rabl
76
+ - app/views/foreman_salt/api/v2/salt_autosign/index.json.rabl
77
+ - app/views/foreman_salt/api/v2/salt_autosign/main.json.rabl
78
+ - app/views/foreman_salt/api/v2/salt_environments/base.json.rabl
79
+ - app/views/foreman_salt/api/v2/salt_environments/create.json.rabl
80
+ - app/views/foreman_salt/api/v2/salt_environments/index.json.rabl
81
+ - app/views/foreman_salt/api/v2/salt_environments/main.json.rabl
82
+ - app/views/foreman_salt/api/v2/salt_environments/show.json.rabl
83
+ - app/views/foreman_salt/api/v2/salt_keys/base.json.rabl
84
+ - app/views/foreman_salt/api/v2/salt_keys/index.json.rabl
85
+ - app/views/foreman_salt/api/v2/salt_keys/main.json.rabl
86
+ - app/views/foreman_salt/api/v2/salt_keys/update.json.rabl
87
+ - app/views/foreman_salt/api/v2/salt_minions/base.json.rabl
88
+ - app/views/foreman_salt/api/v2/salt_minions/index.json.rabl
89
+ - app/views/foreman_salt/api/v2/salt_minions/main.json.rabl
90
+ - app/views/foreman_salt/api/v2/salt_minions/show.json.rabl
91
+ - app/views/foreman_salt/api/v2/salt_states/base.json.rabl
92
+ - app/views/foreman_salt/api/v2/salt_states/create.json.rabl
93
+ - app/views/foreman_salt/api/v2/salt_states/index.json.rabl
94
+ - app/views/foreman_salt/api/v2/salt_states/main.json.rabl
95
+ - app/views/foreman_salt/api/v2/salt_states/show.json.rabl
66
96
  - app/views/foreman_salt/salt_autosign/_form.html.erb
67
97
  - app/views/foreman_salt/salt_autosign/index.html.erb
68
98
  - app/views/foreman_salt/salt_autosign/new.html.erb
@@ -80,13 +110,18 @@ files:
80
110
  - db/migrate/20140817210214_create_salt_modules.rb
81
111
  - db/migrate/20140829210214_add_salt_modules_to_hostgroups.rb
82
112
  - db/migrate/20140920232200_create_salt_environments.rb
113
+ - db/migrate/20150220122707_fix_incorrect_report_metrics.rb
83
114
  - db/seeds.d/75-salt-seeds.rb
84
115
  - lib/foreman_salt.rb
85
116
  - lib/foreman_salt/engine.rb
86
117
  - lib/foreman_salt/version.rb
87
118
  - lib/tasks/foreman_salt_tasks.rake
88
119
  - test/factories/foreman_salt_factories.rb
89
- - test/functional/hosts_controller_test.rb
120
+ - test/functional/api/v2/salt_autosign_controller_test.rb
121
+ - test/functional/api/v2/salt_environments_controller_test.rb
122
+ - test/functional/api/v2/salt_keys_controller_test.rb
123
+ - test/functional/api/v2/salt_states_controller_test.rb
124
+ - test/functional/minions_controller_test.rb
90
125
  - test/integration/salt_autosign_test.rb
91
126
  - test/integration/salt_environment_test.rb
92
127
  - test/integration/salt_keys_test.rb
@@ -139,4 +174,8 @@ test_files:
139
174
  - test/unit/report_importer_test.rb
140
175
  - test/test_plugin_helper.rb
141
176
  - test/factories/foreman_salt_factories.rb
142
- - test/functional/hosts_controller_test.rb
177
+ - test/functional/minions_controller_test.rb
178
+ - test/functional/api/v2/salt_environments_controller_test.rb
179
+ - test/functional/api/v2/salt_autosign_controller_test.rb
180
+ - test/functional/api/v2/salt_states_controller_test.rb
181
+ - test/functional/api/v2/salt_keys_controller_test.rb
@@ -1,24 +0,0 @@
1
- module ForemanSalt
2
- module Concerns
3
- module SmartProxyAuthExtensions
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- alias_method_chain :require_puppetmaster_or_login, :salt
8
- case self.controller_path
9
- when 'hosts'
10
- add_puppetmaster_filters [::HostsController::PUPPETMASTER_ACTIONS, :salt_external_node].flatten
11
- end
12
- end
13
-
14
- def require_puppetmaster_or_login_with_salt
15
- if auth_smart_proxy(::SmartProxy.with_features('Salt'), ::Setting[:require_ssl_puppetmasters])
16
- set_admin_user
17
- true
18
- else
19
- require_puppetmaster_or_login_without_salt
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,16 +0,0 @@
1
- require 'test_plugin_helper'
2
-
3
- class HostsControllerTest < ActionController::TestCase
4
- test 'salt smart proxy should get salt external node' do
5
- User.current = nil
6
- Setting[:restrict_registered_puppetmasters] = true
7
- Setting[:require_ssl_puppetmasters] = false
8
-
9
- proxy = FactoryGirl.create :smart_proxy, :with_salt_feature
10
- Resolv.any_instance.stubs(:getnames).returns([proxy.to_s])
11
-
12
- host = FactoryGirl.create :host
13
- get :salt_external_node, {:name => host.name, :format => 'yml'}
14
- assert_response :success
15
- end
16
- end