Skip to content

Commit

Permalink
Added Conditional to check if disk should be brought online. (#268)
Browse files Browse the repository at this point in the history
* Added Conditional to check if disk should be brought online. 

This fixes a bug where if you want to bring a disk offline by using the parameter "online" set to "false/no" it would bring the disk online again anyways. All needed is the added conditional to fix this, where the parameter gets taken in to account at the end.

* Added changelog fragment

* Fix up sanity issue with changelog

Co-authored-by: Jordan Borean <[email protected]>
  • Loading branch information
bateskevin and jborean93 authored Aug 23, 2021
1 parent e468513 commit c303637
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelogs/fragments/win_initialize_disk-offline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- >-
win_initialize_disk - Ensure ``online: False`` doesn't bring the disk online again - https://github.com/ansible-collections/community.windows/pull/268
2 changes: 1 addition & 1 deletion plugins/modules/win_initialize_disk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ if ("RAW" -eq $ansible_part_style) {
} elseif ($force_init) {
$ansible_disk = Set-AnsibleDisk -AnsibleDisk $ansible_disk -BringOnline $bring_online
Clear-AnsibleDisk -AnsibleDisk $ansible_disk
Initialize-AnsibleDisk -AnsibleDisk $ansible_disk -PartitionStyle $partition_style
if ( $bring_online ) { Initialize-AnsibleDisk -AnsibleDisk $ansible_disk -PartitionStyle $partition_style }
}
}

Expand Down

0 comments on commit c303637

Please sign in to comment.