camptocamp / puppet-augeas_file

Manage a file in Puppet from a template and Augeas changes
Apache License 2.0
1 stars 0 forks source link

Make it work with augeas/augeasproviders #1

Closed raphink closed 9 years ago

raphink commented 9 years ago

Now that we have a working PoC, which is mono-resource and replaces augeas/augeasproviders, it would be better to be able to plug with them instead, something like this:

file { '/etc/foo.conf':
  ensure => file
  owner  => 'root',
  group  => 'root',
  mode   => '0644',
}

augeas_file { '/etc/foo.conf':
  base => '/usr/share/doc/foo/examples/foo.conf',
}

# Either this syntax
augeas { 'foo bar':
  context => '/files/etc/foo.conf':
  changes => 'set bar baz',
}

# Or this one
augeas { 'foo d':
  incl    => '/etc/foo.conf',
  lens    => 'Foo.lns',
  changes => 'set foo d',
}

# Will cause the augeas_file provider for the augeas resource type
# to take precedence of the native augeas provider
# and apply the changes all together using text_store/text_retrieve
# use the base from the corresponding augeas_file resource as base
mcanevet commented 9 years ago

@raphink what about a new provider for file type that inherits from posix provider instead of a new resource type? We could then use something like this:

file { '/etc/foo':
  ensure   => file,
  owner    => 'root',
  group    => 'root',
  mode     => '0644',
  source   => 'file:///usr/share/doc/foo/examples/foo.conf',
  provider => 'augeas',
}

# Either this syntax
augeas { 'foo bar':
  context => '/files/etc/foo.conf':
  changes => 'set bar baz',
}

# Or this one
augeas { 'foo d':
  incl    => '/etc/foo.conf',
  lens    => 'Foo.lns',
  changes => 'set foo d',
} 
raphink commented 9 years ago

Hijacking the file resource type is really kind of complex. For now, I prefer to keep that separated.

raphink commented 9 years ago

This feature has been implemented.