ansible/ansible — pull request #8812 by trondhindenes (2014-08-29 08:42:08+00:00)
Title: win_json_facts_setup_improvements; All changes referenced in PRs #8767 , #8768 , #8769

get-attr improvements:
This changes the get-attr function slightly, and lets the module specify whether a param is needed and auto-fails if it is not present. A module can now verify params like so::
$params = Parse-Args $args;
$result = New-Object psobject;
Set-Attr $result "changed" $false;
$path = Get-Attr -obj $params -name path -failifempty $true -resultobj $result

or

$params = Parse-Args $args;
$result = New-Object psobject;
Set-Attr $result "changed" $false;
$path = Get-Attr -obj $params -name path -failifempty $true -emptyattributefailmessage "Oh man. You forgot the main part!" -resultobj $result

json improvements:
slight tweak in how the powershell module converts to json in order to support nested objects (allows for more complex facts, among others)

facts improvements:
This script gathers some extended facts on windows hosts in a json array attribute called "ansible_interfaces". This info is needed for some network-related modules I'm working on. Required the update to powershell.ps1 to return deeply nested json objects.