chef [SOLVED]: Unzipping a file on windows server 2012r2 via chef

chef [SOLVED]: Unzipping a file on windows server 2012r2 via chef

Home Forums Automation Tools Chef Tutorials chef [SOLVED]: Unzipping a file on windows server 2012r2 via chef

Tagged: , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #197367

    Cloudy Point
    Keymaster

    QuestionQuestion

    I am trying to unzip a file on server 2012r2 through chef. I get an error back “illegal characters in path”. When I manually type the commands in the file is extracted exactly as it should, but doing it through chef it just does not want to work for some reason.

    powershell_script 'test' do
    code <<-EOH [System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null
    [System.IO.Compression.ZipFile]::ExtractToDirectory('c:tmphp401n.zip', 'c:tmp')
    EOH
    end
    

    #197368

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    You need to escape your backslashes because they are getting processed by Ruby too, c:\tmp\hp401n.zip and C:\tmp. Otherwise you probably have literal tab characters (t) in the path.

    Source: https://stackoverflow.com/questions/46434107/unzipping-a-file-on-windows-server-2012r2-via-chef
    Author: coderanger
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.