Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/server_settings/host_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ class HostCollection < Array
attr_reader :properties
def initialize(hosts, properties)
@properties = properties
return if hosts.nil?

unless hosts.kind_of?(Array)
raise InvalidHosts, "hosts: #{hosts} is not array"
end
Expand Down
5 changes: 5 additions & 0 deletions spec/lib/servers_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
role2:
hosts:
- 3.3.3.3

role3:
hosts:

EOF
}

Expand Down Expand Up @@ -127,6 +131,7 @@
it 'can iterate each server' do
ServerSettings.load_from_yaml(config1)
expect { |b| ServerSettings.each_role(&b) }.to yield_successive_args([String, Array],
[String, Array],
[String, Array])
end
end
Expand Down