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

Refactor defined type Splunk::Addon #224

Merged
merged 4 commits into from
Apr 11, 2019

Conversation

ody
Copy link
Contributor

@ody ody commented Apr 10, 2019

Transitions the defined type Splunk::Addon to using the splunk*_input types instead of concat, supports installation from splunkbase provided archive, and valid for use on more than just forwarder nodes.

@ody ody force-pushed the refactor_addon_management branch from fbffdcc to 0c128b3 Compare April 10, 2019 22:56
ody and others added 2 commits April 10, 2019 16:43
	Transitions the defined type Splunk::Addon to using the
	splunk*_input types instead of concat, supports installation
	from splunkbase provided archive, and valid for use on more
	than just forwarder nodes.
	Commit introduces Puppet Strings documentation to the newly
	refactored defined type Splunk::Addon
@ody ody force-pushed the refactor_addon_management branch from 0c128b3 to 23c5d8d Compare April 10, 2019 23:44
	Minor tweak to supporting spec test to reflect the ability to
	install from splunkbase archives
@ody ody changed the title [WIP] Refactor defined type splunk::addon Refactor defined type Splunk::Addon Apr 11, 2019
	Commit adds defults to case statements with a fail message that
	should trigger if Class[splunk::enterprise] or
	Class[splunk::forwarder] are not declared that informs the use
	of the reason for the failure.
@bastelfreak bastelfreak added enhancement New feature or request and removed tests-fail labels Apr 11, 2019
@bastelfreak
Copy link
Member

Thanks!

@bastelfreak bastelfreak merged commit 820a15b into voxpupuli:master Apr 11, 2019
concat { "splunk::addon::inputs_${name}":
path => "${_splunk_home}/etc/apps/${name}/local/inputs.conf",
require => File["${_splunk_home}/etc/apps/${name}/local"],
unless $inputs.empty {
Copy link
Member

Choose a reason for hiding this comment

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

Why? Iterating an empty hash is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct. Just didn't realize. Tested just now and works fine without testing first

case $mode {
'forwarder': { $_splunk_home = $splunk::params::forwarder_homedir }
'enterprise': { $_splunk_home = $splunk::params::enterprise_homedir }
default: { fail('Instances of Splunk::Addon require the declaration of one of either Class[splunk::enterprise] or Class[splunk::forwarder]') }
Copy link
Member

Choose a reason for hiding this comment

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

This is unreachable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct and the reason I didn't originally add the default statement. Only added it to get it to pass lint checks. Not a bad thing to have, I suppose...?

If the manifest parses this far then something strange is happening an it'd be good to explicitly fail before damage is done.


if defined(Class['splunk::forwarder']) {
$mode = 'forwarder'
} else {
Copy link
Member

Choose a reason for hiding this comment

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

Is it worth checking that Class['splunk'] has been defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, splunk::enterprise then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wouldn't hurt.

Optional[String[1]] $package_name = undef,
Hash $inputs = {},
) {

include 'splunk::params'
include splunk::params
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn’t be necessary if it’s a requirement that one of splunk or splunk:forwarder has been included already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that should be correct. Didn't dawn me at the time.

ody added a commit to ody/puppet-splunk that referenced this pull request Apr 11, 2019
	Removes declaration of Class[splunk::params] since it should
	already be in scope and declared by either
	Class[splunk::enterprise] or Class[splunk::forwarder] and
	removes an unnecessary test of an empty hash. Modifies
	Splunk::Addon spec test to address the removal of
	Class[splunk::params].
ody added a commit to ody/puppet-splunk that referenced this pull request Apr 11, 2019
	Removes declaration of Class[splunk::params] since it should
	already be in scope and declared by either
	Class[splunk::enterprise] or Class[splunk::forwarder] and
	removes an unnecessary test of an empty hash. Modifies
	Splunk::Addon spec test to address the removal of
	Class[splunk::params].
ody added a commit to ody/puppet-splunk that referenced this pull request Apr 12, 2019
	Removes declaration of Class[splunk::params] since it should
	already be in scope and declared by either
	Class[splunk::enterprise] or Class[splunk::forwarder] and
	removes an unnecessary test of an empty hash. Modifies
	Splunk::Addon spec test to address the removal of
	Class[splunk::params].
ody added a commit to ody/puppet-splunk that referenced this pull request Apr 17, 2019
	Removes declaration of Class[splunk::params] since it should
	already be in scope and declared by either
	Class[splunk::enterprise] or Class[splunk::forwarder] and
	removes an unnecessary test of an empty hash. Modifies
	Splunk::Addon spec test to address the removal of
	Class[splunk::params].
ody added a commit to ody/puppet-splunk that referenced this pull request Apr 17, 2019
	Removes declaration of Class[splunk::params] since it should
	already be in scope and declared by either
	Class[splunk::enterprise] or Class[splunk::forwarder] and
	removes an unnecessary test of an empty hash. Modifies
	Splunk::Addon spec test to address the removal of
	Class[splunk::params].
ody added a commit to ody/puppet-splunk that referenced this pull request Apr 18, 2019
	Removes declaration of Class[splunk::params] since it should
	already be in scope and declared by either
	Class[splunk::enterprise] or Class[splunk::forwarder] and
	removes an unnecessary test of an empty hash. Modifies
	Splunk::Addon spec test to address the removal of
	Class[splunk::params].
alexjfisher added a commit that referenced this pull request Apr 30, 2019
Address post-merge comments on PR #224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants