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

Add savedsearches.conf to managed files #245

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a83a171
Add savedsearches.conf to files we can manage
bsg-sfrazer Jul 18, 2019
d5c1645
Merge pull request #1 from bsg-sfrazer/master
bsg-sfrazer Jul 18, 2019
c0cafa8
Add savedsearches.conf to files we can manage
bsg-sfrazer Jul 18, 2019
8326121
Merge pull request #2 from bsg-sfrazer/master
bsg-sfrazer Jul 18, 2019
00d4730
Add savedsearches.conf to files we can manage
bsg-sfrazer Jul 18, 2019
2115666
Merge pull request #3 from bsg-sfrazer/master
bsg-sfrazer Jul 18, 2019
8b7f0b7
Add savedsearches.conf to files we can manage
bsg-sfrazer Jul 18, 2019
95e871a
Merge pull request #4 from bsg-sfrazer/master
bsg-sfrazer Jul 18, 2019
6ffaf6c
Add savedsearches.conf to files we can manage
bsg-sfrazer Jul 18, 2019
b7b0e19
Merge pull request #5 from bsg-sfrazer/master
bsg-sfrazer Jul 18, 2019
a594a66
Add savedsearches.conf to files we can manage
bsg-sfrazer Jul 18, 2019
5761a99
Merge pull request #6 from bsg-sfrazer/master
bsg-sfrazer Jul 18, 2019
20344f7
Add savedsearches.conf to files we can manage
bsg-sfrazer Jul 18, 2019
eea45d7
Merge pull request #7 from bsg-sfrazer/master
bsg-sfrazer Jul 18, 2019
2702436
Add savedsearches.conf to files we can manage
bsg-sfrazer Jul 18, 2019
f1e2a58
Merge pull request #8 from bsg-sfrazer/master
bsg-sfrazer Jul 18, 2019
5cc2f38
Make addons recognize a version string
bsg-sfrazer Oct 9, 2019
149395c
Merge pull request #9 from bsg-sfrazer/master
bsg-sfrazer Oct 9, 2019
f060ac7
Make installer create the versioning string
bsg-sfrazer Oct 11, 2019
10fb614
Merge pull request #10 from bsg-sfrazer/master
bsg-sfrazer Oct 11, 2019
398b8ab
Allow archiver to overwrite files, ensure the written files will be o…
bsg-sfrazer Oct 11, 2019
066f99d
Merge pull request #11 from bsg-sfrazer/master
bsg-sfrazer Oct 11, 2019
090584f
fix permissions on manifest
bsg-sfrazer Oct 11, 2019
7695cc1
Merge pull request #12 from bsg-sfrazer/master
bsg-sfrazer Oct 11, 2019
6456616
fix permissions on manifest
bsg-sfrazer Oct 11, 2019
246d663
Merge pull request #13 from bsg-sfrazer/master
bsg-sfrazer Oct 11, 2019
a970be0
fix permissions on manifest
bsg-sfrazer Oct 11, 2019
e8ca406
Merge pull request #14 from bsg-sfrazer/master
bsg-sfrazer Oct 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/puppet/provider/splunk_savedsearches/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Puppet::Type.type(:splunk_savedsearches).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
) do
def self.file_name
'savedsearches.conf'
end
end
3 changes: 3 additions & 0 deletions lib/puppet/type/splunk_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
:purge_limits,
:purge_metadata,
:purge_props,
:purge_savedsearches,
:purge_server,
:purge_serverclass,
:purge_transforms,
Expand Down Expand Up @@ -71,6 +72,7 @@ def generate
Puppet::Type::Splunk_indexes => self[:purge_indexes],
Puppet::Type::Splunk_metadata => self[:purge_metadata],
Puppet::Type::Splunk_props => self[:purge_props],
Puppet::Type::Splunk_savedsearches => self[:purge_savedsearches],
Puppet::Type::Splunk_server => self[:purge_server],
Puppet::Type::Splunk_serverclass => self[:purge_serverclass],
Puppet::Type::Splunk_transforms => self[:purge_transforms],
Expand Down Expand Up @@ -103,6 +105,7 @@ def set_provider_paths
:splunk_output,
:splunk_metadata,
:splunk_props,
:splunk_savedsearches,
:splunk_server,
:splunk_serverclass,
:splunk_transforms,
Expand Down
6 changes: 6 additions & 0 deletions lib/puppet/type/splunk_savedsearches.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunk_savedsearches) do
@doc = 'Manage splunk settings in savedsearches.conf'
PuppetX::Puppetlabs::Splunk::Type.clone_type(self)
end
26 changes: 24 additions & 2 deletions manifests/addon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#
define splunk::addon (
Optional[Stdlib::Absolutepath] $splunk_home = undef,
Optional[String[1]] $version = undef,
Boolean $package_manage = true,
Optional[String[1]] $splunkbase_source = undef,
Optional[String[1]] $package_name = undef,
Expand Down Expand Up @@ -70,6 +71,12 @@

if $package_manage {
if $splunkbase_source {

if $version {
$addon_creates = "${_splunk_home}/etc/apps/${name}/manifest-${version}"
} else {
$addon_creates = "${_splunk_home}/etc/apps/${name}"
}
$archive_name = $splunkbase_source.split('/')[-1]
archive { $name:
path => "${splunk::params::staging_dir}/${archive_name}",
Expand All @@ -78,9 +85,25 @@
source => $splunkbase_source,
extract => true,
extract_path => "${_splunk_home}/etc/apps",
creates => "${_splunk_home}/etc/apps/${name}",
creates => "${addon_creates}",
cleanup => true,
before => File["${_splunk_home}/etc/apps/${name}/local"],
} -> file { "${addon_creates}":
ensure => present,
owner => $owner,
group => $owner,
}
exec { "chown -R ${owner}:${owner} ${_splunk_home}/etc/apps/${name}":
subscribe => [
File["${addon_creates}"]
],
refreshonly => true,
}
exec { "chmod u+rw,g+rw -R ${_splunk_home}/etc/apps/${name}":
subscribe => [
File["${addon_creates}"]
],
refreshonly => true,
}
} else {
package { $package_name:
Expand Down Expand Up @@ -122,4 +145,3 @@
}
}
}

2 changes: 2 additions & 0 deletions manifests/enterprise.pp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
Boolean $purge_limits = false,
Boolean $purge_outputs = false,
Boolean $purge_props = false,
Boolean $purge_savedsearches = false,
Boolean $purge_server = false,
Boolean $purge_serverclass = false,
Boolean $purge_transforms = false,
Expand Down Expand Up @@ -259,6 +260,7 @@
purge_limits => $purge_limits,
purge_outputs => $purge_outputs,
purge_props => $purge_props,
purge_savedsearches => $purge_server,
purge_server => $purge_server,
purge_serverclass => $purge_serverclass,
purge_transforms => $purge_transforms,
Expand Down
2 changes: 2 additions & 0 deletions manifests/enterprise/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"${splunk::enterprise::enterprise_homedir}/etc/system/local/limits.conf",
"${splunk::enterprise::enterprise_homedir}/etc/system/local/outputs.conf",
"${splunk::enterprise::enterprise_homedir}/etc/system/local/props.conf",
"${splunk::enterprise::enterprise_homedir}/etc/system/local/savedsearches.conf",
"${splunk::enterprise::enterprise_homedir}/etc/system/local/server.conf",
"${splunk::enterprise::enterprise_homedir}/etc/system/local/serverclass.conf",
"${splunk::enterprise::enterprise_homedir}/etc/system/local/transforms.conf",
Expand Down Expand Up @@ -106,6 +107,7 @@
File <| tag == 'splunk_enterprise' |> -> Splunk_limits<||> ~> Class['splunk::enterprise::service']
File <| tag == 'splunk_enterprise' |> -> Splunk_output<||> ~> Class['splunk::enterprise::service']
File <| tag == 'splunk_enterprise' |> -> Splunk_props<||> ~> Class['splunk::enterprise::service']
File <| tag == 'splunk_enterprise' |> -> Splunk_savedsearches<||> ~> Class['splunk::enterprise::service']
File <| tag == 'splunk_enterprise' |> -> Splunk_server<||> ~> Class['splunk::enterprise::service']
File <| tag == 'splunk_enterprise' |> -> Splunk_serverclass<||> ~> Class['splunk::enterprise::service']
File <| tag == 'splunk_enterprise' |> -> Splunk_transforms<||> ~> Class['splunk::enterprise::service']
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-splunk",
"version": "7.3.1-rc0",
"version": "7.3.2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't update the version. We will handle this during the release process

"author": "Vox Pupuli",
"summary": "Manage and deploy Splunk servers and forwarders",
"license": "Apache-2.0",
Expand Down
1 change: 1 addition & 0 deletions spec/classes/enterprise_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
it { is_expected.to contain_file('/opt/splunk/etc/system/local/limits.conf') }
it { is_expected.to contain_file('/opt/splunk/etc/system/local/outputs.conf') }
it { is_expected.to contain_file('/opt/splunk/etc/system/local/props.conf') }
it { is_expected.to contain_file('/opt/splunk/etc/system/local/savedsearches.conf') }
it { is_expected.to contain_file('/opt/splunk/etc/system/local/server.conf') }
it { is_expected.to contain_file('/opt/splunk/etc/system/local/serverclass.conf') }
it { is_expected.to contain_file('/opt/splunk/etc/system/local/transforms.conf') }
Expand Down
1 change: 1 addition & 0 deletions spec/splunk_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
splunk_metadata: 'local.meta',
splunk_output: 'outputs.conf',
splunk_props: 'props.conf',
splunk_savedsearches: 'savedsearches.conf',
splunk_server: 'server.conf',
splunk_serverclass: 'serverclass.conf',
splunk_transforms: 'transforms.conf',
Expand Down