foreman_virt_who_configure 0.5.4 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_virt_who_configure/config_edit.js +20 -0
  3. data/app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb +9 -5
  4. data/app/helpers/foreman_virt_who_configure/configs_helper.rb +5 -9
  5. data/app/models/foreman_virt_who_configure/config.rb +30 -7
  6. data/app/models/foreman_virt_who_configure/output_generator.rb +28 -14
  7. data/app/views/foreman_virt_who_configure/api/v2/configs/main.json.rabl +11 -1
  8. data/app/views/foreman_virt_who_configure/configs/show.html.erb +5 -2
  9. data/app/views/foreman_virt_who_configure/configs/steps/_connection_form.erb +8 -2
  10. data/db/migrate/20201211160234_add_foreign_key_proxy_id.rb +5 -0
  11. data/db/migrate/20210413165147_delete_xen_profiles.rb +5 -0
  12. data/db/migrate/20210608100743_delete_rhevm_profiles.rb +5 -0
  13. data/db/migrate/20210910184516_add_ahv_to_config.rb +7 -0
  14. data/lib/foreman_virt_who_configure/version.rb +1 -1
  15. data/locale/action_names.rb +36 -26
  16. data/locale/ca/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  17. data/locale/ca/foreman_virt_who_configure.po +647 -0
  18. data/locale/cs_CZ/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  19. data/locale/cs_CZ/foreman_virt_who_configure.po +653 -0
  20. data/locale/de/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  21. data/locale/de/foreman_virt_who_configure.po +657 -0
  22. data/locale/en/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  23. data/locale/en/foreman_virt_who_configure.po +56 -47
  24. data/locale/en_GB/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  25. data/locale/en_GB/foreman_virt_who_configure.po +650 -0
  26. data/locale/es/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  27. data/locale/es/foreman_virt_who_configure.po +653 -0
  28. data/locale/foreman_virt_who_configure.pot +170 -165
  29. data/locale/fr/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  30. data/locale/fr/foreman_virt_who_configure.po +651 -0
  31. data/locale/gl/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  32. data/locale/gl/foreman_virt_who_configure.po +649 -0
  33. data/locale/it/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  34. data/locale/it/foreman_virt_who_configure.po +652 -0
  35. data/locale/ja/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  36. data/locale/ja/foreman_virt_who_configure.po +651 -0
  37. data/locale/ko/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  38. data/locale/ko/foreman_virt_who_configure.po +650 -0
  39. data/locale/nl_NL/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  40. data/locale/nl_NL/foreman_virt_who_configure.po +653 -0
  41. data/locale/pl/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  42. data/locale/pl/foreman_virt_who_configure.po +652 -0
  43. data/locale/pt_BR/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  44. data/locale/pt_BR/foreman_virt_who_configure.po +652 -0
  45. data/locale/ru/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  46. data/locale/ru/foreman_virt_who_configure.po +654 -0
  47. data/locale/sv_SE/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  48. data/locale/sv_SE/foreman_virt_who_configure.po +651 -0
  49. data/locale/zh_CN/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  50. data/locale/zh_CN/foreman_virt_who_configure.po +654 -0
  51. data/locale/zh_TW/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  52. data/locale/zh_TW/foreman_virt_who_configure.po +651 -0
  53. data/test/functional/api/v2/configs_controller_test.rb +43 -2
  54. data/test/unit/output_generator_test.rb +29 -5
  55. metadata +44 -6
@@ -17,7 +17,6 @@ class ForemanVirtWhoConfigure::Api::V2::ConfigsControllerTest < ActionController
17
17
  :http_proxy_id => @http_proxy.id,
18
18
  :no_proxy => nil
19
19
  )
20
-
21
20
  @out_of_date_config = FactoryBot.create(:virt_who_config, :out_of_date)
22
21
  @ok_config = FactoryBot.create(:virt_who_config, :ok)
23
22
  end
@@ -78,7 +77,8 @@ class ForemanVirtWhoConfigure::Api::V2::ConfigsControllerTest < ActionController
78
77
  assert_equal 'unknown', response['status']
79
78
  assert_nil response['last_report_at']
80
79
  assert_nil response['out_of_date_at']
81
- assert_equal @http_proxy.id, ForemanVirtWhoConfigure::Config.find(response['id']).http_proxy_id
80
+ assert_equal @http_proxy.id, response['http_proxy']['id']
81
+ assert_equal @http_proxy.url, response['proxy']
82
82
 
83
83
  assert_response :success
84
84
  end
@@ -127,6 +127,45 @@ class ForemanVirtWhoConfigure::Api::V2::ConfigsControllerTest < ActionController
127
127
  assert_equal @out_of_date_config.virt_who_config_script(:bash_script), response
128
128
  end
129
129
 
130
+ test 'should fail without kubeconfig_path in kubeconfig config' do
131
+ org = FactoryBot.create(:organization)
132
+ post :create, :params => { :foreman_virt_who_configure_config => { :name => 'my new config',
133
+ :filtering_mode => ForemanVirtWhoConfigure::Config::UNLIMITED,
134
+ :hypervisor_id => 'uuid',
135
+ :hypervisor_type => 'kubevirt',
136
+ :satellite_url => "foreman.example.com",
137
+ :organization_id => org.id }
138
+ }, :session => set_session_user
139
+
140
+ assert_response :unprocessable_entity
141
+
142
+ response = ActiveSupport::JSON.decode(@response.body)
143
+ assert_equal "Kubeconfig path can't be blank", response['error']['full_messages'].join('')
144
+ end
145
+
146
+ test 'should not accept kubeconfig for other hypervisor types' do
147
+ org = FactoryBot.create(:organization)
148
+ post :create, :params => { :foreman_virt_who_configure_config => { :name => 'my new config',
149
+ :interval => 240,
150
+ :filtering_mode => ForemanVirtWhoConfigure::Config::BLACKLIST,
151
+ :blacklist => ' a,b ',
152
+ :hypervisor_id => 'uuid',
153
+ :hypervisor_type => 'esx',
154
+ :hypervisor_server => "vmware.example.com",
155
+ :hypervisor_username => "root",
156
+ :hypervisor_password => "password",
157
+ :debug => true,
158
+ :satellite_url => "foreman.example.com",
159
+ :kubeconfig_path => '/tmp/food',
160
+ :organization_id => org.id }
161
+ }, :session => set_session_user
162
+
163
+ assert_response :unprocessable_entity
164
+
165
+ response = ActiveSupport::JSON.decode(@response.body)
166
+ assert_equal "Kubeconfig path Invalid option for hypervisor [esx]", response['error']['full_messages'].join('')
167
+ end
168
+
130
169
  test "should create the config" do
131
170
  org = FactoryBot.create(:organization)
132
171
  post :create, :params => { :foreman_virt_who_configure_config => { :name => 'my new config',
@@ -140,6 +179,7 @@ class ForemanVirtWhoConfigure::Api::V2::ConfigsControllerTest < ActionController
140
179
  :hypervisor_password => "password",
141
180
  :debug => true,
142
181
  :satellite_url => "foreman.example.com",
182
+ :http_proxy_id => @http_proxy.id,
143
183
  :organization_id => org.id }
144
184
  }, :session => set_session_user
145
185
 
@@ -158,6 +198,7 @@ class ForemanVirtWhoConfigure::Api::V2::ConfigsControllerTest < ActionController
158
198
  assert_equal 'password', new_config.hypervisor_password
159
199
  assert_equal true, new_config.debug
160
200
  assert_equal 'foreman.example.com', new_config.satellite_url
201
+ assert_equal @http_proxy.id, response['http_proxy']['id']
161
202
  end
162
203
 
163
204
  test "should update the config" do
@@ -60,7 +60,7 @@ module ForemanVirtWhoConfigure
60
60
  assert_nil config.http_proxy
61
61
  assert_nil config.no_proxy
62
62
  assert_not_includes output, 'http_proxy'
63
- assert_includes output, 'NO_PROXY=*'
63
+ assert_includes output, 'no_proxy=*'
64
64
  end
65
65
 
66
66
  test 'it configures proxy when set' do
@@ -71,7 +71,7 @@ module ForemanVirtWhoConfigure
71
71
 
72
72
  test 'it configures no_proxy when set' do
73
73
  config.no_proxy = '*'
74
- assert_includes output, 'NO_PROXY=*'
74
+ assert_includes output, 'no_proxy=*'
75
75
  end
76
76
 
77
77
  test 'proxy_strings prints both proxy and no proxy if present' do
@@ -79,19 +79,19 @@ module ForemanVirtWhoConfigure
79
79
  config.http_proxy = http_proxy
80
80
  config.no_proxy = 'b'
81
81
  assert_includes generator.proxy_strings, "\nhttp_proxy=http://test.com"
82
- assert_includes generator.proxy_strings, "\NO_PROXY=b"
82
+ assert_includes generator.proxy_strings, "\nno_proxy=b"
83
83
  end
84
84
 
85
85
  test 'proxy_strings ignores empty string values' do
86
86
  config.http_proxy = nil
87
87
  config.no_proxy = ''
88
88
  assert_not_includes generator.proxy_strings, 'http_proxy'
89
- assert_includes generator.proxy_strings, 'NO_PROXY=*'
89
+ assert_includes generator.proxy_strings, 'no_proxy=*'
90
90
  end
91
91
 
92
92
  test 'proxy_strings removes any new line chars' do
93
93
  config.no_proxy = "\nx\ny\nz"
94
- assert_includes generator.proxy_strings, "\NO_PROXY=xyz"
94
+ assert_includes generator.proxy_strings, "\nno_proxy=xyz"
95
95
  end
96
96
 
97
97
  test 'it configures https proxy when https proxy is set' do
@@ -128,5 +128,29 @@ module ForemanVirtWhoConfigure
128
128
  assert_includes bash_script_output, 'step 1 "Installing virt-who"'
129
129
  end
130
130
  end
131
+
132
+ describe 'nutanix ahv' do
133
+ test 'options specific to ahv are all set' do
134
+ config.hypervisor_type = 'ahv'
135
+ config.prism_flavor = 'central'
136
+ config.ahv_update_interval = 100
137
+ config.ahv_internal_debug = true
138
+
139
+ assert_includes output, 'type=ahv'
140
+ assert_includes output, 'prism_central=true'
141
+ assert_includes output, 'update_interval=100'
142
+ assert_includes output, 'internal_debug=true'
143
+ end
144
+
145
+ test 'options specific to ahv are not all set' do
146
+ config.hypervisor_type = 'ahv'
147
+ config.prism_flavor = 'central'
148
+
149
+ assert_includes output, 'type=ahv'
150
+ assert_includes output, 'prism_central=true'
151
+ assert_not_includes output, 'update_interval='
152
+ assert_not_includes output, 'update_interval='
153
+ end
154
+ end
131
155
  end
132
156
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_virt_who_configure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman virt-who-configure team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-30 00:00:00.000000000 Z
11
+ date: 2021-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello
@@ -108,16 +108,54 @@ files:
108
108
  - db/migrate/20181005065724_filter_and_exclude_host_parents.foreman_virt_who_configure.rb
109
109
  - db/migrate/20190104125749_add_kubeconfig_to_config.rb
110
110
  - db/migrate/20200728054557_refer_config_proxy_to_http_proxy.rb
111
+ - db/migrate/20201211160234_add_foreign_key_proxy_id.rb
112
+ - db/migrate/20210413165147_delete_xen_profiles.rb
113
+ - db/migrate/20210608100743_delete_rhevm_profiles.rb
114
+ - db/migrate/20210910184516_add_ahv_to_config.rb
111
115
  - lib/foreman_virt_who_configure.rb
112
116
  - lib/foreman_virt_who_configure/engine.rb
113
117
  - lib/foreman_virt_who_configure/version.rb
114
118
  - lib/tasks/foreman_virt_who_configure_tasks.rake
115
119
  - locale/Makefile
116
120
  - locale/action_names.rb
121
+ - locale/ca/LC_MESSAGES/foreman_virt_who_configure.mo
122
+ - locale/ca/foreman_virt_who_configure.po
123
+ - locale/cs_CZ/LC_MESSAGES/foreman_virt_who_configure.mo
124
+ - locale/cs_CZ/foreman_virt_who_configure.po
125
+ - locale/de/LC_MESSAGES/foreman_virt_who_configure.mo
126
+ - locale/de/foreman_virt_who_configure.po
117
127
  - locale/en/LC_MESSAGES/foreman_virt_who_configure.mo
118
128
  - locale/en/foreman_virt_who_configure.po
129
+ - locale/en_GB/LC_MESSAGES/foreman_virt_who_configure.mo
130
+ - locale/en_GB/foreman_virt_who_configure.po
131
+ - locale/es/LC_MESSAGES/foreman_virt_who_configure.mo
132
+ - locale/es/foreman_virt_who_configure.po
119
133
  - locale/foreman_virt_who_configure.pot
134
+ - locale/fr/LC_MESSAGES/foreman_virt_who_configure.mo
135
+ - locale/fr/foreman_virt_who_configure.po
120
136
  - locale/gemspec.rb
137
+ - locale/gl/LC_MESSAGES/foreman_virt_who_configure.mo
138
+ - locale/gl/foreman_virt_who_configure.po
139
+ - locale/it/LC_MESSAGES/foreman_virt_who_configure.mo
140
+ - locale/it/foreman_virt_who_configure.po
141
+ - locale/ja/LC_MESSAGES/foreman_virt_who_configure.mo
142
+ - locale/ja/foreman_virt_who_configure.po
143
+ - locale/ko/LC_MESSAGES/foreman_virt_who_configure.mo
144
+ - locale/ko/foreman_virt_who_configure.po
145
+ - locale/nl_NL/LC_MESSAGES/foreman_virt_who_configure.mo
146
+ - locale/nl_NL/foreman_virt_who_configure.po
147
+ - locale/pl/LC_MESSAGES/foreman_virt_who_configure.mo
148
+ - locale/pl/foreman_virt_who_configure.po
149
+ - locale/pt_BR/LC_MESSAGES/foreman_virt_who_configure.mo
150
+ - locale/pt_BR/foreman_virt_who_configure.po
151
+ - locale/ru/LC_MESSAGES/foreman_virt_who_configure.mo
152
+ - locale/ru/foreman_virt_who_configure.po
153
+ - locale/sv_SE/LC_MESSAGES/foreman_virt_who_configure.mo
154
+ - locale/sv_SE/foreman_virt_who_configure.po
155
+ - locale/zh_CN/LC_MESSAGES/foreman_virt_who_configure.mo
156
+ - locale/zh_CN/foreman_virt_who_configure.po
157
+ - locale/zh_TW/LC_MESSAGES/foreman_virt_who_configure.mo
158
+ - locale/zh_TW/foreman_virt_who_configure.po
121
159
  - test/factories/foreman_virt_who_configure_factories.rb
122
160
  - test/functional/api/v2/configs_controller_test.rb
123
161
  - test/test_plugin_helper.rb
@@ -128,7 +166,7 @@ homepage: https://github.com/theforeman/foreman_virt_who_configure
128
166
  licenses:
129
167
  - GPLv3
130
168
  metadata: {}
131
- post_install_message:
169
+ post_install_message:
132
170
  rdoc_options: []
133
171
  require_paths:
134
172
  - lib
@@ -143,8 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
181
  - !ruby/object:Gem::Version
144
182
  version: '0'
145
183
  requirements: []
146
- rubygems_version: 3.1.4
147
- signing_key:
184
+ rubygems_version: 3.1.6
185
+ signing_key:
148
186
  specification_version: 4
149
187
  summary: A plugin to make virt-who configuration easy
150
188
  test_files: