Removed the use of non-standard ohai plugin
We now have a helper method `#address_for` to return the IP of a given interface. Switched out the ohai use in favor of `#address_for`. Change-Id: I773b20d2e663c1d04c49bfbd79c750da78da2ed1
This commit is contained in:
@@ -126,7 +126,7 @@ end
|
||||
if node["openstack"]["image"]["api"]["bind_interface"].nil?
|
||||
bind_address = api_endpoint.host
|
||||
else
|
||||
bind_address = node["network"]["ipaddress_#{node["openstack"]["image"]["api"]["bind_interface"]}"]
|
||||
bind_address = address_for node["openstack"]["image"]["api"]["bind_interface"]
|
||||
end
|
||||
|
||||
template "/etc/glance/glance-api.conf" do
|
||||
|
||||
@@ -90,7 +90,7 @@ end
|
||||
if node["openstack"]["image"]["registry"]["bind_interface"].nil?
|
||||
bind_address = registry_endpoint.host
|
||||
else
|
||||
bind_address = node["network"]["ipaddress_#{node["openstack"]["image"]["registry"]["bind_interface"]}"]
|
||||
bind_address = address_for node["openstack"]["image"]["registry"]["bind_interface"]
|
||||
end
|
||||
|
||||
template "/etc/glance/glance-registry.conf" do
|
||||
|
||||
@@ -6,6 +6,7 @@ describe "openstack-image::api" do
|
||||
before do
|
||||
@chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n|
|
||||
n.set["openstack"]["image"]["syslog"]["use"] = true
|
||||
n.set["cpu"] = { 'total' => '1' }
|
||||
end
|
||||
@chef_run.converge "openstack-image::api"
|
||||
end
|
||||
@@ -64,8 +65,20 @@ describe "openstack-image::api" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "644"
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
it "has bind host when bind_interface not specified" do
|
||||
expect(@chef_run).to create_file_with_content @file.name,
|
||||
"bind_host = 127.0.0.1"
|
||||
end
|
||||
|
||||
it "has bind host when bind_interface specified" do
|
||||
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n|
|
||||
n.set["openstack"]["image"]["api"]["bind_interface"] = "lo"
|
||||
n.set["cpu"] = { 'total' => '1' }
|
||||
end
|
||||
chef_run.converge "openstack-image::api"
|
||||
|
||||
expect(chef_run).to create_file_with_content @file.name,
|
||||
"bind_host = 127.0.1.1"
|
||||
end
|
||||
|
||||
it "notifies image-api restart" do
|
||||
|
||||
@@ -76,8 +76,19 @@ describe "openstack-image::registry" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "644"
|
||||
end
|
||||
|
||||
it "template contents" do
|
||||
pending "TODO: implement"
|
||||
it "has bind host when bind_interface not specified" do
|
||||
expect(@chef_run).to create_file_with_content @file.name,
|
||||
"bind_host = 127.0.0.1"
|
||||
end
|
||||
|
||||
it "has bind host when bind_interface specified" do
|
||||
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS do |n|
|
||||
n.set["openstack"]["image"]["registry"]["bind_interface"] = "lo"
|
||||
end
|
||||
chef_run.converge "openstack-image::registry"
|
||||
|
||||
expect(chef_run).to create_file_with_content @file.name,
|
||||
"bind_host = 127.0.1.1"
|
||||
end
|
||||
|
||||
it "notifies image-registry restart" do
|
||||
|
||||
@@ -13,6 +13,9 @@ require "chefspec"
|
||||
}
|
||||
|
||||
def image_stubs
|
||||
::Chef::Recipe.any_instance.stub(:address_for).
|
||||
with("lo").
|
||||
and_return "127.0.1.1"
|
||||
::Chef::Recipe.any_instance.stub(:config_by_role).
|
||||
with("rabbitmq-server", "queue").and_return(
|
||||
{'host' => 'rabbit-host', 'port' => 'rabbit-port'}
|
||||
|
||||
Reference in New Issue
Block a user