chocolatey-community / chocolatey-test-environment

A testing setup related to how the Chocolatey Package Verifier runs testing. Used for manual testing or prior to submission
Apache License 2.0
117 stars 187 forks source link

using hyperv provider, can not read files in /packages share #41

Open diablodale opened 5 years ago

diablodale commented 5 years ago

By using the hyperv provider for vagrant, I am unable to read files in the /packages share. I can see and list (dir) the files, but I can not read the files.

Setup

Repo

  1. Setup as per instructions at https://github.com/chocolatey-community/chocolatey-test-environment/blob/master/ReadMe.md except for the following:
    • No Virtualbox -- we will be using the hyperv box and provider
    • No plugin sahara -- this is unneeded for this issue
  2. vagrant winrm -e -s powershell -c "copy c:/packages/*.* c:/"

Result

copy : Could not find file 'C:\packages\ReadMe.md'.
At C:\windows\temp\winrm-elevated-shell-fff58481-a970-493f-9281-4d343fbfd9b2.ps
1:1 char:1
+ copy c:/packages/*.* c:/
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], FileNotFoundExcep
   tion
    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerS
   hell.Commands.CopyItemCommand

Expected

No errors and the Readme.md file to be copied.

Notes

Listing files succeeds like this:

vagrant winrm -e -s powershell -c "dir C:/packages/"
    Directory: C:\packages
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---         6/19/2019  12:05 AM        113 ReadMe.md

All attempts to read the files (like readme.md) usign different methods results in similar errors. For example, editing the Vagrantfile to have a provision command type c:/packages/ReadMe.md results in the error:

==> default: Running provisioner: shell...
    default: Running: inline PowerShell script
    default: SUCCESS: Specified value was saved.
    default: Testing package if a line is uncommented.
    default: type : Cannot find path 'C:\packages\ReadMe.md' because it does not exist.
    default: At C:\tmp\vagrant-shell.ps1:16 char:1
    default: + type c:/packages/ReadMe.md
    default: + ~~~~~~~~~~~~~~~~~~~~~~~~~~
    default:     + CategoryInfo          : ObjectNotFound: (C:\packages\ReadMe.md:String) [
    default:    Get-Content], ItemNotFoundException
    default:     + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetCo
    default:    ntentCommand

Manipulating the permissions on the packages folder and files on the host did not resolve the problems. I added full access to Everyone and yet the files can be seen, but can not be read.

In https://github.com/chocolatey-community/chocolatey-test-environment/commit/ba95e7d402f835906790b33e2e4604a0eeb5f9ed the hyperv provider and box was added. Was the read of local packages in the /packages share tested? If so, are there setup/permission/file requirements to get it to work?

AJDurant commented 2 years ago

I changed the synced_folder line to a file provision to work around this: config.vm.provision "file", source: "packages", destination: "/packages"

flybyray commented 1 year ago

Have similar problem. Output for the diagnostic commands is a bit different:

vagrant winrm -e -s powershell -c "copy c:/packages/*.* c:/" no output

vagrant winrm -e -s powershell -c "dir C:/packages/" output:

dir : The network path was not found.
At C:\windows\temp\winrm-elevated-shell-d086146b-7d47-4016-b515-f4eba2d99125.ps
1:1 char:1
+ dir C:/packages/
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ReadError: (C:\packages\:String) [Get-ChildItem]
   , IOException
    + FullyQualifiedErrorId : DirIOError,Microsoft.PowerShell.Commands.GetChil
   dItemCommand
pauby commented 1 year ago

@flybyray Did you try what was suggested above?

flybyray commented 1 year ago

@flybyray Did you try what was suggested above?

The workaround yes.

But for my overall problem it does not help. Choco Test environment is an outdated platform. Need to create another issue or find the relevant for modern tls connections. I cannot download from Amazon cdn. When I install a modern browser like Firefox in test environment then I can use it to download. But internet-explorer or powershell uses old settings which throw errors.

pauby commented 1 year ago

Choco Test environment is an outdated platform.

It uses Windows Server 2012 R2 deliberately and for many good reasons.

I cannot download from Amazon cdn. When I install a modern browser like Firefox in test environment then I can use it to download. But internet-explorer or powershell uses old settings which throw errors.

The test environment is intended to be used for testing Chocolatey packages.

flybyray commented 1 year ago

It uses Windows Server 2012 R2 deliberately and for many good reasons. That maybe true but the powershell script libraries of choco should recognize short comings of this old platform regarding security updates. TLS1.3 should be no problem out of the box. Why a package maintainer should care of this underlying connection issues?

The test environment is intended to be used for testing Chocolatey packages.

I tested package failures reported by choco moderators. Actually it is about those https://goteleport.com/download/ . It is works without problem on correct modern OS. But not with this old fashioned test environment.

pauby commented 1 year ago

But not with this old fashioned test environment.

Again, I want to correct you here. This isn't old-fashioned. It's a fully supported server operating system. I know it's semantics, but it's important.

If the package works and the reason it doesn't work is only due to Windows Server 2012 R2, then you can request a Verifier exemption.