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

New Custom Type For Managing .meta files #176

Merged
merged 1 commit into from
Jun 14, 2018
Merged

New Custom Type For Managing .meta files #176

merged 1 commit into from
Jun 14, 2018

Conversation

michaelweiser
Copy link
Contributor

@michaelweiser michaelweiser commented Mar 27, 2018

This change enables the module to manage default.meta and local.meta
files in splunk system and app contexts. This allows to deploy access
control and export settings.

The patch introduces a new type splunk_metadata which behaves similar to
the other types and has the same interface. Internally however it
redirects to the metadata directory of the system or app contexts and
manages the files default.meta or local.meta respectively.

Example:

splunk_metadata { 'app foo system export':
  section => '',
  setting => 'export',
  value   => 'system',
  context => 'app/foo/default',
  # -> $SPLUNK_HOME/etc/app/foo/metadata/default.meta
}

splunk_metadata { 'system access':
  section => '',
  setting => 'access',
  value   => 'read : [ me ], write : [ admin ]',
  # context default system local
  # -> $SPLUNK_HOME/etc/system/metadata/local.meta
}

Metadata files regularly have a section with an empty name ([])
containing the app access permissions. Since Puppet's IniFile class does
not support this directly, the provider subclasses
Puppet::Util::IniFile::Section and Puppet::Util::IniFile to add the
necessary functionality.

Additionally, the context parameter is made a namevar so that multiple
sections and settings with the same name can exist in different
contexts.

@bastelfreak
Copy link
Member

Hi @michaelweiser, thanks for the PR! Can you take a look at the failing spec tests?

@michaelweiser
Copy link
Contributor Author

I think those are related to the staged_package problem you addressed in #179. They were happening with unmodified puppet-splunk when running the testsuite locally as well. I do not think they're related to my changes.

@bastelfreak
Copy link
Member

@michaelweiser yes correct, I just noticed this too. We're currently working on a fix in #179. Please feel free to take a look.

This change enables the module to manage default.meta and local.meta
files in splunk system and app contexts. This allows to deploy access
control and export settings.

The patch introduces a new type splunk_metadata which behaves similar to
the other types and has the same interface. Internally however it
redirects to the metadata directory of the system or app contexts and
manages the files default.meta or local.meta respectively.

Example:

splunk_metadata { 'app foo system export':
  section => '',
  setting => 'export',
  value   => 'system',
  context => 'app/foo/default',
  # -> $SPLUNK_HOME/etc/app/foo/metadata/default.meta
}

splunk_metadata { 'system access':
  section => '',
  setting => 'access',
  value   => 'read : [ me ], write : [ admin ]',
  # context default system local
  # -> $SPLUNK_HOME/etc/system/metadata/local.meta
}

Metadata files regularly have a section with an empty name ([])
containing the app access permissions. Since Puppet's IniFile class does
not support this directly, the provider subclasses
Puppet::Util::IniFile::Section and Puppet::Util::IniFile to add the
necessary functionality.

Additionally, the context parameter is made a namevar so that multiple
sections and settings with the same name can exist in different
contexts.
@michaelweiser
Copy link
Contributor Author

With #179 fixed the tests now succeed.

@TraGicCode TraGicCode changed the title Allow to configure .meta files New Custom Type For Managing .meta files Apr 9, 2018
@bastelfreak bastelfreak merged commit c532709 into voxpupuli:master Jun 14, 2018
@bastelfreak bastelfreak added the enhancement New feature or request label Jun 14, 2018
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