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

attributes not being pulled into control #293

Closed
crashdummymch opened this Issue Nov 9, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@crashdummymch

crashdummymch commented Nov 9, 2017

Cookbook version

[Version of the cookbook where you are encountering the issue]
3.1.0

Chef-client version

[Version of chef-client in your environment]
Chef: 12.21.20

Platform Details

[Operating system distribution and release version. Cloud provider if running in the cloud]
centos 7.4 aws

Scenario:

[What you are trying to achieve and you can't?]
set inspec control attribute.

Steps to Reproduce:

[If you are filing an issue what are the things we need to do in order to repro your problem? How are you using this cookbook or any resources it includes?]
wrapper cookbook sets:
node.normal['audit']['attributes']['conf_data_collector_server_url'] = 'http://mytest.com'

control:
conf_data_collector_server_url = attribute(
'conf_data_collector_server_url',
description: 'automate data collector server url',
default: ''
)
control 'chef client conf - clientrb' do
title 'chef client configuration contains minimum configuration for automate'
describe file(conf_clientrb) do
its('content') { should match /data_collector.server_url "#{conf_data_collector_server_url}"/ }
end
end

Expected Result:

[What are you expecting to happen as the consequence of above reproduction steps?]
should match /data_collector.server_url "https://mytest.com"/

Actual Result:

[What actually happens after the reproduction steps? Include the error output or a link to a gist if possible.]

  File /etc/chef/client.rb content should match /data_collector.server_url ""/

This same profile does work in test kitchen audit and setting:
.kitchen.yml
name: inspec
inspec_tests:
- name: chef_client_automate
git: https://myurl
attributes:
conf_data_collector_server_url: 'https://mytest.com'

@adamleff

This comment has been minimized.

Collaborator

adamleff commented Nov 13, 2017

@crashdummymch version 3.x of the audit cookbook does not possess the ability to pass/receive InSpec attributes. I strongly recommend updating to the latest versions. Thanks!

@adamleff adamleff closed this Nov 13, 2017

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