OneGet / MicrosoftDockerProvider

Provider to search, save and install Docker
Other
133 stars 55 forks source link

Soft Fail due to Erroneous Missing File #71

Open shoddyguard opened 4 years ago

shoddyguard commented 4 years ago

When running Install-Package -Name docker -ProviderName DockerMsftProvider -Force as part of an unattended installation on Server 2019 Datacenter (April 2020 Update) the script bombs out due to a erroneous missing file.

Install-Package : An object at the specified path C:\Users\S552A~1.B-A does not exist.
At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], E
   xception
    + FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.PackageMan
   agement.Cmdlets.InstallPackage

I believe the issue is that something is referencing $env:TEMP but this environment variable can be truncated to the DOS 8.3 standard which is causing some issue with whatever check there is for the presence of the file.

Stepping through the process it seems to be the Docker_DockerSearchIndex.json file:

VERBOSE: Download size: 0.02MB
VERBOSE: Free space on the drive: 32830.55MB
VERBOSE: Downloading https://dockermsft.azureedge.net/dockercontainer/DockerMsftIndex.json to C:\Users\S552A~1.B-A\AppData\Local\Temp\2\DockerMsftProvider\Docker_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 0 seconds.
WARNING: An object at the specified path C:\Users\S552A~1.B-A does not exist.

If I check my $env:TEMP variable I indeed get: PS C:\Users\user.name>> $env:TEMP C:\Users\S552A~1.B-A\AppData\Local\Temp\2 Checking for the presence of the file manually I can find it

PS C:\Users\user.name>> Get-ChildItem C:\Users\user.name\AppData\Local\Temp\2\DockerMsftProvider

    Directory: C:\Users\user.name\AppData\Local\Temp\2\DockerMsftProvider

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       04/06/2020     02:38          24250 DockerDefault_DockerSearchIndex.json
-a----       04/06/2020     02:47          24250 Docker_DockerSearchIndex.json

I've tried this on 5 different machines (physical and virtual) and the result is the same.

Docker does however appear to install and run just fine, however this error is especially annoying as it can't easily be filtered out via a try/catch due to the fact that it's a System.Exception.

If other people run into this as a workaround you can filter on $_.Exception.Message

shoddyguard commented 4 years ago

I've got a better workaround rather than filtering out the $_.Exception.Message.

If you temporarily replace your TEMP path with the full path instead of the truncated path the package installs without fault:

$env:TEMP = (Get-Item $env:TEMP).FullName