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

cookbook in master fails to converge #108

Closed
alexpop opened this Issue Oct 14, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@alexpop
Collaborator

alexpop commented Oct 14, 2016

Cookbook version

master

Chef-client version

12.14.89

Platform Details

CentOS 6.6, kitchen vagrant
InSpec 1.2.0

Scenario:

Trying to converge using collector: 'chef-compliance'

Steps to Reproduce:

Point Berkshelf to master:

cookbook 'audit', github: 'chef-cookbooks/audit'

Expected Result:

Successful converge

Actual Result:

Failed converge

       Recipe: audit::default
         * audit_token[Compliance Token] action create[2016-10-14T09:50:54+00:00] INFO: Processing audit_token[Compliance Token] action create (audit::default line 30)
       [2016-10-14T09:50:54+00:00] INFO: Using refresh_token to exchange for an access token.

           - compliance server auth token setup
         * directory[/tmp/kitchen/cache/compliance] action create[2016-10-14T09:50:54+00:00] INFO: Processing directory[/tmp/kitchen/cache/compliance] action create (audit::default line 48)
       [2016-10-14T09:50:54+00:00] INFO: directory[/tmp/kitchen/cache/compliance] created directory /tmp/kitchen/cache/compliance

           - create new directory /tmp/kitchen/cache/compliance
           - restore selinux security context
         * file[/tmp/kitchen/cache/compliance/ssh] action nothing[2016-10-14T09:50:54+00:00] INFO: Processing file[/tmp/kitchen/cache/compliance/ssh] action nothing (audit::default line 66)
        (skipped due to action :nothing)
         * audit_profile[ssh] action fetch[2016-10-14T09:50:54+00:00] INFO: Processing audit_profile[ssh] action fetch (audit::default line 71)

           - load required inspec modules
           * directory[/tmp/kitchen/cache/compliance] action create[2016-10-14T09:50:54+00:00] INFO: Processing directory[/tmp/kitchen/cache/compliance] action create (/tmp/kitchen/cache/cookbooks/audit/resources/profile.rb line 41)
        (up to date)
           - create cache directory[2016-10-14T09:50:54+00:00] INFO: Fetch compliance profile base/ssh
       [2016-10-14T09:50:54+00:00] INFO: Load profile from: https://ap-cc6.opschef.tv/api/owners/base/compliance/ssh/tar

           - fetch compliance profile
           * directory[/tmp/kitchen/cache/compliance] action create[2016-10-14T09:50:54+00:00] INFO: Processing directory[/tmp/kitchen/cache/compliance] action create (/tmp/kitchen/cache/cookbooks/audit/resources/profile.rb line 41)
        (up to date)

       [2016-10-14T09:50:54+00:00] INFO: audit_profile[ssh] sending touch action to file[/tmp/kitchen/cache/compliance/ssh] (immediate)
         * file[/tmp/kitchen/cache/compliance/ssh] action touch[2016-10-14T09:50:54+00:00] INFO: Processing file[/tmp/kitchen/cache/compliance/ssh] action touch (audit::default line 66)
       [2016-10-14T09:50:54+00:00] INFO: file[/tmp/kitchen/cache/compliance/ssh] created file /tmp/kitchen/cache/compliance/ssh

           - create new file /tmp/kitchen/cache/compliance/ssh
           - restore selinux security context[2016-10-14T09:50:54+00:00] INFO: file[/tmp/kitchen/cache/compliance/ssh] updated atime and mtime to 2016-10-14 09:50:54 +0000

           - update utime on file /tmp/kitchen/cache/compliance/ssh
         * audit_profile[ssh] action execute[2016-10-14T09:50:54+00:00] INFO: Processing audit_profile[ssh] action execute (audit::default line 71)

           - load required inspec modules
           * directory[/tmp/kitchen/cache/compliance] action create[2016-10-14T09:50:54+00:00] INFO: Processing directory[/tmp/kitchen/cache/compliance] action create (/tmp/kitchen/cache/cookbooks/audit/resources/profile.rb line 103)
        (up to date)
           - create/verify cache directory[2016-10-14T09:50:54+00:00] INFO: Executing: /tmp/kitchen/cache/compliance/base_ssh.tgz

           - execute compliance profile
           * directory[/tmp/kitchen/cache/compliance] action create[2016-10-14T09:50:55+00:00] INFO: Processing directory[/tmp/kitchen/cache/compliance] action create (/tmp/kitchen/cache/cookbooks/audit/resources/profile.rb line 103)
        (up to date)
           * file[/tmp/kitchen/cache/compliance/base_ssh_report.json] action create[2016-10-14T09:50:55+00:00] INFO: Processing file[/tmp/kitchen/cache/compliance/base_ssh_report.json] action create (/tmp/kitchen/cache/cookbooks/audit/resources/profile.rb line 131)
       [2016-10-14T09:50:55+00:00] INFO: file[/tmp/kitchen/cache/compliance/base_ssh_report.json] created file /tmp/kitchen/cache/compliance/base_ssh_report.json

             - create new file /tmp/kitchen/cache/compliance/base_ssh_report.json[2016-10-14T09:50:55+00:00] INFO: file[/tmp/kitchen/cache/compliance/base_ssh_report.json] updated file contents /tmp/kitchen/cache/compliance/base_ssh_report.json

             - update content in file /tmp/kitchen/cache/compliance/base_ssh_report.json from none to 4fa098
             - suppressed sensitive resource
             - restore selinux security context

       [2016-10-14T09:50:55+00:00] INFO: audit_profile[ssh] sending touch action to file[/tmp/kitchen/cache/compliance/ssh] (immediate)
         * file[/tmp/kitchen/cache/compliance/ssh] action touch[2016-10-14T09:50:55+00:00] INFO: Processing file[/tmp/kitchen/cache/compliance/ssh] action touch (audit::default line 66)
       [2016-10-14T09:50:55+00:00] INFO: file[/tmp/kitchen/cache/compliance/ssh] updated atime and mtime to 2016-10-14 09:50:55 +0000

           - update utime on file /tmp/kitchen/cache/compliance/ssh
         * audit_report[chef-compliance] action execute[2016-10-14T09:50:55+00:00] INFO: Processing audit_report[chef-compliance] action execute (audit::default line 84)


           ================================================================================
           Error executing action `execute` on resource 'audit_report[chef-compliance]'
           ================================================================================

           NameError
           ---------
           uninitialized constant Custom resource audit_report from cookbook audit::ComplianceProfile

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/audit/resources/report.rb:93:in `block in profiles'
           /tmp/kitchen/cache/cookbooks/audit/resources/report.rb:92:in `profiles'
           /tmp/kitchen/cache/cookbooks/audit/resources/report.rb:24:in `block (2 levels) in class_from_file'
           /tmp/kitchen/cache/cookbooks/audit/resources/report.rb:23:in `block in class_from_file'

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/audit/recipes/default.rb

            84: compliance_report report_collector do
            85:   owner node['audit']['owner']
            86:   server server
            87:   collector report_collector
            88:   quiet node['audit']['quiet'] unless node['audit']['quiet'].nil?
            89:   action :execute
            90: end if node['audit']['profiles'].values.any?

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/audit/recipes/default.rb:84:in `from_file'

           audit_report("chef-compliance") do
             action [:execute]
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             declared_type :compliance_report
             cookbook_name "audit"
             recipe_name "default"
             owner "admin"
             server "https://ap-cc6.opschef.tv/api/"
             collector "chef-compliance"
             quiet true
           end

           Platform:
           ---------
           x86_64-linux

       [2016-10-14T09:50:55+00:00] INFO: Running queued delayed notifications before re-raising exception

       Running handlers:
       [2016-10-14T09:50:55+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2016-10-14T09:50:55+00:00] ERROR: Exception handlers complete
       Chef Client failed. 9 resources updated in 11 seconds
       [2016-10-14T09:50:55+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2016-10-14T09:50:55+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2016-10-14T09:50:55+00:00] ERROR: audit_report[chef-compliance] (audit::default line 84) had an error: NameError: uninitialized constant Custom resource audit_report from cookbook audit::ComplianceProfile
       [2016-10-14T09:50:55+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
@alexpop

This comment has been minimized.

Collaborator

alexpop commented Oct 14, 2016

Most likely introduced by this refactor: #107

alexpop added a commit that referenced this issue Oct 14, 2016

Fix resource_collection profiles selector. Fixes #108
Signed-off-by: Alex Pop <apop@chef.io>

@binamov binamov added the in progress label Oct 14, 2016

@binamov binamov removed the in progress label Oct 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment