Skip to content

Commit

Permalink
Expand connection plugins used in CI (#577)
Browse files Browse the repository at this point in the history
Expands the testing matrix of the Windows connection plugins used in CI
to cover all the supported connections of Windows.
  • Loading branch information
jborean93 committed Jan 8, 2025
1 parent 04b1a79 commit 3cdcf17
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions plugins/modules/win_mapped_drive.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,6 @@ try {
}
}
else {
$physical_drives = Get-PSDrive -PSProvider "FileSystem"
if ($letter -in $physical_drives.Name) {
$module.FailJson("failed to create mapped drive $letter, this letter is in use and is pointing to a non UNC path")
}

# PowerShell converts a $null value to "" when crossing the .NET marshaler, we need to convert the input
# to a missing value so it uses the defaults. We also need to Invoke it with MethodInfo.Invoke so the defaults
# are still used
Expand All @@ -418,6 +413,11 @@ try {
}
}
else {
$physical_drives = Get-PSDrive -PSProvider "FileSystem"
if ($letter -in $physical_drives.Name) {
$module.FailJson("failed to create mapped drive $letter, this letter is in use and is pointing to a non UNC path")
}

if (-not $module.CheckMode) {
$add_method.Invoke($null, [Object[]]@($letter_root, $path, $i_token_ptr, $input_username, $input_password))
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/win_mapped_drive/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
ansible_become: yes
ansible_become_method: runas
ansible_become_user: '{{ ansible_user }}'
ansible_become_pass: '{{ ansible_password }}'
ansible_become_pass: '{{ ansible_password | default(ansible_test_connection_password) }}'

- name: ensure mapped drive is deleted at the end of the test
win_mapped_drive:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/win_mapped_drive/tasks/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
ansible_become: yes
ansible_become_method: runas
ansible_become_user: '{{ ansible_user }}'
ansible_become_pass: '{{ ansible_password }}'
ansible_become_pass: '{{ ansible_password | default(ansible_test_connection_password) }}'

- name: map drive with stored cred (check mode)
win_mapped_drive:
Expand Down

0 comments on commit 3cdcf17

Please sign in to comment.