Skip to content

Commit 4fa2969

Browse files
committed
Add a setting to allow ESXi hosts to be added
Allow adding an ESXi host directly for development testing if a vCenter isn't available.
1 parent 1a0cfb0 commit 4fa2969

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

app/models/manageiq/providers/vmware/infra_manager/vim_connect_mixin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def raw_connect(options)
7979
}
8080
)
8181

82-
raise MiqException::Error, _("Adding ESX/ESXi Hosts is not supported") unless vim.isVirtualCenter
82+
raise MiqException::Error, _("Adding ESX/ESXi Hosts is not supported") if !vim.isVirtualCenter && !Settings.prototype.ems_vmware.allow_direct_hosts
8383
raise MiqException::Error, _("vCenter version %{version} is unsupported") % {:version => vim.apiVersion} if !version_supported?(vim.apiVersion)
8484

8585
# If the time on the vCenter is very far off from MIQ system time then

config/settings.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,6 @@
6060
:ems_refresh_worker_vmware_cloud: {}
6161
:ems_refresh_worker_vmware_cloud_network: {}
6262
:ems_refresh_worker_vmware_tanzu: {}
63+
:prototype:
64+
:ems_vmware:
65+
:allow_direct_hosts: false

spec/models/manageiq/providers/vmware/infra_manager_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@
7171
expect { described_class.verify_credentials(verify_params) }
7272
.to raise_error(MiqException::Error, "Adding ESX/ESXi Hosts is not supported")
7373
end
74+
75+
context "with allow_direct_hosts setting set to true" do
76+
before { stub_settings_merge(:prototype => {:ems_vmware => {:allow_direct_hosts => true}}) }
77+
78+
it "is successful" do
79+
expect(described_class.verify_credentials(verify_params)).to be_truthy
80+
end
81+
end
7482
end
7583

7684
context "vCenter currentTime out of sync" do

0 commit comments

Comments
 (0)