Skip to content

Instantly share code, notes, and snippets.

@timf
Created November 3, 2010 16:56
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 timf/661350 to your computer and use it in GitHub Desktop.
Save timf/661350 to your computer and use it in GitHub Desktop.
# Well known names, launch plan author needs to coordinate with these constants
from bootstrap.names import *
# This is called by the outer program, well known signature
def run_plan(confs, services, launcher, tester):
"""
@param confs Bag of anything the operator configures or overrides
@param services Service configurations from launch plan
@param launcher Will launch a service/node/epu
@param tester Will test a service/node/epu
@exception Exception If *anything* goes wrong.
"""
# Each of these could result in "None" if they are not in the launch plan
rabbit = services.get(SERVICE_RABBIT_MQ)
cass = services.get(SERVICE_CASSANDRA)
broker = services.get(SERVICE_CTX_BROKER)
##########################
# LEVEL 1: Prerequisites #
##########################
to_launch = [rabbit, cass, broker]
# If you pass launcher.launch a list with any "None" in it, the return
# tuple will match up with your input.
(rspec, cspec, bspec) = launcher.launch(to_launch, confs)
to_test = []
if rspec:
confs[IP_RABBIT_MQ] = rspec.ip
to_test.append(rspec)
if cspec:
confs[IP_CASSANDRA] = cspec.ip
to_test.append(cspec)
if bspec:
confs[IP_CTX_BROKER] = bspec.ip
to_test.append(bspec)
tester.test(to_test, confs)
########################
# LEVEL 2: Provisioner #
########################
provisioner = services.get(SERVICE_PROVISIONER)
pspec = launcher.launch([provisioner], confs)
tester.test([pspec], confs)
########################
# LEVEL 3: Controllers #
########################
# Returns ordered list of all the sublevels configured in the plan.
# Level 3 is itself broken up into a series of sublevels where someone
# can configure their own ordered stages of which EPUs to run and how
# to test proceeding.
alllevels = services.level3_sublevels()
for level in alllevels:
run_one_sublevel(level, confs, services, launcher, tester)
def run_one_sublevel(level, confs, services, launcher, tester):
to_run = []
for svc_name in level:
to_run.append(services.get(svc_name))
to_test = launcher.launch(to_run, confs)
tester.test(to_test, confs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment