Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not delete old app version "An operation for the service binding between app ** and service instance ** is in progress." #104

Open
atmcourse-1 opened this issue Jan 31, 2024 · 0 comments

Comments

@atmcourse-1
Copy link

Hello,
When I trying to cf blue-green-deploy --delete-old-apps -f manifest-dev.yml, this error popup.

Deleting app <app name> in org <org name> / space <space name> as <user>...
Could not delete old app version - Server error, status code: 502, error code: 150009, message: Deletion of app <app name-old> failed because one or more associated resources could not be deleted.

        An operation for the service binding between app <app name-old> and service instance <service binding> is in progress.

Here is the source code where the error raised:

// cloud_controller_ng/app/actions/mixins/bindings_delete.rb
def delete_bindings(bindings, user_audit_info:)
        type = nil
        binding_delete_action = nil

        bindings.each_with_object([]) do |binding, errors|
          type ||= DeleteServiceBindingFactory.type_of(binding)
          binding_delete_action ||= DeleteServiceBindingFactory.action(type, user_audit_info)

          result = binding_delete_action.delete(binding)
          unless result[:finished]
            polling_job = DeleteBindingJob.new(type, binding.guid, user_audit_info:)
            Jobs::Enqueuer.new(polling_job, queue: Jobs::Queues.generic).enqueue_pollable
            unbinding_operation_in_progress!(binding)
          end
        rescue StandardError => e
          errors << e
        end
end

// cloud_controller_ng/app/actions/app_delete.rb
def unbinding_operation_in_progress!(binding)
      raise AsyncBindingDeletionsTriggered.new(
        "An operation for the service binding between app #{binding.app.name} and service instance #{binding.service_instance.name} is in progress."
      )
end
// cf-blue-green-deploy/blue_green_deploy.go
func (p *BlueGreenDeploy) DeleteAppVersions(apps []plugin_models.GetAppsModel) {
	for _, app := range apps {
		if _, err := p.Connection.CliCommand("delete", app.Name, "-f", "-r"); err != nil {
			p.ErrorFunc("Could not delete old app version", err)
		}
	}
}

I think you should treat AsyncBindingDeletionsTriggered Error in a different way with others, cause this process is still on going. And this unbinding operation is successful on delay.

Thanks
Xuelong Bai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant