Skip to content

Instantly share code, notes, and snippets.

@raphink
Last active December 20, 2015 21:19
Show Gist options
  • Save raphink/6196548 to your computer and use it in GitHub Desktop.
Save raphink/6196548 to your computer and use it in GitHub Desktop.
Puppet::Type.type(:simpleline).provide(:augeas) do
desc "Uses Augeas API to update simple line conffiles"
include AugeasProviders::Provider
lens { 'Simplelines.lns' }
confine :feature => :augeas
resource_path do |resource|
condition = resource[:condition] ? resource[:condition] : resource[:value]
"$target/*[label() != '#comment' and . =~ regex('#{condition}')"
end
define_aug_method!(:create) do |aug, resource|
aug.set("$target/01", resource[:value])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment