About | FAQ | Help
Ask Your Question

Revision history [back]

What is the best way to add files from S3? Type/provider, puppet code, or expand file resource?

Simple premise, difficult to figure out execution.. or at least that's how I feel.

I want to copy files down from S3, and I'd also like to be able to manage properties on those files such as mode, user and group. I've conceived of 3 approaches, and am not sure which is the most reasonable.

  1. Create a "type" in puppet code and stage it as a component module. Use an Exec resource to copy the file down from S3, then use a file resource to manage the properties of the file. Potential problem is the reuse of $title, so maybe the file has source=>/path/to/s3file, but then I'm stuck with 2 versions of the file to be idempotent with a creates=> on the exec.
  2. Create a type and provider set in Ruby. This sounded like a good idea, until I realized how good/complex the file type/posix provider was. I could heavily plagiarize to replicate the behavior, but it seems unwieldy. Bonus points for a param that distinguishes between s3 cp and s3 sync based on recursive.
  3. Extend the "source" param in Puppet's native file type/provider to understand how to handle s3:// URIs. This sounds the most appealing, were it not for having to host an alteration of a core type in Puppet. Obviously I'd be worried about maintaining my enhancement.

Any thoughts? Is there a better approach? Am I completely missing a nice way to fold existing type/provider data into new type/providers?