def _needs_update(self, after, before, after_props, before_props, prev_resource, check_init_complete=True): # Issue an update to the nested stack if the stack resource # is able to update. If return true, let the individual # resources in it decide if they need updating. # FIXME (ricolin): seems currently can not call super here if self.nested() is None and self.status == self.FAILED: raise exception.UpdateReplace(self) # If stack resource is in CHECK_FAILED state, raise UpdateReplace # to replace the failed stack. if self.state == (self.CHECK, self.FAILED): raise exception.UpdateReplace(self) if (check_init_complete and self.nested() is None and self.action == self.INIT and self.status == self.COMPLETE): raise exception.UpdateReplace(self) return True
def _needs_update(self, after, before, after_props, before_props, prev_resource, check_init_complete=True): if after_props.get(self.REPLACEMENT_POLICY) == 'REPLACE_ALWAYS': raise exception.UpdateReplace(self.name) if after_props != before_props: # Switching between name and ID is OK, provided the value resolves # to the same network. If the network changes, port is replaced. # Support NETWORK and NETWORK_ID, as switching between those is OK. before_id = self.client_plugin().find_neutron_resource( before_props, self.NETWORK, 'network') after_id = self.client_plugin().find_neutron_resource( after_props, self.NETWORK, 'network') if before_id != after_id: raise exception.UpdateReplace(self.name) return super(Port, self)._needs_update(after, before, after_props, before_props, prev_resource, check_init_complete)
def _needs_update(self, after, before, after_props, before_props, prev_resource, check_init_complete=True): result = super(ElasticIpAssociation, self)._needs_update( after, before, after_props, before_props, prev_resource, check_init_complete=check_init_complete) prop_diff = self.update_template_diff_properties( after_props, before_props) # according to aws doc, when update allocation_id or eip, # if you also change the InstanceId or NetworkInterfaceId, # should go to Replacement flow if self.ALLOCATION_ID in prop_diff or self.EIP in prop_diff: instance_id = prop_diff.get(self.INSTANCE_ID) ni_id = prop_diff.get(self.NETWORK_INTERFACE_ID) if instance_id or ni_id: raise exception.UpdateReplace(self.name) return result
def handle_update(self, json_snippet, tmpl_diff, prop_diff): # force delete and replace if not prop_diff: return if hasattr(HeatException, "UpdateReplace"): raise HeatException.UpdateReplace() else: # in older versions raise resource.UpdateReplace()
def _needs_update(self, after, before, after_props, before_props, prev_resource, check_init_complete=True): if after_props.get(self.REPLACEMENT_POLICY) == 'REPLACE_ALWAYS': raise exception.UpdateReplace(self.name) return super(Port, self)._needs_update( after, before, after_props, before_props, prev_resource, check_init_complete)
def _needs_update(self, after, before, after_props, before_props, prev_resource, check_init_complete=True): # If resource is in CHECK_FAILED state, raise UpdateReplace # to replace the failed stack. if self.state == (self.CHECK, self.FAILED): raise exception.UpdateReplace(self) # Always issue an update to the remote stack and let the individual # resources in it decide if they need updating. return True
def _needs_update(self, after, before, after_props, before_props, prev_resource, check_init_complete=True): if after_props.get(self.REPLACEMENT_POLICY) == 'REPLACE_ALWAYS': raise exception.UpdateReplace(self.name) # Switching between name and ID is OK, provided the value resolves # to the same network. If the network changes, the port is replaced. before_net = before_props.get(self.NETWORK) after_net = after_props.get(self.NETWORK) if None not in (before_net, after_net): before_id = self.client_plugin().find_resourceid_by_name_or_id( 'network', before_net) after_id = self.client_plugin().find_resourceid_by_name_or_id( 'network', after_net) if before_id != after_id: raise exception.UpdateReplace(self.name) return super(Port, self)._needs_update( after, before, after_props, before_props, prev_resource, check_init_complete)
def _needs_update(self, after, before, after_props, before_props, prev_resource, check_init_complete=True): result = super(LaunchConfiguration, self)._needs_update( after, before, after_props, before_props, prev_resource, check_init_complete=check_init_complete) tmpl_diff = self.update_template_diff(function.resolve(after), before) if 'Metadata' in tmpl_diff: raise exception.UpdateReplace(self.name) return result
def _needs_update(self, after, before, after_props, before_props, prev_resource, check_init_complete=True): result = super(TestResource, self)._needs_update( after, before, after_props, before_props, prev_resource, check_init_complete=check_init_complete) prop_diff = self.update_template_diff_properties(after_props, before_props) if self.UPDATE_REPLACE in prop_diff: update_replace = prop_diff.get(self.UPDATE_REPLACE) if update_replace: raise exception.UpdateReplace(self.name) return result
def update(self, after, before=None, prev_resource=None): raise exception.UpdateReplace(self.name)
def handle_update(self, json_snippet=None, tmpl_diff=None, prop_diff=None): for prop in prop_diff: if '!' in prop: raise exception.UpdateReplace(self.name) self.data_set(prop, prop_diff.get(prop), redact=False)
def handle_update(self, json_snippet, tmpl_diff, prop_diff): # force delete and replace if prop_diff: raise HeatException.UpdateReplace()