mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00: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:
@@ -5,7 +5,7 @@
|
||||
path: '{{win_cert_dir}}\subj-cert.pem'
|
||||
store_location: FakeLocation
|
||||
register: fail_fake_location
|
||||
failed_when: "fail_fake_location.msg != 'Get-AnsibleParam: Argument store_location needs to be one of CurrentUser,LocalMachine but was FakeLocation.'"
|
||||
failed_when: "fail_fake_location.msg != 'value of store_location must be one of: CurrentUser, LocalMachine, got: FakeLocation'"
|
||||
|
||||
- name: fail with invalid store name
|
||||
win_certificate_store:
|
||||
@@ -13,27 +13,27 @@
|
||||
path: '{{win_cert_dir}}\subj-cert.pem'
|
||||
store_name: FakeName
|
||||
register: fail_fake_name
|
||||
failed_when: "fail_fake_name.msg != 'Get-AnsibleParam: Argument store_name needs to be one of AddressBook,AuthRoot,CertificateAuthority,Disallowed,My,Root,TrustedPeople,TrustedPublisher but was FakeName.'"
|
||||
failed_when: "fail_fake_name.msg != 'value of store_name must be one of: AddressBook, AuthRoot, CertificateAuthority, Disallowed, My, Root, TrustedPeople, TrustedPublisher, got: FakeName'"
|
||||
|
||||
- name: fail when state=present and no path is set
|
||||
win_certificate_store:
|
||||
state: present
|
||||
register: fail_present_no_path
|
||||
failed_when: "fail_present_no_path.msg != 'Get-AnsibleParam: Missing required argument: path'"
|
||||
failed_when: "fail_present_no_path.msg != 'state is present but all of the following are missing: path'"
|
||||
|
||||
- name: fail when state=exported and no path is set
|
||||
win_certificate_store:
|
||||
state: exported
|
||||
thumbprint: ABC
|
||||
register: fail_export_no_path
|
||||
failed_when: "fail_export_no_path.msg != 'Get-AnsibleParam: Missing required argument: path'"
|
||||
failed_when: "fail_export_no_path.msg != 'state is exported but all of the following are missing: path'"
|
||||
|
||||
- name: fail when state=exported and no thumbprint is set
|
||||
win_certificate_store:
|
||||
state: exported
|
||||
path: '{{win_cert_dir}}'
|
||||
register: fail_export_no_thumbprint
|
||||
failed_when: "fail_export_no_thumbprint.msg != 'Get-AnsibleParam: Missing required argument: thumbprint'"
|
||||
failed_when: "fail_export_no_thumbprint.msg != 'state is exported but all of the following are missing: thumbprint'"
|
||||
|
||||
- name: fail to export thumbprint when path is a dir
|
||||
win_certificate_store:
|
||||
@@ -47,7 +47,7 @@
|
||||
win_certificate_store:
|
||||
state: absent
|
||||
register: fail_absent_no_path_or_thumbprint
|
||||
failed_when: fail_absent_no_path_or_thumbprint.msg != 'Either path or thumbprint must be set when state=absent'
|
||||
failed_when: "fail_absent_no_path_or_thumbprint.msg != 'state is absent but any of the following are missing: path, thumbprint'"
|
||||
|
||||
- name: import pem certificate (check)
|
||||
win_certificate_store:
|
||||
|
||||
2
test/integration/targets/win_csharp_utils/aliases
Normal file
2
test/integration/targets/win_csharp_utils/aliases
Normal file
@@ -0,0 +1,2 @@
|
||||
shippable/windows/group1
|
||||
shippable/windows/smoketest
|
||||
File diff suppressed because it is too large
Load Diff
9
test/integration/targets/win_csharp_utils/tasks/main.yml
Normal file
9
test/integration/targets/win_csharp_utils/tasks/main.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: test Ansible.Basic.cs
|
||||
ansible_basic_tests:
|
||||
register: ansible_basic_test
|
||||
|
||||
- name: assert test Ansible.Basic.cs
|
||||
assert:
|
||||
that:
|
||||
- ansible_basic_test.data == "success"
|
||||
@@ -15,7 +15,7 @@
|
||||
state: present
|
||||
level: machine
|
||||
register: create_fail_null
|
||||
failed_when: create_fail_null.msg != "When state=present, value must be defined and not an empty string, if you wish to remove the envvar, set state=absent"
|
||||
failed_when: 'create_fail_null.msg != "state is present but all of the following are missing: value"'
|
||||
|
||||
- name: fail to create environment value with empty value
|
||||
win_environment:
|
||||
@@ -24,7 +24,7 @@
|
||||
state: present
|
||||
level: machine
|
||||
register: create_fail_empty_string
|
||||
failed_when: create_fail_null.msg != "When state=present, value must be defined and not an empty string, if you wish to remove the envvar, set state=absent"
|
||||
failed_when: create_fail_empty_string.msg != "When state=present, value must be defined and not an empty string, if you wish to remove the envvar, set state=absent"
|
||||
|
||||
- name: create test environment value for machine check
|
||||
win_environment:
|
||||
|
||||
@@ -51,37 +51,6 @@
|
||||
- win_ping_ps1_result is not changed
|
||||
- win_ping_ps1_result.ping == 'bleep'
|
||||
|
||||
# TODO: this will have to be removed once PS basic is implemented
|
||||
- name: test win_ping with extra args to verify that v2 module replacer escaping works as expected
|
||||
win_ping:
|
||||
data: bloop
|
||||
a_null: null
|
||||
a_boolean: true
|
||||
another_boolean: false
|
||||
a_number: 299792458
|
||||
another_number: 22.7
|
||||
yet_another_number: 6.022e23
|
||||
a_string: |
|
||||
it's magic
|
||||
"@'
|
||||
'@"
|
||||
an_array:
|
||||
- first
|
||||
- 2
|
||||
- 3.0
|
||||
an_object:
|
||||
- the_thing: the_value
|
||||
- the_other_thing: 0
|
||||
- the_list_of_things: [1, 2, 3, 5]
|
||||
register: win_ping_extra_args_result
|
||||
|
||||
- name: check that win_ping with extra args succeeds and ignores everything except data
|
||||
assert:
|
||||
that:
|
||||
- win_ping_extra_args_result is not failed
|
||||
- win_ping_extra_args_result is not changed
|
||||
- win_ping_extra_args_result.ping == 'bloop'
|
||||
|
||||
- name: test win_ping using data=crash so that it throws an exception
|
||||
win_ping:
|
||||
data: crash
|
||||
|
||||
Reference in New Issue
Block a user