Skip to content

Commit

Permalink
allow the ability to cleanup previously configured local sources
Browse files Browse the repository at this point in the history
In some cases even if temporarily one may want to remove a source from being ingested into sumologic. In other cases it's cleaning up dead code for something that no longer generates logs in the environment.

Signed-off-by: Ben Abrams <[email protected]>
  • Loading branch information
majormoses committed Jan 24, 2022
1 parent e0e1a43 commit 605c3c6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ sumo_source_local_file
`default` = `:create`

- `:create` - creates a JSON Source configuration
- `:remove` - removes a previously configured JSON source configuration

### Attribute Parameters

Expand Down
6 changes: 6 additions & 0 deletions libraries/provider_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ def load_current_resource
end
end

action :remove do
file source_json_path do
action :delete
end
end

def api_version
'v1'
end
Expand Down
2 changes: 1 addition & 1 deletion libraries/resource_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SumoSource < Chef::Resource::LWRPBase

default_action :create

actions :create
actions :create, :remove

attribute :owner, regex: Chef::Config[:user_valid_regex]
attribute :group, regex: Chef::Config[:group_valid_regex]
Expand Down

0 comments on commit 605c3c6

Please sign in to comment.