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! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
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 (21) Chapters Close

Extending SaltStack
Credits
Foreword
About the Author
About the Reviewer
www.PacktPub.com
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 Connecting Different Modules Contributing Code Upstream Index

Creating pull requests on GitHub


Whereas many project communities accept code only through mailing lists or complex websites, Salt has opted to stick with pull requests for accepting code contributions. A list of active pull requests can be found at:

https://github.com/saltstack/salt/pulls

The complete details of using Git are way beyond the scope of this book, but it is worth going over the steps to clone the Salt repository and put in a new pull request.

First, you will need your own fork of Salt on GitHub. If you don't have one yet, then use the Fork button at Salt's own GitHub page:

https://github.com/saltstack/salt

Assuming that your GitHub username is mygithubuser, your new fork will appear at:

https://github.com/mygithubuser/salt

Once you have a fork set up, you'll need to clone a copy to your computer. The following steps assume that you work in a command-line environment, such as Linux:

  1. If you have an SSH key set up, you can clone using SSH:

    $ git clone [email protected]:mygithubuser/salt.git
    

    Otherwise, you'll need to clone over HTTPS:

    $ git clone https://github.com/mygithubuser/salt.git
    
  2. You will also need to add the original SaltStack repository to your local clone, to be able to create pull requests:

    $ git remote add upstream https://github.com/saltstack/salt.git
    
  3. The default Git branch is develop. If you're adding a new feature to Salt, the work should be performed on a branch based on develop. To create a new branch called newfeature and switch to it, use:

    $ git checkout -b newfeature
    
  4. When you are ready to put in a pull request, it is best to rebase your branch to make sure it doesn't conflict with any other pull requests that have been merged since your last update:

    $ git checkout develop
    $ git fetch upstream
    $ git pull upstream develop
    $ git checkout newfeature
    $ git rebase develop
    

    Note

    For more information on using rebase, check out:

    https://help.github.com/articles/using-git-rebase/

  5. Once you have rebased, go ahead and push your branch up to GitHub:

    $ git push origin newfeature
    
  6. When you visit your fork on GitHub again, you will see a link that says New Pull Request. From there, you can look at the diff readout between your branch and the current version of the develop branch on GitHub, and create your pull request when you're satisfied with it.

As with issue submission, pull requests now also have a template to use as a guide to provide useful information about describing the changes that your pull request includes.

Using other branches

If you're submitting bug fixes, then it may be more appropriate to submit them against a branch that matches a specific version of Salt. If you know which version of Salt the bug was first found in, then use that branch. The exception would be if the branch in question is so old that it is no longer being maintained. If that is the case, then choose the oldest branch that is being maintained. For instance, if the oldest maintained version is 2015.8.x, then check out the 2015.8 branch:

$ git checkout 2015.8
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 $15.99/month. Cancel anytime
Visually different images