Last active
August 29, 2015 13:58
-
-
Save arangamani/10312683 to your computer and use it in GitHub Desktop.
Swapping repositories on RightScale ServerTemplate cookbooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This simlpe snippet explains how to swap the repository of all the cookbooks under | |
# a RightScale ServerTemplate | |
require 'right_api_client' | |
# Initialize the client with correct options. | |
client = RightApi::Client.new(options) | |
# Obtain the servertemplate resource where you want to swap the respository | |
st = client.server_templates.index(id: 123456) | |
# Obtain the source respository (what the servertemplate is currently using) | |
old_repo = client.repositories.index(id: 234567) | |
# Obtain the target respository (what the servertemplate should be switched to) | |
new_repo = client.repositories.index(id: 345678) | |
# Now swap the repository | |
st.show.swap_repository(source_repository_href: old_repo.href, target_repository_href: new_repo.href) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment