tohuwabohu / puppet-duplicity

Puppet module to manage backups based on duplicity.
Apache License 2.0
8 stars 33 forks source link

add the ability to specify before/after script source/content in a pr… #21

Closed jlambert121 closed 8 years ago

jlambert121 commented 8 years ago

…ofile

tohuwabohu commented 8 years ago

I understand this part is not very well documented. However, you should be able to specify additional scripts via

duplicity::profile_exec_before { "system/script1":
    profile => 'system',
    content => template('path/to/my/script/snippet'),
}

in your manifest. The profile_exec_before resources relies on concat to form an extension point.

Would that work for you? Or otherwise could you please add a bit more context about this change. Thanks.

jlambert121 commented 8 years ago

I saw I could import content directly as the define to make that work, but that separates the profile that uses it from some of the information used by it. Because of the way profile is written as well #!/bin/bash will always be prepended before the pre script, even if it's perl or ruby. This allows the script used by the profile to be easily contained by the profile.

tohuwabohu commented 8 years ago

Right. If you want to replace the whole pre script then you're right. And of course the shebang get's into your way.

The way I'm using it right now is by

This allows my to add multiple scripts from various locations without having the merge them in a central place. And all of them get called before the duplicity backup.

Eg. this puppet manifest defines a resource to manage database backups. You pass it a database name and it includes it in the duplicity backup. Under the hood it just adds a call to the 'create-mysql-database-backup.sh' script to the pre script for every database I manage with the resource.

Either way - I'm happy to add this bit of flexibility to the module given it doesn't break compatibility. Can you please update the documentation about the parameters in the profile.pp file and for bonus points add a use case to the README file? Thanks heaps.

jlambert121 commented 8 years ago

Thanks! Added some documentation.

tohuwabohu commented 8 years ago

I've released version 3.6.0 to the forge. Thanks for the contribution.