pam node attribute namespace error #118

Closed
rljohnsn opened this Issue Jun 2, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@rljohnsn
Contributor

rljohnsn commented Jun 2, 2016

Missed an attribute in the name space merge.

action node['auth']['pam']['passwdqc']['enable'] ? :install : :remove

null: Recipe Compile Error in /tmp/packer-chef-solo/cookbooks-0/os-hardening/recipes/default.rb
    null: ================================================================================
    null:
    null: NoMethodError
    null: -------------
    null: undefined method `[]' for nil:NilClass
    null:
    null: Cookbook Trace:
    null: ---------------
    null: /tmp/packer-chef-solo/cookbooks-0/os-hardening/recipes/pam.rb:111:in `block in from_file'
    null: /tmp/packer-chef-solo/cookbooks-0/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_builder.rb:90:in `instance_eval'
    null: /tmp/packer-chef-solo/cookbooks-0/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_builder.rb:90:in `build'
    null: /tmp/packer-chef-solo/cookbooks-0/os-hardening/recipes/pam.rb:109:in `from_file'
    null: /tmp/packer-chef-solo/cookbooks-0/os-hardening/recipes/default.rb:26:in `from_file'
    null:
    null: Relevant File Content:
    null: ----------------------
    null: /tmp/packer-chef-solo/cookbooks-0/os-hardening/recipes/pam.rb:
    null:
    null: 104:      package 'pam-cracklib' do
    null: 105:        package_name node['os-hardening']['packages']['pam_cracklib']
    null: 106:        action node['os-hardening']['auth']['pam']['passwdqc']['enable'] ? :remove : :nothing
    null: 107:      end
    null: 108:
    null: 109:      package 'pam-passwdqc' do
    null: 110:        package_name node['os-hardening']['packages']['pam_passwdqc']
    null: 111>>       action node['auth']['pam']['passwdqc']['enable'] ? :install : :remove
    null: 112:      end
    null: 113:    else
    null: 114:      # In RH-family distros > 7, 'pam_pwquality' obsoletes both pam_cracklib and pam_passwdqc
    null: 115:      # See https://linux.web.cern.ch/linux/rhel/releasenotes/RELEASE-NOTES-7.0-x86_64/
    null: 116:      package 'pam_pwquality' do
    null: 117:        package_name node['os-hardening']['packages']['pam_pwquality']
    null: 118:      end
    null: 119:    end
    null: 120:
    null:
    null: [2016-06-01T16:23:42-07:00] ERROR: Running exception handlers
    null: [2016-06-01T16:23:42-07:00] ERROR: Exception handlers complete
    null: [2016-06-01T16:23:42-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
    null: [2016-06-01T16:23:42-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
    null: [2016-06-01T16:23:42-07:00] ERROR: undefined method `[]' for nil:NilClass
    null: [2016-06-01T16:23:42-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit cod
@rljohnsn

This comment has been minimized.

Show comment
Hide comment
@rljohnsn

rljohnsn Jun 2, 2016

Contributor

This started happening to us when our Berks config pulled in the latest from master
Berksfile

cookbook 'os-hardening', git: 'https://github.com/hardening-io/chef-os-hardening.git'

chef solo run via packer.io

Using os-hardening (2.0.0-beta) from https://github.com/hardening-io/chef-os-hardening.git (at master)

Our test-kitchen build was green when it was 1.3.1

Using os-hardening (1.3.1) from https://github.com/hardening-io/chef-os-hardening.git (at master)

We have resolved this internally by specifying the tag in Berksfile

cookbook 'os-hardening', git: 'https://github.com/hardening-io/chef-os-hardening.git', tag: "v1.3.1"
Contributor

rljohnsn commented Jun 2, 2016

This started happening to us when our Berks config pulled in the latest from master
Berksfile

cookbook 'os-hardening', git: 'https://github.com/hardening-io/chef-os-hardening.git'

chef solo run via packer.io

Using os-hardening (2.0.0-beta) from https://github.com/hardening-io/chef-os-hardening.git (at master)

Our test-kitchen build was green when it was 1.3.1

Using os-hardening (1.3.1) from https://github.com/hardening-io/chef-os-hardening.git (at master)

We have resolved this internally by specifying the tag in Berksfile

cookbook 'os-hardening', git: 'https://github.com/hardening-io/chef-os-hardening.git', tag: "v1.3.1"

@chris-rock chris-rock closed this in #119 Jun 2, 2016

rollbrettler pushed a commit to rollbrettler/chef-os-hardening that referenced this issue Sep 16, 2016

Merge pull request #118 from atomic111/master
change hardening-io to dev-sec domain for build status and code coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment