foreman_discovery 3.0.0 → 4.0.0

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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/controllers/api/v2/discovered_hosts_controller.rb +31 -11
  4. data/app/controllers/api/v2/discovery_rules_controller.rb +8 -16
  5. data/app/controllers/concerns/foreman/controller/discovered_extensions.rb +47 -2
  6. data/app/controllers/discovered_hosts_controller.rb +30 -55
  7. data/app/controllers/discovery_rules_controller.rb +2 -4
  8. data/app/helpers/discovered_hosts_helper.rb +27 -5
  9. data/app/lib/facter_utils.rb +18 -0
  10. data/app/lib/puppet_fact_parser_extensions.rb +18 -32
  11. data/app/models/discovery_rule.rb +33 -2
  12. data/app/models/host/discovered.rb +47 -61
  13. data/app/models/host/managed_extensions.rb +12 -3
  14. data/app/models/setting/discovered.rb +18 -6
  15. data/app/services/foreman_discovery/host_converter.rb +22 -0
  16. data/app/views/api/v2/discovered_hosts/main.json.rabl +1 -1
  17. data/app/views/api/v2/discovery_rules/main.json.rabl +6 -1
  18. data/app/views/api/v2/discovery_rules/show.json.rabl +4 -0
  19. data/app/views/dashboard/_discovery_widget.html.erb +6 -4
  20. data/app/views/dashboard/_discovery_widget_host.html.erb +4 -0
  21. data/app/views/dashboard/_discovery_widget_host_list.html.erb +2 -3
  22. data/app/views/discovered_hosts/_discovered_host.html.erb +3 -5
  23. data/app/views/discovered_hosts/_discovered_hosts_list.html.erb +7 -7
  24. data/app/views/discovered_hosts/index.html.erb +1 -0
  25. data/app/views/discovery_rules/_form.html.erb +51 -32
  26. data/config/routes.rb +4 -4
  27. data/db/migrate/20150310153859_remove_discovery_attribute_sets_from_managed_hosts.rb +8 -0
  28. data/db/migrate/20150331132115_remove_old_permissions.rb +16 -0
  29. data/db/migrate/20150505111345_remove_leftover_tokens.rb +13 -0
  30. data/db/migrate/20150512150432_remove_old_discovery_reader_permissions.rb +10 -0
  31. data/db/migrate/20150714144500_review_discovery_permissions.rb +17 -0
  32. data/lib/foreman_discovery/engine.rb +46 -16
  33. data/lib/foreman_discovery/version.rb +1 -1
  34. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  35. data/locale/de/foreman_discovery.po +74 -72
  36. data/locale/de/foreman_discovery.pox +40 -0
  37. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  38. data/locale/en_GB/foreman_discovery.po +90 -88
  39. data/locale/en_GB/foreman_discovery.pox +0 -0
  40. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  41. data/locale/es/foreman_discovery.po +3 -3
  42. data/locale/es/foreman_discovery.pox +41 -0
  43. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  44. data/locale/fr/foreman_discovery.po +3 -3
  45. data/locale/fr/foreman_discovery.pox +69 -0
  46. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  47. data/locale/gl/foreman_discovery.po +3 -3
  48. data/locale/gl/foreman_discovery.pox +21 -0
  49. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  50. data/locale/it/foreman_discovery.po +3 -3
  51. data/locale/it/foreman_discovery.pox +0 -0
  52. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  53. data/locale/ja/foreman_discovery.po +67 -66
  54. data/locale/ja/foreman_discovery.pox +29 -0
  55. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  56. data/locale/ko/foreman_discovery.po +3 -3
  57. data/locale/ko/foreman_discovery.pox +189 -0
  58. data/locale/messages.mo +0 -0
  59. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  60. data/locale/pt_BR/foreman_discovery.po +7 -7
  61. data/locale/pt_BR/foreman_discovery.pox +0 -0
  62. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  63. data/locale/ru/foreman_discovery.po +98 -96
  64. data/locale/ru/foreman_discovery.pox +0 -0
  65. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  66. data/locale/sv_SE/foreman_discovery.po +3 -3
  67. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  68. data/locale/zh_CN/foreman_discovery.po +3 -3
  69. data/locale/zh_CN/foreman_discovery.pox +33 -0
  70. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  71. data/locale/zh_TW/foreman_discovery.po +3 -3
  72. data/locale/zh_TW/foreman_discovery.pox +23 -0
  73. data/test/functional/api/v2/discovered_hosts_controller_test.rb +45 -7
  74. data/test/functional/discovered_hosts_controller_test.rb +52 -11
  75. data/test/unit/discovered_extensions_test.rb +40 -17
  76. data/test/unit/discovery_rule_test.rb +59 -0
  77. data/test/unit/host_discovered_test.rb +69 -6
  78. data/test/unit/puppet_fact_parser_extensions_test.rb +55 -40
  79. metadata +103 -81
  80. data/app/services/host_converter.rb +0 -30
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_discovery
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Sutcliffe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-10 00:00:00.000000000 Z
11
+ date: 2015-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
17
+ - - <
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "<"
24
+ - - <
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.0'
27
27
  description: 'MaaS Discovery Plugin engine for Foreman '
28
28
  email: gsutclif@redhat.com
29
29
  executables: []
@@ -32,114 +32,135 @@ extra_rdoc_files:
32
32
  - LICENSE
33
33
  - README.md
34
34
  files:
35
- - LICENSE
36
- - README.md
37
- - app/controllers/api/v2/discovered_hosts_controller.rb
38
- - app/controllers/api/v2/discovery_rules_controller.rb
39
- - app/controllers/concerns/foreman/controller/discovered_extensions.rb
40
- - app/controllers/discovered_hosts_controller.rb
41
35
  - app/controllers/discovery_rules_controller.rb
42
- - app/helpers/discovered_hosts_helper.rb
43
- - app/helpers/discovery_rules_helper.rb
36
+ - app/controllers/discovered_hosts_controller.rb
37
+ - app/controllers/concerns/foreman/controller/discovered_extensions.rb
38
+ - app/controllers/api/v2/discovery_rules_controller.rb
39
+ - app/controllers/api/v2/discovered_hosts_controller.rb
44
40
  - app/lib/puppet_fact_parser_extensions.rb
45
- - app/models/concerns/discovery_subnet.rb
46
- - app/models/discovery_attribute_set.rb
47
- - app/models/discovery_rule.rb
41
+ - app/lib/facter_utils.rb
42
+ - app/services/foreman_discovery/host_converter.rb
43
+ - app/helpers/discovery_rules_helper.rb
44
+ - app/helpers/discovered_hosts_helper.rb
45
+ - app/overrides/subnet_form_with_discovery_proxy.rb
46
+ - app/models/setting/discovered.rb
47
+ - app/models/hostgroup_extensions.rb
48
48
  - app/models/host/discovered.rb
49
49
  - app/models/host/managed_extensions.rb
50
- - app/models/hostgroup_extensions.rb
51
- - app/models/setting/discovered.rb
52
- - app/overrides/subnet_form_with_discovery_proxy.rb
53
- - app/services/host_converter.rb
54
- - app/views/api/v2/discovered_hosts/auto_provision.json.rabl
55
- - app/views/api/v2/discovered_hosts/auto_provision_all.json.rabl
56
- - app/views/api/v2/discovered_hosts/base.json.rabl
57
- - app/views/api/v2/discovered_hosts/index.json.rabl
58
- - app/views/api/v2/discovered_hosts/main.json.rabl
59
- - app/views/api/v2/discovered_hosts/show.json.rabl
60
- - app/views/api/v2/discovered_hosts/update.json.rabl
61
- - app/views/api/v2/discovery_rules/base.json.rabl
62
- - app/views/api/v2/discovery_rules/index.json.rabl
63
- - app/views/api/v2/discovery_rules/main.json.rabl
64
- - app/views/api/v2/discovery_rules/show.json.rabl
65
- - app/views/dashboard/_discovery_widget.html.erb
50
+ - app/models/discovery_rule.rb
51
+ - app/models/concerns/discovery_subnet.rb
52
+ - app/models/discovery_attribute_set.rb
66
53
  - app/views/dashboard/_discovery_widget_host_list.html.erb
54
+ - app/views/dashboard/_discovery_widget.html.erb
55
+ - app/views/dashboard/_discovery_widget_host.html.erb
56
+ - app/views/discovery_rules/new.html.erb
57
+ - app/views/discovery_rules/edit.html.erb
58
+ - app/views/discovery_rules/index.html.erb
59
+ - app/views/discovery_rules/_form.html.erb
67
60
  - app/views/discovered_hosts/_discovered_host.html.erb
68
- - app/views/discovered_hosts/_discovered_hosts_list.html.erb
69
61
  - app/views/discovered_hosts/_selected_hosts.html.erb
70
- - app/views/discovered_hosts/index.html.erb
71
62
  - app/views/discovered_hosts/multiple_destroy.html.erb
72
- - app/views/discovered_hosts/select_multiple_location.html.erb
63
+ - app/views/discovered_hosts/index.html.erb
73
64
  - app/views/discovered_hosts/select_multiple_organization.html.erb
65
+ - app/views/discovered_hosts/_discovered_hosts_list.html.erb
74
66
  - app/views/discovered_hosts/show.html.erb
75
- - app/views/discovery_rules/_form.html.erb
76
- - app/views/discovery_rules/edit.html.erb
77
- - app/views/discovery_rules/index.html.erb
78
- - app/views/discovery_rules/new.html.erb
79
- - config/initializers/discovery_setup.rb
67
+ - app/views/discovered_hosts/select_multiple_location.html.erb
68
+ - app/views/api/v2/discovery_rules/index.json.rabl
69
+ - app/views/api/v2/discovery_rules/base.json.rabl
70
+ - app/views/api/v2/discovery_rules/main.json.rabl
71
+ - app/views/api/v2/discovery_rules/show.json.rabl
72
+ - app/views/api/v2/discovered_hosts/index.json.rabl
73
+ - app/views/api/v2/discovered_hosts/update.json.rabl
74
+ - app/views/api/v2/discovered_hosts/auto_provision_all.json.rabl
75
+ - app/views/api/v2/discovered_hosts/base.json.rabl
76
+ - app/views/api/v2/discovered_hosts/main.json.rabl
77
+ - app/views/api/v2/discovered_hosts/auto_provision.json.rabl
78
+ - app/views/api/v2/discovered_hosts/show.json.rabl
79
+ - extra/build_iso.sh
80
+ - extra/wait_for_network.sh
81
+ - extra/disk_facts.rb
82
+ - extra/discover_host
83
+ - extra/foreman_startup.rb
84
+ - extra/discovery_init.sh.example
85
+ - extra/ovirt-node-build/build_image.sh
86
+ - extra/ovirt-node-build/Vagrantfile
80
87
  - config/routes.rb
88
+ - config/initializers/discovery_setup.rb
89
+ - db/migrate/20150310153859_remove_discovery_attribute_sets_from_managed_hosts.rb
81
90
  - db/migrate/20141107091416_create_discovery_rules.rb
91
+ - db/migrate/20150505111345_remove_leftover_tokens.rb
82
92
  - db/migrate/20141107091417_add_discovery_rule_to_host.rb
93
+ - db/migrate/20150302112545_remove_duplicate_tokens_from_hosts.rb
94
+ - db/migrate/20150331132115_remove_old_permissions.rb
83
95
  - db/migrate/20141126165451_add_discovery_id_to_subnet.rb
84
96
  - db/migrate/20141223101707_create_discovery_attribute_sets.rb
85
97
  - db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb
86
- - db/migrate/20150302112545_remove_duplicate_tokens_from_hosts.rb
98
+ - db/migrate/20150512150432_remove_old_discovery_reader_permissions.rb
99
+ - db/migrate/20150714144500_review_discovery_permissions.rb
87
100
  - db/seeds.d/60_discovery_proxy_feature.rb
88
- - extra/build_iso.sh
89
- - extra/discover_host
90
- - extra/discovery_init.sh.example
91
- - extra/disk_facts.rb
92
- - extra/foreman_startup.rb
93
- - extra/ovirt-node-build/Vagrantfile
94
- - extra/ovirt-node-build/build_image.sh
95
- - extra/wait_for_network.sh
96
101
  - lib/discovery.rake
97
102
  - lib/foreman_discovery.rb
98
- - lib/foreman_discovery/engine.rb
99
103
  - lib/foreman_discovery/proxy_operations.rb
100
104
  - lib/foreman_discovery/version.rb
105
+ - lib/foreman_discovery/engine.rb
106
+ - locale/foreman_discovery.pot
101
107
  - locale/Makefile
102
- - locale/de/LC_MESSAGES/foreman_discovery.mo
108
+ - locale/ru/foreman_discovery.po
109
+ - locale/ru/foreman_discovery.pox
110
+ - locale/ru/LC_MESSAGES/foreman_discovery.mo
103
111
  - locale/de/foreman_discovery.po
104
- - locale/en_GB/LC_MESSAGES/foreman_discovery.mo
112
+ - locale/de/foreman_discovery.pox
113
+ - locale/de/LC_MESSAGES/foreman_discovery.mo
114
+ - locale/pt_BR/foreman_discovery.po
115
+ - locale/pt_BR/foreman_discovery.pox
116
+ - locale/pt_BR/LC_MESSAGES/foreman_discovery.mo
105
117
  - locale/en_GB/foreman_discovery.po
106
- - locale/es/LC_MESSAGES/foreman_discovery.mo
118
+ - locale/en_GB/foreman_discovery.pox
119
+ - locale/en_GB/LC_MESSAGES/foreman_discovery.mo
120
+ - locale/zh_TW/foreman_discovery.po
121
+ - locale/zh_TW/foreman_discovery.pox
122
+ - locale/zh_TW/LC_MESSAGES/foreman_discovery.mo
107
123
  - locale/es/foreman_discovery.po
108
- - locale/foreman_discovery.pot
109
- - locale/fr/LC_MESSAGES/foreman_discovery.mo
124
+ - locale/es/foreman_discovery.pox
125
+ - locale/es/LC_MESSAGES/foreman_discovery.mo
110
126
  - locale/fr/foreman_discovery.po
111
- - locale/gl/LC_MESSAGES/foreman_discovery.mo
112
- - locale/gl/foreman_discovery.po
113
- - locale/it/LC_MESSAGES/foreman_discovery.mo
127
+ - locale/fr/foreman_discovery.pox
128
+ - locale/fr/LC_MESSAGES/foreman_discovery.mo
114
129
  - locale/it/foreman_discovery.po
115
- - locale/ja/LC_MESSAGES/foreman_discovery.mo
130
+ - locale/it/foreman_discovery.pox
131
+ - locale/it/LC_MESSAGES/foreman_discovery.mo
132
+ - locale/messages.mo
116
133
  - locale/ja/foreman_discovery.po
117
- - locale/ko/LC_MESSAGES/foreman_discovery.mo
134
+ - locale/ja/foreman_discovery.pox
135
+ - locale/ja/LC_MESSAGES/foreman_discovery.mo
118
136
  - locale/ko/foreman_discovery.po
119
- - locale/pt_BR/LC_MESSAGES/foreman_discovery.mo
120
- - locale/pt_BR/foreman_discovery.po
121
- - locale/ru/LC_MESSAGES/foreman_discovery.mo
122
- - locale/ru/foreman_discovery.po
123
- - locale/sv_SE/LC_MESSAGES/foreman_discovery.mo
124
- - locale/sv_SE/foreman_discovery.po
125
- - locale/zanata.xml
126
- - locale/zh_CN/LC_MESSAGES/foreman_discovery.mo
137
+ - locale/ko/foreman_discovery.pox
138
+ - locale/ko/LC_MESSAGES/foreman_discovery.mo
127
139
  - locale/zh_CN/foreman_discovery.po
128
- - locale/zh_TW/LC_MESSAGES/foreman_discovery.mo
129
- - locale/zh_TW/foreman_discovery.po
130
- - test/factories/discovery_rule_related.rb
131
- - test/functional/api/v2/discovered_hosts_controller_test.rb
140
+ - locale/zh_CN/foreman_discovery.pox
141
+ - locale/zh_CN/LC_MESSAGES/foreman_discovery.mo
142
+ - locale/zanata.xml
143
+ - locale/gl/foreman_discovery.po
144
+ - locale/gl/foreman_discovery.pox
145
+ - locale/gl/LC_MESSAGES/foreman_discovery.mo
146
+ - locale/sv_SE/foreman_discovery.po
147
+ - locale/sv_SE/LC_MESSAGES/foreman_discovery.mo
148
+ - LICENSE
149
+ - README.md
150
+ - test/functional/discovery_rules_controller_test.rb
132
151
  - test/functional/api/v2/discovery_rules_controller_test.rb
152
+ - test/functional/api/v2/discovered_hosts_controller_test.rb
133
153
  - test/functional/discovered_hosts_controller_test.rb
134
- - test/functional/discovery_rules_controller_test.rb
135
- - test/test_helper.rb
136
- - test/test_plugin_helper.rb
154
+ - test/factories/discovery_rule_related.rb
137
155
  - test/unit/discovered_extensions_test.rb
138
156
  - test/unit/discovery_attribute_set_test.rb
157
+ - test/unit/setting_discovered_test.rb
139
158
  - test/unit/facts.json
140
- - test/unit/host_discovered_test.rb
141
159
  - test/unit/puppet_fact_parser_extensions_test.rb
142
- - test/unit/setting_discovered_test.rb
160
+ - test/unit/discovery_rule_test.rb
161
+ - test/unit/host_discovered_test.rb
162
+ - test/test_plugin_helper.rb
163
+ - test/test_helper.rb
143
164
  homepage: http://github.com/theforeman/foreman_discovery
144
165
  licenses:
145
166
  - GPL-3
@@ -150,17 +171,17 @@ require_paths:
150
171
  - lib
151
172
  required_ruby_version: !ruby/object:Gem::Requirement
152
173
  requirements:
153
- - - ">="
174
+ - - '>='
154
175
  - !ruby/object:Gem::Version
155
176
  version: '0'
156
177
  required_rubygems_version: !ruby/object:Gem::Requirement
157
178
  requirements:
158
- - - ">="
179
+ - - '>='
159
180
  - !ruby/object:Gem::Version
160
181
  version: '0'
161
182
  requirements: []
162
183
  rubyforge_project:
163
- rubygems_version: 2.2.0
184
+ rubygems_version: 2.0.14
164
185
  signing_key:
165
186
  specification_version: 4
166
187
  summary: MaaS Discovery Plugin for Foreman
@@ -175,6 +196,7 @@ test_files:
175
196
  - test/unit/setting_discovered_test.rb
176
197
  - test/unit/facts.json
177
198
  - test/unit/puppet_fact_parser_extensions_test.rb
199
+ - test/unit/discovery_rule_test.rb
178
200
  - test/unit/host_discovered_test.rb
179
201
  - test/test_plugin_helper.rb
180
202
  - test/test_helper.rb
@@ -1,30 +0,0 @@
1
- class ForemanDiscovery::HostConverter
2
-
3
- # must be called from SQL transaction
4
- def self.to_managed(original_host, set_managed = true, set_build = true)
5
- if ActiveRecord::Base.connection.open_transactions <= 0
6
- raise "This method must be executed with explicit transaction"
7
- end
8
- host = original_host.becomes(::Host::Managed)
9
- host.type = 'Host::Managed'
10
- # the following flags can be skipped when parameters are set to false
11
- if set_managed
12
- host.managed = set_managed
13
- host.primary_interface.managed = set_managed
14
- end
15
- host.build = set_build if set_build
16
- # this gets rolled back when anything in the transaction fails
17
- delete_discovery_attribute_set(host.id)
18
- host
19
- end
20
-
21
- private
22
-
23
- # discovery_attribute_set should be deleted only after a host has been successfully provisioned
24
- # (after discovered host becomes managed host)
25
- # after this happens the host is a manged host so non of the callbacks in discovered hosts are relevant anymore
26
- # for this reason the orphaned discovery_attribute_set needs to be searched for and deleted
27
- def self.delete_discovery_attribute_set(host_id)
28
- DiscoveryAttributeSet.destroy_all(:host_id => host_id)
29
- end
30
- end