Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Extending SaltStack

You're reading from   Extending SaltStack Build and write salt modules

Arrow left icon
Product type Paperback
Published in Mar 2016
Publisher Packt
ISBN-13 9781785888618
Length 240 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Joseph Hall Joseph Hall
Author Profile Icon Joseph Hall
Joseph Hall
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Starting with the Basics FREE CHAPTER 2. Writing Execution Modules 3. Extending Salt Configuration 4. Wrapping States Around Execution Modules 5. Rendering Data 6. Handling Return Data 7. Scripting with Runners 8. Adding External File Servers 9. Connecting to the Cloud 10. Monitoring with Beacons 11. Extending the Master A. Connecting Different Modules B. Contributing Code Upstream Index

Troubleshooting cloud modules

Cloud modules may seem daunting because there are so many components that are required to make a cohesive piece of code. But if you work on the module with bite-sized chunks, it will be a lot easier to handle.

Write avail_sizes() or avail_images() first

Whenever I write a new cloud module, the first thing I do is get some sample code working that makes a small query. Because images and sizes are critical to the creation of a VM, and because those calls tend to be very simple, they are usually the easiest to get working.

Once you have one of those functions working, break it out into a _query() function (if you didn't start that way) and a function that calls it. Then write another function that calls it. You may find yourself tweaking _query() for each of the first few functions, but then it will stabilize and require few, if any, changes.

Use shortcuts

I cannot tell you how many hours I have spent waiting for VMs to spin up, just to test one piece of code...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime