Pyrax Container Sync Update
Less data transfer.
- tags
- #Pyrax #Python #Rackspace #Cloud Files
- published
- reading time
- 1 minute
My initial draft of the cf_pyrax.py script used in my automation deleted all the contents of a Cloud Files container, and then re-uploaded this content. This process was inefficient and also caused issues loading the site while this process was running.
I have now updated this script to use the new sync_folder_to_container method from pyrax. This method was introduced to pyrax in this commit. Make sure you update your pyrax modules before using this new script.
pip install --upgrade pyrax
I identified this problem in Issue #4, and you can find the code changes in the following commits:
There is an interesting issue in pyrax where the default encoding doesn’t seem to be set if you aren’t using a pyrax.cfg. Make sure you leave the default encoding setting, or you will run into this problem as well.
You can download the new cf_pyrax.py and get started with this more efficient process.
Update: You might want to check out turbolift for your Cloud Files uploading needs. You can see usage in my circle.yml.