Added basic equivalent to PowerShell modules (#44705)

* Added basic equivalent to PowerShell modules

* changes based on latest review

* Added tests

* ignore sanity test due to how tests are set up

* Changes to work with PSCore

* Added documentation and change updated more modules

* Add some speed optimisations to AddType

* fix some issues in the doc changes

* doc changes
This commit is contained in:
Jordan Borean 2018-11-07 10:53:17 +10:00 committed by GitHub
commit 501acae5ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 3644 additions and 314 deletions

View file

@ -2,21 +2,20 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
#AnsibleRequires -CSharpUtil Ansible.Basic
$ErrorActionPreference = "Stop"
$params = Parse-Args $args -supports_check_mode $true
$data = Get-AnsibleParam -obj $params -name "data" -type "str" -default "pong"
$spec = @{
options = @{
data = @{ type = "str"; default = "pong" }
}
supports_check_mode = $true
}
$module = [Ansible.Basic.AnsibleModule]::Create($args, $spec)
$data = $module.Params.data
if ($data -eq "crash") {
throw "boom"
}
$result = @{
changed = $false
ping = $data
}
Exit-Json $result
$module.Result.ping = $data
$module.ExitJson()