'Re-generate the Metadata.
Save it to the db.
Rely on the cfn-hup to reconfigure HAProxy.'

def handle_update(self, json_snippet, tmpl_diff, prop_diff):

    new_props = json_snippet.properties(self.properties_schema, self.context)
    if ((self.INSTANCES in prop_diff) and ((self.properties[self.INSTANCES] is not None) or (new_props[self.INSTANCES] is not None))):
        cfg = self._haproxy_config(prop_diff[self.INSTANCES])
        md = self.nested()['LB_instance'].metadata_get()
        files = md['AWS::CloudFormation::Init']['config']['files']
        files['/etc/haproxy/haproxy.cfg']['content'] = cfg
        self.nested()['LB_instance'].metadata_set(md)
    if (self.SECURITY_GROUPS in prop_diff):
        templ = self.child_template()
        params = self.child_params()
        params['SecurityGroups'] = new_props[self.SECURITY_GROUPS]
        self.update_with_template(templ, params)
