Ansible Groups: Accept single item as String

Syntax errors in `ansible.groups` definition are not well handled:
Error returned: undefined method `each' for "machine1":String (NoMethodError)

Being tolerant here doesn't hurt and may avoid people get
confused/annoyed.
This commit is contained in:
Gilles Cornu 2014-02-02 23:14:07 +01:00
parent 84308964e2
commit f564bf7410
1 changed files with 4 additions and 0 deletions

View File

@ -104,6 +104,10 @@ module VagrantPlugins
included_groups = []
config.groups.each_pair do |gname, gmembers|
# Require that gmembers be an array
# (easier to be tolerant and avoid error management of few value)
gmembers = [gmembers] if !gmembers.is_a?(Array)
if gname.end_with?(":children")
groups_of_groups[gname] = gmembers
else