mirror of https://github.com/ansible/ansible.git
ansible-test - fix ps argspec check inside cmdlet (#79699)
* ansible-test - fix ps argspec check inside cmdlet
* Added error condition test
* Fix sanity problem
(cherry picked from commit ee33be9484
)
pull/79726/head
parent
a398724a31
commit
8e9834fde5
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- ansible-test - Fix validate-modules error when retrieving PowerShell argspec when retrieved inside a Cmdlet
|
@ -0,0 +1,3 @@
|
||||
README
|
||||
------
|
||||
This is a simple collection used to test failures with ``ansible-test sanity --test validate-modules``.
|
@ -0,0 +1,6 @@
|
||||
namespace: ns
|
||||
name: failure
|
||||
version: 1.0.0
|
||||
readme: README.rst
|
||||
authors:
|
||||
- Ansible
|
@ -0,0 +1 @@
|
||||
requires_ansible: '>=2.9'
|
@ -0,0 +1,16 @@
|
||||
#!powershell
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
#AnsibleRequires -CSharpUtil Ansible.Basic
|
||||
|
||||
throw "test inner error message"
|
||||
|
||||
$module = [Ansible.Basic.AnsibleModule]::Create($args, @{
|
||||
options = @{
|
||||
test = @{ type = 'str'; choices = @('foo', 'bar'); default = 'foo' }
|
||||
}
|
||||
})
|
||||
|
||||
$module.Result.test = 'abc'
|
||||
|
||||
$module.ExitJson()
|
@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2022 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
DOCUMENTATION:
|
||||
module: failure_ps
|
||||
short_description: Short description for failure_ps module
|
||||
description:
|
||||
- Description for failure_ps module
|
||||
options:
|
||||
test:
|
||||
description:
|
||||
- Description for test module option
|
||||
type: str
|
||||
choices:
|
||||
- foo
|
||||
- bar
|
||||
default: foo
|
||||
author:
|
||||
- Ansible Core Team
|
||||
|
||||
EXAMPLES: |
|
||||
- name: example for failure_ps
|
||||
ns.col.failure_ps:
|
||||
test: bar
|
||||
|
||||
RETURN:
|
||||
test:
|
||||
description: The test return value
|
||||
returned: always
|
||||
type: str
|
||||
sample: abc
|
@ -0,0 +1,19 @@
|
||||
#AnsibleRequires -CSharpUtil Ansible.Basic
|
||||
|
||||
Function Invoke-AnsibleModule {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
validate
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param ()
|
||||
|
||||
$module = [Ansible.Basic.AnsibleModule]::Create(@(), @{
|
||||
options = @{
|
||||
test = @{ type = 'str' }
|
||||
}
|
||||
})
|
||||
$module.ExitJson()
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function Invoke-AnsibleModule
|
@ -0,0 +1,7 @@
|
||||
#!powershell
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
#AnsibleRequires -CSharpUtil Ansible.Basic
|
||||
#AnsibleRequires -PowerShell ..module_utils.share_module
|
||||
|
||||
Invoke-AnsibleModule
|
@ -0,0 +1,25 @@
|
||||
# Copyright (c) 2022 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
DOCUMENTATION:
|
||||
module: in_function
|
||||
short_description: Short description for in_function module
|
||||
description:
|
||||
- Description for in_function module
|
||||
options:
|
||||
test:
|
||||
description: Description for test
|
||||
type: str
|
||||
author:
|
||||
- Ansible Core Team
|
||||
|
||||
EXAMPLES: |
|
||||
- name: example for sidecar
|
||||
ns.col.in_function:
|
||||
|
||||
RETURN:
|
||||
test:
|
||||
description: The test return value
|
||||
returned: always
|
||||
type: str
|
||||
sample: abc
|
Loading…
Reference in New Issue