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

Windows unzipping appears to be broken again #165

Open
ValkyrieOps opened this issue Sep 18, 2020 · 1 comment
Open

Windows unzipping appears to be broken again #165

ValkyrieOps opened this issue Sep 18, 2020 · 1 comment

Comments

@ValkyrieOps
Copy link

ValkyrieOps commented Sep 18, 2020

Hello,
Currently I am unable to complete a fresh install of Filebeat 7.9.1 on Windows 10/Server 2019 using the basic default recipe. Not sure if this is a duplicate of elastic/beats#9259 but the output from the Chef run seems to indicate so. Please let me know if I can provide more information:


Recipe: filebeat::default
  * filebeat_install[default] action create
    * remote_file[filebeat_package_file] action create
      - create new file C:\chef\cache/filebeat-7.9.1-windows-x86_64.zip
      - update content in file C:\chef\cache/filebeat-7.9.1-windows-x86_64.zip from none to a8716e
      (file sizes exceed 10000000 bytes, diff output suppressed)
    * directory[C:/opt/filebeat] action create
      - create new directory C:/opt/filebeat
    * windows_zipfile[C:/opt/filebeat] action unzip[2020-09-18T14:27:47-05:00] WARN: The windows_zipfile resource has been deprecated as Chef Infra Client 15.0 shipped with a new archive_file resource, which natively handles multiple archive formats. Please update any cookbooks using this resource to instead use the `archive_file` resource: https://docs.chef.io/resource_archive_file.html

      - unzip C:\chef\cache/filebeat-7.9.1-windows-x86_64.zip
      * ruby_block[Unzipping] action run

        ================================================================================
        Error executing action `run` on resource 'ruby_block[Unzipping]'
        ================================================================================

        Errno::EINVAL
        -------------
        Invalid argument @ rb_sysopen - C:/opt/filebeat/filebeat-7.9.1-windows-x86_64/module/

        Resource Declaration:
        ---------------------
        # In C:/chef/cache/cookbooks/windows/resources/zipfile.rb

         54:     ruby_block 'Unzipping' do
         55:       block do
         56:         Zip::File.open(cache_file_path) do |zip|
         57:           zip.each do |entry|
         58:             path = ::File.join(new_resource.path, entry.name)
         59:             FileUtils.mkdir_p(::File.dirname(path))
         60:             if new_resource.overwrite && ::File.exist?(path) && !::File.directory?(path)
         61:               FileUtils.rm(path)
         62:             end
         63:             zip.extract(entry, path) unless ::File.exist?(path)
         64:           end
         65:         end
         66:       end
         67:       action :run

        Compiled Resource:
        ------------------
        # Declared in C:/chef/cache/cookbooks/windows/resources/zipfile.rb:54:in `block (2 levels) in class_from_file'

        ruby_block("Unzipping") do
          action [:run]
          default_guard_interpreter :default
          declared_type :ruby_block
          cookbook_name "filebeat"
          block #<Proc:0x00000000073f61a8@C:/chef/cache/cookbooks/windows/resources/zipfile.rb:55>
          block_name "Unzipping"
        end

        System Info:
        ------------
        chef_version=14.12.9
        platform=windows
        platform_version=10.0.18363
        ruby=ruby 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]
        program_name=C:/opscode/chef/bin/chef-client
        executable=C:/opscode/chef/bin/chef-client


      ================================================================================
      Error executing action `unzip` on resource 'windows_zipfile[C:/opt/filebeat]'
      ================================================================================

      Errno::EINVAL
      -------------
      ruby_block[Unzipping] (C:/chef/cache/cookbooks/windows/resources/zipfile.rb line 54) had an error: Errno::EINVAL: Invalid argument @ rb_sysopen - C:/opt/filebeat/filebeat-7.9.1-windows-x86_64/module/

      Resource Declaration:
      ---------------------
      # In C:/chef/cache/cookbooks/filebeat/resources/install.rb

       78:     windows_zipfile new_resource.windows_base_dir do
       79:       source package_file
       80:       action :unzip
       81: #      not_if { ::File.exist?(new_resource.conf_dir + '/install-service-filebeat.ps1') }
       82:       notifies :run, 'powershell_script[install filebeat as service]', :immediately
       83:     end
       84:

      Compiled Resource:
      ------------------
      # Declared in C:/chef/cache/cookbooks/filebeat/resources/install.rb:78:in `block in class_from_file'

      windows_zipfile("C:/opt/filebeat") do
        action [:unzip]
        default_guard_interpreter :default
        declared_type :windows_zipfile
        cookbook_name "filebeat"
        source "C:\\chef\\cache/filebeat-7.9.1-windows-x86_64.zip"
      end

      System Info:
      ------------
      chef_version=14.12.9
      platform=windows
      platform_version=10.0.18363
      ruby=ruby 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]
      program_name=C:/opscode/chef/bin/chef-client
      executable=C:/opscode/chef/bin/chef-client


    ================================================================================
    Error executing action `create` on resource 'filebeat_install[default]'
    ================================================================================

    Errno::EINVAL
    -------------
    windows_zipfile[C:/opt/filebeat] (C:/chef/cache/cookbooks/filebeat/resources/install.rb line 78) had an error: Errno::EINVAL: ruby_block[Unzipping] (C:/chef/cache/cookbooks/windows/resources/zipfile.rb line 54) had an error: Errno::EINVAL: Invalid argument @ rb_sysopen - C:/opt/filebeat/filebeat-7.9.1-windows-x86_64/module/

    Resource Declaration:
    ---------------------
    # In C:/chef/cache/cookbooks/filebeat/recipes/default.rb

      7: filebeat_install 'default' do
      8:   version '7.9.1'
      9:   action :create
     10: end
     11:

    Compiled Resource:
    ------------------
    # Declared in C:/chef/cache/cookbooks/filebeat/recipes/default.rb:7:in `from_file'

    filebeat_install("default") do
      action [:create]
      updated true
      updated_by_last_action true
      default_guard_interpreter :default
      declared_type :filebeat_install
      cookbook_name "filebeat"
      recipe_name "default"
      version "7.9.1"
      conf_dir "C:/opt/filebeat/filebeat-7.9.1-windows-x86_64"
      prospectors_dir "C:/opt/filebeat/filebeat-7.9.1-windows-x86_64/conf.d"
      log_dir "C:/opt/filebeat/filebeat-7.9.1-windows-x86_64/logs"
    end

    System Info:
    ------------
    chef_version=14.12.9
    platform=windows
    platform_version=10.0.18363
    ruby=ruby 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]
    program_name=C:/opscode/chef/bin/chef-client
    executable=C:/opscode/chef/bin/chef-client


Running handlers:
[2020-09-18T14:27:48-05:00] ERROR: Running exception handlers
Running handlers complete
[2020-09-18T14:27:48-05:00] ERROR: Exception handlers complete
Chef Client failed. 2 resources updated in 06 seconds
[2020-09-18T14:27:48-05:00] FATAL: Stacktrace dumped to C:/chef/cache/chef-stacktrace.out
[2020-09-18T14:27:48-05:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2020-09-18T14:27:48-05:00] FATAL: Errno::EINVAL: filebeat_install[default] (filebeat::default line 7) had an error: Errno::EINVAL: windows_zipfile[C:/opt/filebeat] (C:/chef/cache/cookbooks/filebeat/resources/install.rb line 78) had an error: Errno::EINVAL: ruby_block[Unzipping] (C:/chef/cache/cookbooks/windows/resources/zipfile.rb line 54) had an error: Errno::EINVAL: Invalid argument @ rb_sysopen - C:/opt/filebeat/filebeat-7.9.1-windows-x86_64/module/


@ValkyrieOps
Copy link
Author

If anyone stumbles across this issue, the root cause is in the Windows cookbook. The "fix" can be found here:
chef-boneyard/windows#459 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant