Created
May 9, 2014 15:50
-
-
Save andersonvom/58124a0df2bfcd763a51 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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