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

filebeat cookbook does not work with latest Powershell cookbook #64

Closed
JCotton1123 opened this issue Sep 2, 2016 · 6 comments
Closed
Assignees
Labels

Comments

@JCotton1123
Copy link
Contributor

It looks like the latest powershell cookbook release removed the powershell resource. As a result this cookbook fails with the below. A temporary fix is to lock the powershell version to the latest 3.X.X release.

NoMethodError
  -------------
  No resource or method named `powershell' for `Chef::Recipe "config"'

  Cookbook Trace:
  ---------------
    /var/chef/cookbooks/filebeat/recipes/config.rb:46:in `from_file'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:336:in `load_recipe'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:292:in `block in include_recipe'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:291:in `each'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:291:in `include_recipe'
    /var/chef/cookbooks/filebeat/recipes/default.rb:28:in `from_file'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:336:in `load_recipe'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:292:in `block in include_recipe'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:291:in `each'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:291:in `include_recipe'
    /var/chef/cookbooks/wrap_base/recipes/_logging.rb:104:in `from_file'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:336:in `load_recipe'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:292:in `block in include_recipe'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:291:in `each'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:291:in `include_recipe'
    /var/chef/cookbooks/wrap_base/recipes/default.rb:34:in `from_file'
    /var/chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb:336:in `load_recipe'

  Relevant File Content:
  ----------------------
  /var/chef/cookbooks/filebeat/recipes/config.rb:

   39:    file "prospector-#{prospector}" do
   40:      path ::File.join(node['filebeat']['prospectors_dir'], "prospector-#{prospector}.yml")
   41:      content JSON.parse(configuration.to_json).to_yaml.lines.to_a[1..-1].join
   42:      notifies :restart, 'service[filebeat]' if node['filebeat']['notify_restart'] && !node['filebeat']['disable_service']
   43:    end
   44:  end
   45:
   46>> powershell 'install filebeat as service' do
   47:    code "& '#{node['filebeat']['windows']['base_dir']}/filebeat-#{node['filebeat']['version']}-windows/install-service-filebeat.ps1'"
   48:    only_if { node['platform'] == 'windows' }
   49:  end
@drenalin23
Copy link
Contributor

Confirmed that this broke for us too.

@vkhatri vkhatri self-assigned this Sep 4, 2016
@vkhatri vkhatri added the bug label Sep 4, 2016
@alappe
Copy link

alappe commented Sep 6, 2016

Yes, same here…

@seaniscold
Copy link

4.0.0 (2016-09-02)

Remove support for Windows XP, 2003, 2003 R2, and 2008
Remove the powershell provider that was only needed for Chef 10
Require a modern windows cookbook release
Consistently check platform_family in recipes
Use node.normal instead of node.set in specs
Switch ruby linting to cookstyle and the new rakefile
Rename the minimal recipe to test
Avoid deprecation warnings during specs and use doc output
Fix a long failing spec so we can get the tests green

@coderanger
Copy link

If I'm reading this code correctly, it should be using Chef's built-in powershell_script resource.

@eherot
Copy link
Contributor

eherot commented Sep 7, 2016

Not that I know much about it but I tend to agree with @coderanger. That being said, powershell_script was specifically dropped in favor of powershell per #9 and I'm not entirely clear on why.

@vkhatri
Copy link
Owner

vkhatri commented Sep 8, 2016

@coderanger Thanks! updated to use powershell_script.

@seaniscold It would be great if you could create different issues for the mentioned items?

Released v0.3.6.

@vkhatri vkhatri closed this as completed Sep 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants