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

1.2.1 throws RuntimeError #136

Open
okdas opened this issue May 6, 2020 · 1 comment
Open

1.2.1 throws RuntimeError #136

okdas opened this issue May 6, 2020 · 1 comment
Labels
Bug Something isn't working hacktoberfest An issue highlighted for the digital ocean Hacktoberfest Event Regression Unexpected issue as the result of a change

Comments

@okdas
Copy link

okdas commented May 6, 2020

πŸ‘» Brief Description

Chef run fails after an upgrade to 1.2.1 version of this cookbook.

πŸ₯ž Cookbook version

1.2.1

πŸ‘©β€πŸ³ Chef-Infra Version

15.6.10

🎩 Platform details

    System Info:
    ------------
    chef_version=15.6.10
    platform=amazon
    platform_version=2
    ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
    program_name=/usr/bin/chef-client
    executable=/opt/chef/bin/chef-client

βž• Additional context

Recipe: ossec::install_server
  * yum_package[ossec] action install (up to date)
Recipe: ossec::common
  * ruby_block[ossec install_type] action run
    - execute the ruby block ossec install_type
  * chef_gem[gyoku] action install (up to date)
  * file[/var/ossec/etc/ossec.conf] action create

    ================================================================================
    Error executing action `create` on resource 'file[/var/ossec/etc/ossec.conf]'
    ================================================================================

    RuntimeError
    ------------
    can't add a new key into hash during iteration

    Cookbook Trace:
    ---------------
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:33:in `block in object_to_ossec'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:31:in `each_key'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:31:in `object_to_ossec'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:41:in `block in object_to_ossec'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:40:in `map!'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:40:in `object_to_ossec'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:35:in `block in object_to_ossec'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:31:in `each_key'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:31:in `object_to_ossec'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:35:in `block in object_to_ossec'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:31:in `each_key'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:31:in `object_to_ossec'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:35:in `block in object_to_ossec'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:31:in `each_key'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:31:in `object_to_ossec'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/libraries/helpers.rb:56:in `ossec_to_xml'
    /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/recipes/common.rb:58:in `block (2 levels) in from_file'

    Resource Declaration:
    ---------------------
    # In /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/recipes/common.rb

     46: file "#{node['ossec']['dir']}/etc/ossec.conf" do
     47:   owner 'root'
     48:   group 'ossec'
     49:   mode '0440'
     50:   manage_symlink_source true
     51:   notifies :restart, 'service[ossec]'
     52:
     53:   content lazy {
     54:     # Merge the "typed" attributes over the "all" attributes.
     55:     all_conf = node['ossec']['conf']['all'].to_hash
     56:     type_conf = node['ossec']['conf'][node['ossec']['install_type']].to_hash
     57:     conf = Chef::Mixin::DeepMerge.deep_merge(type_conf, all_conf)
     58:     Chef::OSSEC::Helpers.ossec_to_xml('ossec_config' => conf)
     59:   }
     60: end
     61:

    Compiled Resource:
    ------------------
    # Declared in /var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/recipes/common.rb:46:in `from_file'

    file("/var/ossec/etc/ossec.conf") do
      action [:create]
      default_guard_interpreter :default
      declared_type :file
      cookbook_name "ossec"
      recipe_name "common"
      content #<Chef::DelayedEvaluator:0x00000000059cfc20@/var/chef/.chef/local-mode-cache/cache/cookbooks/ossec/recipes/common.rb:53>
      owner "root"
      group "ossec"
      mode "0440"
      manage_symlink_source true
      path "/var/ossec/etc/ossec.conf"
      verifications []
    end

    System Info:
    ------------
    chef_version=15.6.10
    platform=amazon
    platform_version=2
    ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
    program_name=/usr/bin/chef-client
    executable=/opt/chef/bin/chef-client
@okdas
Copy link
Author

okdas commented May 6, 2020

Seems like related to this commit: cda4dd9

Ruby 1.9+ only supports read-only operations on hash during iteration. Can we probably revert this commit? I'm pretty sure there are a lot of people who switched to 1.9+.

@ramereth ramereth added Bug Something isn't working hacktoberfest An issue highlighted for the digital ocean Hacktoberfest Event Regression Unexpected issue as the result of a change labels Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working hacktoberfest An issue highlighted for the digital ocean Hacktoberfest Event Regression Unexpected issue as the result of a change
Projects
None yet
Development

No branches or pull requests

2 participants