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

BundleHandler uses GetChangesMapArgs when available #357

Merged
merged 2 commits into from Sep 6, 2019

Conversation

SimonRichardson
Copy link
Member

The following PR updates the BundleHandler code to use GetChangesMapArgs from Juju when possible. Additionally also updated the schema to have the latest 2.7-dev schema.

QA

Ensure you have the following branch checked out juju/juju#10601, or if it's merged, use develop branch.

Deploy the branch so we can test against it:

juju bootstrap lxd test --no-gui --build-agent

To ensure that we're using the right method call, change the following:

diff --git a/juju/bundle.py b/juju/bundle.py
index f6fd91f..6df6635 100644
--- a/juju/bundle.py
+++ b/juju/bundle.py
@@ -140,7 +140,7 @@ class BundleHandler:
                 bundleurl=entity_id,
                 yaml=yaml.dump(self.bundle))
         else:
-            log.info("bundle_facade using GetChangesMapArgs API to deploy bundle changes")
+            log.critical("bundle_facade using GetChangesMapArgs API to deploy bundle changes")
             self.plan = await self.bundle_facade.GetChangesMapArgs(
                 bundleurl=entity_id,
                 yaml=yaml.dump(self.bundle))

Then run:

tox -e example -- examples/deploy_bundle.py

You should see in the output of the example:

Connecting to model
Deploying bundle
bundle_facade using GetChangesMapArgs API to deploy bundle changes
Waiting for active
Successfully deployed!
Removing bundle
Disconnecting from model
Success

The following commit ensures that we use the latest bundle api facade
changes call. This cleans up the problem of what to use in terms of
bundle changes, shame pylib juju is now ahead of golang cli :D

 - Move bundle client facade to v4
As part of the update, we should keep updating the schema from the
API server.
@@ -28,7 +28,7 @@
'ApplicationScaler': {'versions': [1]},
'Backups': {'versions': [1, 2]},
'Block': {'versions': [2]},
'Bundle': {'versions': [1, 2, 3]},
'Bundle': {'versions': [1, 2, 3, 4]},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the bundle facade from 3 to 4.

yaml=yaml.dump(self.bundle))
else:
log.info("bundle_facade using GetChangesMapArgs API to deploy bundle changes")
self.plan = await self.bundle_facade.GetChangesMapArgs(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the latest method if it's available

@SimonRichardson
Copy link
Member Author

Copy link
Contributor

@achilleasa achilleasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and QA works as expected

@@ -3,20 +3,20 @@

from juju.client._definitions import *

from juju.client import _client1, _client2, _client3, _client4, _client5, _client6, _client7, _client8, _client9, _client10, _client12
from juju.client import _client2, _client1, _client3, _client4, _client5, _client8, _client7, _client9, _client10, _client6, _client12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the ordering intentional to mess with people that have OCD? ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm triggered EVERYTIME... I might work out why it does this.

@SimonRichardson
Copy link
Member Author

$$merge$$

@jujubot jujubot merged commit 36ee4b1 into juju:2.7 Sep 6, 2019
@SimonRichardson SimonRichardson deleted the bundle-get-changes-map-args branch September 6, 2019 08:40
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

Successfully merging this pull request may close these issues.

None yet

3 participants