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
Merged

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

merged 1 commit into from Aug 20, 2018

Conversation

mattray
Copy link
Contributor

@mattray 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 a team August 13, 2018 13:12
@chris-rock
Copy link
Contributor

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

@mattray
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
Copy link
Contributor

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

…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
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.

Copy link
Contributor

@alexpop alexpop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, much appreciated guys!

@alexpop alexpop merged commit 7649622 into chef-boneyard:master Aug 20, 2018
jerryaldrichiii added a commit that referenced this pull request Feb 13, 2019
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
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
Copy link
Contributor Author

mattray commented Feb 19, 2019

alexpop pushed a commit that referenced this pull request Sep 18, 2019
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>
alexpop added a commit that referenced this pull request Sep 18, 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>

* Update readme to remove compliance example

Signed-off-by: Alex Pop <apop@chef.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants