Closed jlaba closed 10 months ago
Good question! You may not need both but it can be less error prone
duplicity::file
resource will ensure the directory is restored from backup when it is absentfile
resource is usally a good anchor for other resources (like service
) and helps to enforce permissionsThe biggest risk is that - without explicit relationship - the directory gets created before duplicity::file
has had a chance to run and hence prevents the restore from happening. Which in turn can result in the empty directory eventually corrupting the backup.
So what I typically have in my manifests is...
duplicity::file { $mailman3_data_dir:
timeout => 1800,
}
-> file { $mailman3_data_dir:
ensure => directory,
owner => 'list',
group => 'list',
mode => '0644',
}
What will happen, if it is the first run and there is no backup so far? (Or it is none available).
If duplicity::file
's ensure
is set to present
(the default), the directory is missing and there is no backup, the Puppet run will fail as the restore command will fail. This is to prevent silent corruption as mentioned earlier.
Great! It is working fine. May you add this section to the Readme, so that it is available at puppetforge directly?
Sure thing. I've updated the README with the example from above. Thanks for the suggestion!
I want to restore a directory (recursive) from backup, if it is not existing. Therefore I have defined this in my manifest:
But how am I dealing with the related
entry? Is it not needed at all? What will happen, if it is the first run and there is no backup so far? (Or it is none available).
How is the thinking in this situation? Most likely it is more a documentation lack, than a software issue.