Skip to content

Instantly share code, notes, and snippets.

@andersonvom
Created May 9, 2014 15:50
Show Gist options
  • Save andersonvom/58124a0df2bfcd763a51 to your computer and use it in GitHub Desktop.
Save andersonvom/58124a0df2bfcd763a51 to your computer and use it in GitHub Desktop.
def no_none(props):
''' returns a dict with no None values'''
return {key: value
for key, value in props.iteritems()
if value is not None}
def handle_create(self):
properties = {
self.rs.nodes: self.nodes(),
self.rs.protocol: next(iter(self.protocols())),
self.rs.virtual_ips: [{"type": "PUBLIC"}],
self.rs.lb_port: next(iter(self.lb_ports())),
self.rs.connection_logging: self.conn_log(),
}
template = {
'heat_template_version': '2013-05-23',
'resources': {
'lb': {
'type': 'Rackspace::Cloud::LoadBalancer',
'properties': no_none(properties),
}
}
}
return self.create_with_template(
template_format.parse(json.dumps(template)), None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment