mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
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:
parent
74619c2036
commit
501acae5ab
17 changed files with 3644 additions and 314 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue