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

Sensitive: Test on chef 12. Minor fix for the sensitive attribute #111

Merged
merged 4 commits into from Jun 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions .travis.yml
Expand Up @@ -16,13 +16,12 @@ branches:
services: docker

env:
- INSTANCE=delete-from-list-centos-7
- INSTANCE=delete-from-list-centos-7
- INSTANCE=delete-from-list-ubuntu-1604
- INSTANCE=add-to-list-centos-7
- INSTANCE=add-to-list-ubuntu-1604
- INSTANCE=append-if-no-line-centos-7
- INSTANCE=append-if-no-line-ubuntu-1604
- INSTANCE=delete-from-list-centos-7
- INSTANCE=delete-from-list-ubuntu-1604
- INSTANCE=delete-lines-centos-7
- INSTANCE=delete-lines-ubuntu-1604
- INSTANCE=replace-or-add-centos-7
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# line Cookbook CHANGELOG

## v2.0.1 (2018-06-01)

- Tested on chef 12.13.37. Fix error caused by using the sensitive attribute. Sensitive true will always be used for chef 12.

## v2.0.0 (2018-05-19)

- _Breaking change_ - Files are processed in memory instead of line by line. It's possible that large files that were previously updated by the line cookbook will not be able to be processed.
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -19,6 +19,7 @@ Quite often, the need arises to do line editing instead of managing an entire fi
- `delete_from_list` do nothing, the list was not found which implies there is nothing to delete
- `delete_lines` do nothing, the line isn't there which implies there is nothing to delete
- `replace_or_add` create file, add the line
- Chef client version 13 or greater is expected. Some limited testing on Chef client 12 has been done and the cookbook seems to work. PRs for chef 12 support will be considered.

# Usage

Expand Down
3 changes: 3 additions & 0 deletions libraries/helper.rb
Expand Up @@ -11,6 +11,9 @@ def raise_not_found

def sensitive_default
new_resource.sensitive = true unless property_is_set?(:sensitive)

This comment was marked as outdated.

This comment was marked as outdated.

rescue ArgumentError
# chef 12 raises ArgumentError checking property_is_set?
new_resource.sensitive = true
end

def target_current_lines
Expand Down
4 changes: 2 additions & 2 deletions metadata.rb
Expand Up @@ -4,10 +4,10 @@
license 'Apache-2.0'
description 'Provides line editing resources for use by recipes'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.0.0'
version '2.0.1'
source_url 'https://github.com/sous-chefs/line-cookbook'
issues_url 'https://github.com/sous-chefs/line-cookbook/issues'
chef_version '>= 13'
chef_version '>= 12.13.37'

%w(debian ubuntu centos redhat scientific oracle amazon windows).each do |os|
supports os
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/cookbooks/test/recipes/delete_lines.rb
Expand Up @@ -40,22 +40,22 @@

# regexp tests

delete_lines 'Operation 5' do
delete_lines 'Operation 5 regexp' do
path '/tmp/dangerfile1-regexp'
pattern /^HI.*/
end

delete_lines 'Operation 6' do
delete_lines 'Operation 6 regexp' do
path '/tmp/dangerfile1-regexp'
pattern /^#.*/
end

delete_lines 'Operation 7' do
delete_lines 'Operation 7 regexp' do
path '/tmp/dangerfile1-regexp'
pattern /^#.*/
end

delete_lines 'Operation 8' do
delete_lines 'Operation 8 regexp' do
path '/tmp/dangerfile2-regexp'
pattern /^#.*/
end
Expand Down