-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from crayfishx/refactor
[REVIEW] [MODULES-3520] refactored types and providers and added purging
- Loading branch information
Showing
39 changed files
with
384 additions
and
584 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Puppet::Type.type(:ini_setting).provide( | ||
:splunk, | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
) do | ||
|
||
confine :true => false # Never automatically select this provider | ||
|
||
@file_path = nil | ||
|
||
def self.file_path | ||
raise Puppet::Error, "file_path must be set with splunk_config type before provider can be used" if @file_path.nil? | ||
raise Puppet::Error, "Child provider class does not support a file_name method" unless self.respond_to?(:file_name) | ||
File.join(@file_path, file_name) | ||
end | ||
|
||
def self.set_file_path(path) | ||
@file_path=path | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
Puppet::Type.type(:splunk_authentication).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
# hard code the file path (this allows purging) | ||
def self.file_path | ||
case Facter.value(:osfamily) | ||
when 'windows' | ||
'C:\Program Files\Splunk\etc\system\local\authentication.conf' | ||
else | ||
'/opt/splunk/etc/system/local/authentication.conf' | ||
end | ||
def self.file_name | ||
'system/local/authentication.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
Puppet::Type.type(:splunk_authorize).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
# hard code the file path (this allows purging) | ||
def self.file_path | ||
case Facter.value(:osfamily) | ||
when 'windows' | ||
'C:\Program Files\Splunk\etc\system\local\authorize.conf' | ||
else | ||
'/opt/splunk/etc/system/local/authorize.conf' | ||
end | ||
def self.file_name | ||
'system/local/authorize.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
Puppet::Type.type(:splunk_distsearch).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
# hard code the file path (this allows purging) | ||
def self.file_path | ||
case Facter.value(:osfamily) | ||
when 'windows' | ||
'C:\Program Files\Splunk\etc\system\local\distsearch.conf' | ||
else | ||
'/opt/splunk/etc/system/local/distsearch.conf' | ||
end | ||
def self.file_name | ||
'system/local/distsearch.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
Puppet::Type.type(:splunk_indexes).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
# hard code the file path (this allows purging) | ||
def self.file_path | ||
case Facter.value(:osfamily) | ||
when 'windows' | ||
'C:\Program Files\Splunk\etc\system\local\indexes.conf' | ||
else | ||
'/opt/splunk/etc/system/local/indexes.conf' | ||
end | ||
def self.file_name | ||
'system/local/indexes.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
Puppet::Type.type(:splunk_input).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
# hard code the file path (this allows purging) | ||
def self.file_path | ||
case Facter.value(:osfamily) | ||
when 'windows' | ||
'C:\Program Files\Splunk\etc\system\local\inputs.conf' | ||
else | ||
'/opt/splunk/etc/system/local/inputs.conf' | ||
end | ||
def self.file_name | ||
'system/local/inputs.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
Puppet::Type.type(:splunk_limits).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
# hard code the file path (this allows purging) | ||
def self.file_path | ||
case Facter.value(:osfamily) | ||
when 'windows' | ||
'C:\Program Files\Splunk\etc\system\local\limits.conf' | ||
else | ||
'/opt/splunk/etc/system/local/limits.conf' | ||
end | ||
def self.file_name | ||
'system/local/limits.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
Puppet::Type.type(:splunk_output).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
# hard code the file path (this allows purging) | ||
def self.file_path | ||
case Facter.value(:osfamily) | ||
when 'windows' | ||
'C:\Program Files\Splunk\etc\system\local\outputs.conf' | ||
else | ||
'/opt/splunk/etc/system/local/outputs.conf' | ||
end | ||
def self.file_name | ||
'system/local/outputs.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
Puppet::Type.type(:splunk_props).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
# hard code the file path (this allows purging) | ||
def self.file_path | ||
case Facter.value(:osfamily) | ||
when 'windows' | ||
'C:\Program Files\Splunk\etc\system\local\props.conf' | ||
else | ||
'/opt/splunk/etc/system/local/props.conf' | ||
end | ||
def self.file_name | ||
'system/local/props.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
Puppet::Type.type(:splunk_server).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
# hard code the file path (this allows purging) | ||
def self.file_path | ||
case Facter.value(:osfamily) | ||
when 'windows' | ||
'C:\Program Files\Splunk\etc\system\local\server.conf' | ||
else | ||
'/opt/splunk/etc/system/local/server.conf' | ||
end | ||
def self.file_name | ||
'system/local/server.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
Puppet::Type.type(:splunk_transforms).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
# hard code the file path (this allows purging) | ||
def self.file_path | ||
case Facter.value(:osfamily) | ||
when 'windows' | ||
'C:\Program Files\Splunk\etc\system\local\transforms.conf' | ||
else | ||
'/opt/splunk/etc/system/local/transforms.conf' | ||
end | ||
def self.file_name | ||
'system/local/transforms.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
Puppet::Type.type(:splunk_web).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
# hard code the file path (this allows purging) | ||
def self.file_path | ||
case Facter.value(:osfamily) | ||
when 'windows' | ||
'C:\Program Files\Splunk\etc\system\local\web.conf' | ||
else | ||
'/opt/splunk/etc/system/local/web.conf' | ||
end | ||
def self.file_name | ||
'system/local/web.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,8 @@ | ||
Puppet::Type.type(:splunkforwarder_input).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
|
||
def self.prefetch(resources) | ||
catalog = resources[resources.keys.first].catalog | ||
splunk_config = catalog.resources.find{|s| s.type == :splunk_config} | ||
confdir = splunk_config['forwarder_confdir'] || raise(Puppet::Error, 'Unknown splunk forwarder confdir') | ||
@file_path = File.join(confdir, 'inputs.conf') | ||
end | ||
|
||
def self.file_path | ||
@file_path | ||
def self.file_name | ||
'system/local/inputs.conf' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
Puppet::Type.type(:splunkforwarder_output).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
|
||
def self.prefetch(resources) | ||
catalog = resources[resources.keys.first].catalog | ||
splunk_config = catalog.resources.find{|s| s.type == :splunk_config} | ||
confdir = splunk_config['forwarder_confdir'] || raise(Puppet::Error, 'Unknown splunk forwarder confdir') | ||
@file_path = File.join(confdir, 'outputs.conf') | ||
end | ||
|
||
def self.file_path | ||
@file_path | ||
def self.file_name | ||
"system/local/outputs.conf" | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,8 @@ | ||
Puppet::Type.type(:splunkforwarder_props).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
|
||
def self.prefetch(resources) | ||
catalog = resources[resources.keys.first].catalog | ||
splunk_config = catalog.resources.find{|s| s.type == :splunk_config} | ||
confdir = splunk_config['forwarder_confdir'] || raise(Puppet::Error, 'Unknown splunk forwarder confdir') | ||
@file_path = File.join(confdir, 'props.conf') | ||
end | ||
|
||
def self.file_path | ||
@file_path | ||
def self.file_name | ||
'system/local/props.conf' | ||
end | ||
end |
15 changes: 3 additions & 12 deletions
15
lib/puppet/provider/splunkforwarder_transforms/ini_setting.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,8 @@ | ||
Puppet::Type.type(:splunkforwarder_transforms).provide( | ||
:ini_setting, | ||
# set ini_setting as the parent provider | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
:parent => Puppet::Type.type(:ini_setting).provider(:splunk) | ||
) do | ||
|
||
def self.prefetch(resources) | ||
catalog = resources[resources.keys.first].catalog | ||
splunk_config = catalog.resources.find{|s| s.type == :splunk_config} | ||
confdir = splunk_config['forwarder_confdir'] || raise(Puppet::Error, 'Unknown splunk forwarder confdir') | ||
@file_path = File.join(confdir, 'transforms.conf') | ||
end | ||
|
||
def self.file_path | ||
@file_path | ||
def self.file_name | ||
'system/local/transforms.conf' | ||
end | ||
end |
Oops, something went wrong.