Moving ConnectionInformation -> PlayContext

Also making PlayContext a child class of the Playbook Base class,
which gives it access to all of the FieldAttribute code to ensure
field values are correctly typed after post_validation

Fixes #11381
This commit is contained in:
James Cammarata 2015-07-21 12:12:22 -04:00
commit e64989beb4
36 changed files with 477 additions and 459 deletions

View file

@ -295,6 +295,11 @@ class Base:
for item in value:
if not isinstance(item, attribute.listof):
raise AnsibleParserError("the field '%s' should be a list of %s, but the item '%s' is a %s" % (name, attribute.listof, item, type(item)), obj=self.get_ds())
elif attribute.isa == 'set':
if not isinstance(value, (list, set)):
value = [ value ]
if not isinstance(value, set):
value = set(value)
elif attribute.isa == 'dict' and not isinstance(value, dict):
raise TypeError("%s is not a dictionary" % value)