Skip to content

Commit

Permalink
Sensitive: Test on chef 12. Minor fix for the sensitive attribute (so…
Browse files Browse the repository at this point in the history
…us-chefs#111)

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

* Undo the .travis.yml modifications
  • Loading branch information
MarkGibbons committed Jul 19, 2018
1 parent d57f59b commit 9896c2e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
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
Expand Up @@ -12,6 +12,10 @@
* stanza - Set keys in a stanza
* substitute - Find line that matches a pattern, replace text that matches another pattern

## 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
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -19,7 +19,8 @@ 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 12 support is incomplete, some testing of version 2 has been done and the resources pass the integration tests. One known feature that does not work is the chef spec matchers. The matchers were removed because they are automatically generated in chef 13.
- Chef 12 support is incomplete, some testing of line version 2 has been done on chef 12 and the resources pass the integration tests. One known feature that does not work is the chef spec matchers. The matchers were removed because they are automatically generated in chef 13.
- PRs for chef 12 support will be considered.

# Usage

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

def sensitive_default
new_resource.sensitive = true unless property_is_set?(:sensitive)
rescue ArgumentError
# chef 12 raises ArgumentError checking property_is_set?
new_resource.sensitive = true
end

def target_current_lines
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Expand Up @@ -7,7 +7,7 @@
version '2.1.0'
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

0 comments on commit 9896c2e

Please sign in to comment.