Skip to content

Commit

Permalink
Support chef 16 by setting provides on custom resources. Fixes #178. (
Browse files Browse the repository at this point in the history
#179)

This change maintains backwards compatibility with previous chef client versions.

https://github.com/chef/chef/blob/master/RELEASE_NOTES.md#whats-new-in-16244

Signed-off-by: Eric Millbrandt <[email protected]>
  • Loading branch information
emillbrandt authored May 7, 2021
1 parent 5850bb1 commit 35c06d3
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).

This CHANGELOG (now) follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
## [Unreleased]
### Changed
- Chef 16 support. HWRP-style resources now require either the use of `resource_name` or `provides`

### Fixed
- fixes an issue with the install action caused by a missing attribute

Expand Down
2 changes: 2 additions & 0 deletions libraries/resource_docker_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class Chef
class Resource
class SumoSourceDocker < Chef::Resource::SumoSource
provides :sumo_source_docker if respond_to?(:provides)

attribute :source_type, kind_of: Symbol, required: true, equal_to: %i[docker_stats docker_log]
attribute :uri, kind_of: String, required: true
attribute :specified_containers, kind_of: Array
Expand Down
2 changes: 2 additions & 0 deletions libraries/resource_graphite_metrics_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class Chef
class Resource
class SumoSourceGraphiteMetrics < Chef::Resource::SumoSource
provides :sumo_source_graphite_metrics if respond_to?(:provides)

attribute :source_type, kind_of: Symbol, default: :graphite, equal_to: [:graphite]
attribute :protocol, kind_of: String, default: 'TCP'
attribute :port, kind_of: Integer, default: 2003
Expand Down
2 changes: 2 additions & 0 deletions libraries/resource_local_file_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class Chef
class Resource
class SumoSourceLocalFile < Chef::Resource::SumoSource
provides :sumo_source_local_file if respond_to?(:provides)

attribute :source_type, kind_of: Symbol, default: :local_file, equal_to: [:local_file]
attribute :path_expression, kind_of: String, required: true
attribute :blacklist, kind_of: Array
Expand Down
2 changes: 2 additions & 0 deletions libraries/resource_local_win_event_log_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class Chef
class Resource
class SumoSourceLocalWindowsEventLog < Chef::Resource::SumoSource
provides :sumo_source_local_windows_event_log if respond_to?(:provides)

attribute :source_type, kind_of: Symbol, default: :local_windows_event_log, equal_to: [:local_windows_event_log]
attribute :log_names, kind_of: Array, required: true
end
Expand Down
2 changes: 2 additions & 0 deletions libraries/resource_remote_file_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class Chef
class Resource
class SumoSourceRemoteFile < Chef::Resource::SumoSource
provides :sumo_source_remote_file if respond_to?(:provides)

attribute :source_type, kind_of: Symbol, default: :remote_file, equal_to: [:remote_file]
attribute :remote_hosts, kind_of: Array, required: true
attribute :remote_port, kind_of: Integer, required: true
Expand Down
2 changes: 2 additions & 0 deletions libraries/resource_remote_win_event_log_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class Chef
class Resource
class SumoSourceRemoteWindowsEventLog < Chef::Resource::SumoSource
provides :sumo_source_remote_windows_event_log if respond_to?(:provides)

attribute :source_type, kind_of: Symbol, default: :remote_windows_event_log, equal_to: [:remote_windows_event_log]
attribute :domain, kind_of: String, required: true
attribute :username, kind_of: String, required: true
Expand Down
2 changes: 2 additions & 0 deletions libraries/resource_script_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class Chef
class Resource
class SumoSourceScript < Chef::Resource::SumoSource
provides :sumo_source_script if respond_to?(:provides)

attribute :source_type, kind_of: Symbol, default: :script, equal_to: [:script]
attribute :commands, kind_of: Array, required: true
attribute :file, kind_of: String
Expand Down
2 changes: 2 additions & 0 deletions libraries/resource_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class Chef
class Resource
class SumoSource < Chef::Resource::LWRPBase
provides :sumo_source if respond_to?(:provides)

default_action :create

actions :create
Expand Down
2 changes: 2 additions & 0 deletions libraries/resource_syslog_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class Chef
class Resource
class SumoSourceSyslog < Chef::Resource::SumoSource
provides :sumo_source_syslog if respond_to?(:provides)

attribute :source_type, kind_of: Symbol, default: :syslog, equal_to: [:syslog]
attribute :protocol, kind_of: String, default: 'UDP'
attribute :port, kind_of: Integer, default: 514
Expand Down

0 comments on commit 35c06d3

Please sign in to comment.