chef-client errors when unexpected files are in attributes/ directory

Created on 18 Jul 2017  路  7Comments  路  Source: chef/chef

Description

Chef runs into errors if there are attribute files which are encoded with blackbox.

Chef Version

chef_version=13.2.20

Platform Version

platform=ubuntu
platform_version=16.04
ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
program_name=chef-solo worker: ppid=16892;start=11:36:31;
executable=/opt/chef/bin/chef-solo

Replication Case

Create an attribute file alongside the default.rb file inside a cookbook:

$ touch cookbooks/acme-cookbook/attributes/default.rb.gpg

Then run bundle exec knife solo cook some-server to push it out to the node.

Client Output

Running Chef: sudo chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json
Starting Chef Client, version 13.2.20
resolving cookbooks for run list: ["ep-docker", "acme-cookbook", "ep-platform", "ep-users", "ep-monitoring"]
Synchronizing Cookbooks:
  - ep-platform (1.0.0)
  - acme-cookbook (0.1.0)
  - ep-docker (1.0.0)
  - ep-users (1.0.0)
  - ep-monitoring (1.0.0)
  - systemd (3.0.0)
  - compat_resource (12.19.0)
  - datadog (2.7.0)
  - chef_handler (1.4.0)
  - apt (6.1.2)
  - windows (3.1.1)
  - yum (5.0.1)
  - ohai (5.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...

================================================================================
Recipe Compile Error in /home/perlundberg/chef-solo/local-mode-cache/cache/cookbooks/acme-cookbook/attributes/default.rb.gpg
================================================================================

Chef::Exceptions::AttributeNotFound
-----------------------------------
could not find filename for attribute default.rb.gpg in cookbook acme-cookbook

System Info:
------------
chef_version=13.2.20
platform=ubuntu
platform_version=16.04
ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
program_name=chef-solo worker: ppid=16892;start=11:36:31;
executable=/opt/chef/bin/chef-solo


Running handlers:
[2017-07-18T11:36:35+02:00] ERROR: Running exception handlers
[2017-07-18T11:36:35+02:00] ERROR: Running exception handlers
Running handlers complete
[2017-07-18T11:36:35+02:00] ERROR: Exception handlers complete
[2017-07-18T11:36:35+02:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 03 seconds
[2017-07-18T11:36:35+02:00] FATAL: Stacktrace dumped to /home/perlundberg/chef-solo/local-mode-cache/cache/chef-stacktrace.out
[2017-07-18T11:36:35+02:00] FATAL: Stacktrace dumped to /home/perlundberg/chef-solo/local-mode-cache/cache/chef-stacktrace.out
[2017-07-18T11:36:35+02:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-07-18T11:36:35+02:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-07-18T11:36:35+02:00] ERROR: could not find filename for attribute default.rb.gpg in cookbook acme-cookbook
[2017-07-18T11:36:35+02:00] ERROR: could not find filename for attribute default.rb.gpg in cookbook acme-cookbook
[2017-07-18T11:36:35+02:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
[2017-07-18T11:36:35+02:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.

Stacktrace

Didn't receive any, but I'm quite sure this line is causing the problems.

/cc @qzio, @rallenecraft

Most helpful comment

This is also happening for me with vim .*.swp files..

All 7 comments

this looks like a feature request to support encrypting attributes files with blackbox? we're unlikely to take on that work, although community contributions would be welcome. the chef approach has typically been to use encrypted data bags or chef-vault rather than checking secrets into attribute files.

@lamont-granquist I think its a bug report about Chef blowing up if there is a .rb.gpg file in the attributes/ folder. Which is probably just something going wrong with our loading code, it should be entirely ignored.

@lamont-granquist I think its a bug report about Chef blowing up if there is a .rb.gpg file in the attributes/ folder.

Exactly. Chef doesn't need to support blackbox, it's fine to handle that manually via its scripts (blackbox_decrypt_all_files etc). But like you say:

Which is probably just something going wrong with our loading code, it should be entirely ignored.

...I think this is spot on.

@coderanger @lamont-granquist I presume nothing has happened to this issue lately?

This happens with any non ruby file found in the layout of a cookbook. Tried every stable version from 13.0.x to the latest. Happens in every one.

I found it having README.md files in following directories

  • attributes
  • libraries
  • resources
  • providers

Stack trace gist when the README.md was in "providers" directory

This is also happening for me with vim .*.swp files..

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings