Ask Your Question

Type/Provider for files from s3

asked 2016-03-22 18:22:56 -0600

DarylW gravatar image


I am trying to create a custom type/provider to handle pulling files down from s3, while utilizing the etag value to check if the file on disk matches what is in s3. Sometimes the ETag is the md5, but in the case of multipart uploads it is a different value (The md5 of each part, concat together and md5'd with a -#, where # is the number of parts).

I am poking around with an existing module malnic/puppet-s3, and have my fork of it here.

I have a question about some Types/Provider fundamentals. Is it possible to extend/subclass the existing file type/provider, and supply my own values?

e.g. what I would like to do is have the ability to detect if the source begins with s3://, and if so handle fetching the file, and otherwise let it behave like normal. I would like to pass the fetched file as a 'source' to the base file resource, and allow it to handle all of the other bits... ensure present/absent, setting file mode, owner, etc..

I also would like to know if there are ways to override the file resource to use something other than md5 for cataloging. If I was able to filebucket/catalog the file with the etag, or some combo of the md5 and the etag, I would be able to use that as a part of the 'exists?' method in ensurable.

Thanks in advance for your help. It would be really nice if a resource similar to what I'm describing would be made available in one of the puppet supported/approved gems, if not as a base type, or a modification of the built in file resource, but until then I get to play in types/provider land!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-22 20:07:17 -0600

I haven't done this before, but I think if you look at the docs here it shows you how to do this.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-03-22 18:22:56 -0600

Seen: 124 times

Last updated: Mar 22 '16