Skip to content

Instantly share code, notes, and snippets.

@n1zyy
Created October 20, 2011 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n1zyy/1302062 to your computer and use it in GitHub Desktop.
Save n1zyy/1302062 to your computer and use it in GitHub Desktop.
Quick smoketest of aeolus-image-rubygem with Factory
require 'lib/aeolus_image.rb'
# You might want to start imagefactory like so:
# sudo imagefactory --rest --debug
# It must be run as root in order to build images.
# There's a --no_ssl flag if it aids in debugging, but don't use it for testing this patch, as it should work with SSL.
# The credentials are in /etc/imagefactory/imagefactory.conf but I use the default below:
# The purpose of my patch is to add OAuth support on top of the existing API, so any existing call should work.
# Note that Factory does *not* protect GETs with OAuth, only write operations.
Aeolus::Image::Factory::Base.config = {
:site => 'https://127.0.0.1:8075/imagefactory',
:consumer_key => 'mock-key',
:consumer_secret => 'mock-secret'}
# Quick check (this doesn't use OAuth, though)
# Just verify you get a response back; it doesn't much matter what it is
Aeolus::Image::Factory::Builder.all
# Let us build an image!
# You can grab an example template here if you don't already have one (for some reason):
# https://gist.github.com/1302055
template = IO.read("/home/mawagner/template.tpl")
targets = "ec2"
i = Aeolus::Image::Factory::Image.new(:targets => targets, :template => template)
# The save! is what actually triggers calls to Factory, so this line is the real test:
i.save!
# Fetch target images (not positive if this uses OAuth)
ti = i.build.target_images.first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment