state: prevent `using unknown collection "remoteApplications"` error #7352

Merged
merged 2 commits into from May 17, 2017

Conversation

Projects
None yet
3 participants
Member

babbageclunk commented May 17, 2017

Description of change

The state/applicationByName function would always try to get a remote application, and if that wasn't found would get an application instead. Change this to try returning a local application first (this will generally be the right thing), then if that's not found and the cross model flag is set try getting a remote application instead.

If neither are found, we still return the error application "needle" not found. This is less confusing for the user, since it's probably what they were intending, and remote applications are also (conceptually) applications so it's not wrong in that case either.

QA steps

  • Bootstrap a controller with the crossmodel flag disabled.
  • Deploy some applications and relate them.
  • Check that the log contains no messages containing unknown collection "remoteApplications"

babbageclunk added some commits May 17, 2017

Don't query remoteApplications without CMR flag
Controllers bootstrapped without the crossmodel feature flag enabled
would occasionally log `using unknown collection
"remoteApplications". This is because the remoteApplications collection
isn't created in that case, and state/applicationByName was querying it.

Update applicationByName to check st.Application first, and only fall back
to trying st.RemoteApplication if the flag is on.
Member

babbageclunk commented May 17, 2017

$$merge$$

Contributor

jujubot commented May 17, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented May 17, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10904

Member

babbageclunk commented May 17, 2017

Gah, test run killed because we exceeded our instance quota.

$$merge$$

Contributor

jujubot commented May 17, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit b8999ab into juju:develop May 17, 2017

1 check passed

github-check-merge-juju Built PR, ran unit tests, and tested LXD deploy. Use !!.*!! to request another build. IE, !!build!!, !!retry!!
Details

@babbageclunk babbageclunk deleted the babbageclunk:unknown-collection branch May 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment