juju remove-application --force fails when offers are available

Bug #1830292 reported by Tim McNamara
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Tim McNamara
2.6
Fix Released
High
Tim McNamara

Bug Description

When attempting to remove an application that has a consumer, Juju 2.6.2 generates the following message:

juju remove-application --force -m <saas-model> <app>
removing application <app> failed: cannot destroy application "<app>": state changing too quickly; try again soon

Without the --force option, we present a nicer message:

juju remove-application -m wiki-prod mariadb
removing application mariadb failed: cannot destroy application "mariadb": application is used by 1 offer

Steps to reproduce:

Step 1: set up models

juju add-model wiki-prod localhost
juju deploy mediawiki
juju deploy --to 0 mariadb
juju relate mediawiki:db mariadb:db
juju offer mariadb:db
juju expose mediawiki
juju add-model wiki-staging localhost
juju deploy mediawiki
juju consume wiki-prod.mariadb
juju consume wiki-prod.haproxy
juju relate mediawiki:db mariadb:db
juju expose mediawiki

Step 2: Attempt to remove model

juju remove-application --force -m wiki-prod mariadb

Changed in juju:
importance: High → Medium
Revision history for this message
Ian Booth (wallyworld) wrote :

The issue is a business logic error in making the asserts when --force is used.
But --force is not for this use case anyway. Applications with offers need to have the offers removed before the app can be deleted.

summary: - juju remove-application --force prints spurious output when live offer
- available
+ juju remove-application --force fails when offers are available
Changed in juju:
importance: Medium → High
Revision history for this message
Tim McNamara (tim-clicks) wrote : Re: [Bug 1830292] [NEW] juju remove-application --force prints spurious output when live offer available
Download full text (3.5 KiB)

So what you're saying Ian is that Juju is accidentally getting things right
here. It's not removing the application (great) but that's due to a failure
in our business logic, rather than because we've correctly identified that
the user attempting to sometime invalid (not great).

On Fri, 24 May 2019 at 11:15, Tim McNamara <email address hidden>
wrote:

> Public bug reported:
>
> When attempting to remove an application that has a consumer, Juju 2.6.2
> generates the following message:
>
> juju remove-application --force -m <saas-model> <app>
> removing application <app> failed: cannot destroy application "<app>":
> state changing too quickly; try again soon
>
> Without the --force option, we present a nicer message:
>
> juju remove-application -m wiki-prod mariadb
> removing application mariadb failed: cannot destroy application "mariadb":
> application is used by 1 offer
>
>
> Steps to reproduce:
>
> Step 1: set up models
>
> juju add-model wiki-prod localhost
> juju deploy mediawiki
> juju deploy --to 0 mariadb
> juju relate mediawiki:db mariadb:db
> juju offer mariadb:db
> juju expose mediawiki
> juju add-model wiki-staging localhost
> juju deploy mediawiki
> juju consume wiki-prod.mariadb
> juju consume wiki-prod.haproxy
> juju relate mediawiki:db mariadb:db
> juju expose mediawiki
>
> Step 2: Attempt to remove model
>
> juju remove-application --force -m wiki-prod mariadb
>
> ** Affects: juju
> Importance: Medium
> Assignee: Tim McNamara (tim-clicks)
> Status: Triaged
>
>
> ** Tags: force remove-application
>
> ** Changed in: juju
> Importance: High => Medium
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1830292
>
> Title:
> juju remove-application --force prints spurious output when live
> offer available
>
> Status in juju:
> Triaged
>
> Bug description:
> When attempting to remove an application that has a consumer, Juju
> 2.6.2 generates the following message:
>
> juju remove-application --force -m <saas-model> <app>
> removing application <app> failed: cannot destroy application "<app>":
> state changing too quickly; try again soon
>
> Without the --force option, we present a nicer message:
>
> juju remove-application -m wiki-prod mariadb
> removing application mariadb failed: cannot destroy application
> "mariadb": application is used by 1 offer
>
>
> Steps to reproduce:
>
> Step 1: set up models
>
> juju add-model wiki-prod localhost
> juju deploy mediawiki
> juju deploy --to 0 mariadb
> juju relate mediawiki:db mariadb:db
> juju offer mariadb:db
> juju expose mediawiki
> juju add-model wiki-staging localhost
> juju deploy mediawiki
> juju consume wiki-prod.mariadb
> juju consume wiki-prod.haproxy
> juju relate mediawiki:db mariadb:db
> juju expose mediawiki
>
> Step 2: Attempt to remove model
>
> juju remove-application --force -m wiki-prod mariadb
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/juju/+bug/1830292/+subscriptions
>
> Launchpad-Notification-Type: bug
> Launchpad-Bug: product=juju; milestone=2.6.3; status=Triaged;
> importance=M...

Read more...

Revision history for this message
Tim Penhey (thumper) wrote : Re: [Bug 1830292] Re: juju remove-application --force prints spurious output when live offer available

I disagree here.

If someone is saying to force remove an application, they want it gone.
If application offers need to be removed before the application can be
deleted, then the --force flag should also do this.

On 24/05/19 1:09 PM, Ian Booth wrote:
> The issue is a business logic error in making the asserts when --force is used.
> But --force is not for this use case anyway. Applications with offers need to have the offers removed before the app can be deleted.

Revision history for this message
Tim McNamara (tim-clicks) wrote :

The change to fix this bug has gone through code review is being merged here: https://github.com/juju/juju/pull/10227

Changed in juju:
status: Triaged → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
Revision history for this message
João Pedro Seara (jpseara) wrote :

Hello, all.

I got a little bit confused by the discussion in this post and the expected outcome for this fix.

I've created a test lab using JuJu controller 2.6.3, created two models (etcd, vault), and a simple relationacross those two models (vault offering the "certificates" interface).

Once I try to force remove the vault application, the following message still appears:

$ juju remove-application vault --force
removing application vault failed: cannot destroy application "vault": application is used by 1 offer

From what I've read of this bug, I was thinking that the supposed outcoming of this fix was that "--force" would actually deleting everything, including the pending relations.

Any clarifications would be good.

Thanks,
JP

Revision history for this message
Ian Booth (wallyworld) wrote :

The idea behind --force is that it is used to account for conditions outside of Juju's control. eg if there is a hook error for a unit, that would normally prevent the unit and by extension the application from being removed. Or if the cloud instance were stopped outside of Juju, the Juju machine could not be removed. --force is used to deal with these and other similar scenarios.

Currently, for applications with offers, you can first remove the offer and then the application can be removed. Maybe we can look to make remove-application --force more destructive but we need to balance this against the original intent of what --force was meant to solve.

Revision history for this message
João Pedro Seara (jpseara) wrote :

Thanks a lot for your feedback, Ian. OK, so I'll just assume this issue is fixed. Will open a new bug if such a request for a more destructive behavior comes from my side.

Revision history for this message
Anastasia (anastasia-macmood) wrote :

Bigger merge PR (https://github.com/juju/juju/pull/10326) brought this change into develop.

Changed in juju:
milestone: 2.6.3 → 2.7-beta1
status: Fix Released → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.