Skip to content

Instantly share code, notes, and snippets.

@arangamani
Last active August 29, 2015 13:58
Show Gist options
  • Save arangamani/10312683 to your computer and use it in GitHub Desktop.
Save arangamani/10312683 to your computer and use it in GitHub Desktop.
Swapping repositories on RightScale ServerTemplate cookbooks
# 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