Chef doesn’t “know” about P4. It would treat your config file as remote_file resource. If file doesn’t exist, your recipe needs to do a p4 sync to get the file.
Depending on the size of your Org, I would suggest starting with creating a limited p4 view for the user running the sync. Map the view to location of configs. Then just do a local p4 sync (or point to a network drive), and finally, load contents of the config file into a variable inside chef recipe. This would be done during the execution phase of Chef run.
The better way would be to convert config to a json format, and have your CD tool suck it up into chef server as a databag. That would allow you to grab configuration data during the compilation phase of the Chef run and make data available to all nodes in your environment.
Hope that helps.
From: Aniket Sharad [mailto:aniketsharad@gmail.com]
Sent: Friday, October 25, 2013 3:06 AM
To: chef@lists.opscode.com
Subject: [chef] Re: Re: Use chef to pull configuration from Perforce
Thanks Daniel!!!
Chef to pull files from Perforce, anyone?
On 24 October 2013 22:55, Daniel DeLeo dan@kallistec.com wrote:
On Thursday, October 24, 2013 at 7:30 AM, aniketsharad@gmail.com wrote:
Hi All
I am reaching out to open source community for suggestions around how Chef can
be used to pull configurations from Perforce.
I want to develop a coookbook that can be used to synchronize specified config
files from Perforce server; not getting where to start from.
Any suggestions/sample code community cookbooks would really help.
Thanks
Aniket Sharad
I haven’t heard of any existing code, but for reference there is a cookbook that implements a mercurial resource/provider along the lines of the git and svn ones that ship with chef.
--
Daniel DeLeo