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

Add support for node['audit']['profiles'] as a hash of hashes #328

Merged
merged 1 commit into from Aug 20, 2018

Conversation

Projects
None yet
4 participants
@mattray
Copy link
Contributor

mattray commented Aug 13, 2018

Policyfiles with includes do not allow merging arrays and it's a bit unclear why an array was chosen. This patch does not change the existing behavior, only supplements it.

Signed-off-by: Matt Ray matthewhray@gmail.com

@mattray mattray requested a review from chef-cookbooks/audit-cookbook-team as a code owner Aug 13, 2018

@chris-rock

This comment has been minimized.

Copy link
Contributor

chris-rock commented Aug 13, 2018

@mattray Great work. Should we update the docs to make the hash map the default now? I like the simpler style.

@mattray

This comment has been minimized.

Copy link
Contributor Author

mattray commented Aug 13, 2018

Glad you like it, definitely needed it for Policyfiles. We could add deprecation warnings for array-style usage for a few releases just so we don't blindside anyone.

@chris-rock

This comment has been minimized.

Copy link
Contributor

chris-rock commented Aug 13, 2018

I agree a deprecation warning would be great. I cannot recall why we went with arrays in the first place, but maps look very nice

Add support for node['audit']['profiles'] as a hash of hashes rather …
…than

an array of hashes. Policyfiles with includes do not allow merging arrays
and it's a bit unclear why an array was chosen. This patch does not
change the existing behavior, only supplements it.

Signed-off-by: Matt Ray <matthewhray@gmail.com>

@mattray mattray force-pushed the mattray:policyfile_support branch from 99bc672 to 5ccacec Aug 13, 2018

@mattray

This comment has been minimized.

Copy link
Contributor Author

mattray commented Aug 13, 2018

I've updated the PR with a deprecation warning.

       Running handlers:
       [2018-08-13T21:46:30+00:00] WARN: Use of a hash array for the node['audit']['profiles'] is deprecated. Please refer to the README and use a hash of hashes.
       [2018-08-13T21:46:30+00:00] WARN: Use of a hash array for the node['audit']['profiles'] is deprecated. Please refer to the README and use a hash of hashes.
@alexpop
Copy link
Contributor

alexpop left a comment

Looks great, much appreciated guys!

@alexpop alexpop merged commit 7649622 into chef-cookbooks:master Aug 20, 2018

2 checks passed

DCO This commit has a DCO Signed-off-by
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

jerryaldrichiii added a commit to jerryaldrichiii/jerryaldrichiii.github.io that referenced this pull request Feb 13, 2019

Remove Array of Hashes in Audit cookbook post
That method is deprecated:

  chef-cookbooks/audit#328

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

jerryaldrichiii added a commit to jerryaldrichiii/revealjs-chef-compliance-class-supplement that referenced this pull request Feb 13, 2019

Remove Array of Hashes example
See: chef-cookbooks/audit#328

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

jerryaldrichiii added a commit that referenced this pull request Feb 13, 2019

Remove deprecated examples using Array of Hashes
Due to #328 we must update
the README.md to remove references to the Array of Hashes syntax.

```ruby
default['audit']['profiles'] = []
default['audit']['profiles'].push(
  name: 'example',
  compliance: 'admin/example'
)
```

becomes

```ruby
default['audit']['profiles'] = {}
default['audit']['profiles']['example'] = {
  compliance: 'admin/example'
}
```

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
@jblaine

This comment has been minimized.

Copy link

jblaine commented Feb 13, 2019

Note #339 where hash of hashes, the new hotness being shown as the replacement for the other 2 methods... doesn't actually work.

@mattray

This comment has been minimized.

Copy link
Contributor Author

mattray commented Feb 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.