Closed neilalexander closed 4 years ago
Files identified in the description:
If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
cc @dagwieers @if-meaton @jborean93 @jhawkesworth @nitzmahone click here for bot help
Hmm I can't seem to replicate this issue but it looks like it comes down to $di | Get-Volume
returning $null
which means it cannot access the DriveLetter
property. The $di
value itself can't be $null
or else it would fail with
Get-Volume : Cannot validate argument on parameter 'StorageJob'. The argument is null. Provide a valid value for the
argument, and then try running the command again.
At line:1 char:8
+ ($di | Get-Volume).DriveLetter
+ ~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Volume], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Get-Volume
I tried stress testing my host so maybe WMI would return nothing under load but still no luck. Technically we could check if the result is $null
before accessing the DriveLetter but we should still fail because we couldn't return the mounted drive letter(s).
The issue only seems to happen sporadically, and I've only noticed it on one machine (which gets wiped back to a blank snapshot often enough) although I haven't really tried this method on other machines yet – haven't got that far!
I'm wondering whether the issue might be related to if the ISO file gets overwritten/redownloaded before mounting? I am not really sure how Windows detects if a file is already mounted or not.
The ISO is the SCCM 1802 install media (mu_system_center_configuration_manager_current_branch_version_1802_x86_x64_dvd_12064903.iso
from MSDN).
Hm, never mind. I don't believe the local copy of the ISO is being rewritten before the second re-mount after all. The win_get_url
task has force: no
and it does not report changed
status.
Here's what I see on the machine:
PS C:\Users\Administrator> Get-DiskImage C:\Users\Administrator\AppData\Local\Temp\mu_system_center_configuration_manager_current_branch_version_1802_x86_x64_dvd_12064903.iso | Get-Volume
DriveLetter FileSystemLabel FileSystem DriveType HealthStatus OperationalStatus SizeRemaining Size
----------- --------------- ---------- --------- ------------ ----------------- ------------- ----
E SC_CM_SCEP_1802 UDF CD-ROM Healthy OK 0 B 1.4 GB
Files identified in the description:
If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
cc @ShachafGoldstein click here for bot help
Issue migrated to https://github.com/ansible-collections/community.windows/issues/36
SUMMARY
The
win_disk_image
target seems to fail occasionally when the disk image is already mounted, breaking idempotency.ISSUE TYPE
COMPONENT NAME
win_disk_image
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Ansible is running on macOS Mojave 10.14.3. Target server is Windows Server 2016.
STEPS TO REPRODUCE
Happens only intermittently. Can't seem to reproduce 100% of the time.
EXPECTED RESULTS
ACTUAL RESULTS
MODULE_STDERR: The property 'DriveLetter' cannot be found on this object. Verify that the property exists. At line:52 char:7+ $drive_letters = ($di | Get-Volume).DriveLetter