Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files in Machine Resources fail to copy on windows when copied to drive root #537

Open
geoffles opened this issue Aug 24, 2016 · 0 comments

Comments

@geoffles
Copy link

When specifying files in a machine resource, I get the following error when the target file for the provisioned machine is in the root (eg: c:\myfile):

RuntimeError
    ------------
    Error: command 'New-Item -Type Directory -Force -Path "c:\"' exited with code 1.
    STDOUT: STDERR: #< CLIXML
    <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">New-Item : The path is not of a legal form._x000D__x000A_</S><S S="Error">At line:1 char:40_x000D__x000A_</S><S S="Error">+ $ProgressPreference='SilentlyContinue';New-Item -Type Directory -Force -Path _x000D__x000A_</S><S S="Error">"c: ..._x000D__x000A_</S><S S="Error">+
                        _x000D__x000A_</S><S S="Error">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S S="Error">    + CategoryInfo          : InvalidArgument: (C:\:String) [New-Item], Argume _x000D__x000A_</S><S S="Error">   ntException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : CreateDirectoryArgumentError,Microsoft.PowerShel _x000D__x000A_</S><S S="Error">   l.Commands.NewItemCommand_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>

I have narrowed this down to here: lib/chef/provisioning/transport/winrm.rb#L60

Basically, windows doesn't let you "create" c:\ so a check must be made to see that we're actually trying to make a sub dir before we create directories.

Workaround: Only use sub directories and do not target files to root.

geoffles pushed a commit to geoffles/chef-provisioning that referenced this issue Aug 25, 2016
"Files in Machine Resources fail to copy on windows when copied to drive root"

Performs a check that the directory does not exist before creating it.
geoffles pushed a commit to geoffles/chef-provisioning that referenced this issue Aug 25, 2016
"Files in Machine Resources fail to copy on windows when copied to drive root"

Performs a check that the directory does not exist before creating it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant