Skip to content

Merge master into 2.9#455

Merged
jujubot merged 15 commits intojuju:2.9from
SimonRichardson:2.9
Nov 3, 2020
Merged

Merge master into 2.9#455
jujubot merged 15 commits intojuju:2.9from
SimonRichardson:2.9

Conversation

@SimonRichardson
Copy link
Copy Markdown
Member

This is a clean merge from master to 2.9 to ensure that 2.9 is kept in sync.

SimonRichardson and others added 13 commits October 23, 2020 12:37
Strict mode is a new feature in Juju 2.9. The mode allows more things to
fail early if the mode is switched to strict. If no mode is detected
then it will fallback to a more passive mode, where it will fallback to
other solutions and try to carry on.

The purpose of strict mode is to enable people developing with
Juju/pylibjuju is highlight errors more early on and to prevent less
magic in Juju.

The PR for implementing strict mode is simple, EXCEPT when I turned it
one, it found the first error! ModelInfo delta was wrongly implemented
and wasn't gaining all the history correctly from the deltas over time.

This requires[1] juju/juju#12183 to land before this PR is really
useful.

To enable it at bootstrap time:

```sh
juju bootstrap lxd test --config mode=strict
```

 1. juju/juju#12183
Improve the name of the method that allows us to override the type name.
Offically we would like to call ModelInfo - Model, but Model already
exists and I don't want Model to also become a type delta. Model is
both a entity for state and an entity for connections and to become an
entity for deltas seems like a bit too much.
The try inside of the allwatcher was a bit to greedy and caused issues
where it would mask errors from being correctly diagnosed. This might
unfortunately lead to some more bug reports about missing types etc, but
I believe it's the right way to correctly handle KeyErrors.
Pylibjuju really needs to better handle path detection and tbh it
shouldn't be reading your home directory and everything should be passed
in.
juju#451

Strict mode is a new feature in Juju 2.9. The mode allows more things to
fail early if the mode is switched to strict. If no mode is detected
then it will fallback to a more passive mode, where it will fallback to
other solutions and try to carry on.

The purpose of strict mode is to enable people developing with
Juju/pylibjuju is highlight errors more early on and to prevent less
magic in Juju.

The PR for implementing strict mode is simple, EXCEPT when I turned it
one, it found the first error! ModelInfo delta was wrongly implemented
and wasn't gaining all the history correctly from the deltas over time.

This requires[1] juju/juju#12183 to land before this PR is really
useful.

To enable it at bootstrap time:

```sh
juju bootstrap lxd test --config mode=strict
```

 1. juju/juju#12183
Apparently, list_offers can return a result with a None value instead of
an empty list (or no response key), leading to an error like the
following:

```
Traceback (most recent call last):
  File "/home/johnsca/juju/projects/kubernetes-jenkins/jobs/integration/conftest.py", line 233, in k8s_model
    offers = [offer.offer_name for offer in (await k8s_model.list_offers()).results]
  File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/model.py", line 1989, in list_offers
    return await controller.list_offers(self.info.name)
  File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/controller.py", line 769, in list_offers
    return await facade.ListApplicationOffers(filters=[params])
  File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/facade.py", line 480, in wrapper
    reply = await f(*args, **kwargs)
  File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/_client2.py", line 2413, in ListApplicationOffers
    reply = await self.rpc(msg)
  File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/facade.py", line 623, in rpc
    result = await self.connection.rpc(msg, encoder=TypeEncoder)
  File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/connection.py", line 484, in rpc
    for res in result['response']['results']:
TypeError: 'NoneType' object is not iterable
```
juju#452

Apparently, `list_offers` can return a result with a None value instead of an empty list (or no response key), leading to an error like the following:

```python-traceback
Traceback (most recent call last):
 File "/home/johnsca/juju/projects/kubernetes-jenkins/jobs/integration/conftest.py", line 233, in k8s_model
 offers = [offer.offer_name for offer in (await k8s_model.list_offers()).results]
 File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/model.py", line 1989, in list_offers
 return await controller.list_offers(self.info.name)
 File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/controller.py", line 769, in list_offers
 return await facade.ListApplicationOffers(filters=[params])
 File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/facade.py", line 480, in wrapper
 reply = await f(*args, **kwargs)
 File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/_client2.py", line 2413, in ListApplicationOffers
 reply = await self.rpc(msg)
 File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/facade.py", line 623, in rpc
 result = await self.connection.rpc(msg, encoder=TypeEncoder)
 File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/connection.py", line 484, in rpc
 for res in result['response']['results']:
TypeError: 'NoneType' object is not iterable
```
The following adds an example of consuming a model from another
controller that we also know about.

The helps with consuming CMR and the flakey nature of pylibjuju not
finding a model from the current model.
…el-example

juju#453

The following adds an example of consuming a model from another
controller that we also know about.

The helps with consuming CMR and the flakey nature of pylibjuju not
finding a model from the current model.
The following updates the facades to prevent spurious warnings about
missing facades. Although it logs, because nothing has been coded to the
facades we can safely add them without any consequence.
Copy link
Copy Markdown
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

jujubot and others added 2 commits November 3, 2020 23:09
juju#454

The following updates the facades to prevent spurious warnings about
missing facades. Although it logs, because nothing has been coded to the
facades we can safely add them without any consequence.
@SimonRichardson
Copy link
Copy Markdown
Member Author

$$merge$$

@jujubot jujubot merged commit eb849e4 into juju:2.9 Nov 3, 2020
@SimonRichardson SimonRichardson deleted the 2.9 branch November 3, 2020 13:24
@SimonRichardson SimonRichardson mentioned this pull request May 20, 2021
jujubot added a commit that referenced this pull request May 26, 2021
#494

The following merges 2.9 into master.

eed19e4 (upstream/2.9, origin/2.9, 2.9) Merge pull request #492 from tlm/kube-proxy-support-2
ab33f33 Merge pull request #493 from SimonRichardson/remove-machine-workaround
5c2dfa9 Merge pull request #491 from tlm/2.9.1-facades
b24e750 Merge pull request #490 from tlm/kube-proxy-support-2
aaa651c Merge pull request #482 from SimonRichardson/find-parameters
bde724b Merge pull request #481 from SimonRichardson/merge-master-2.9
fa1b85f Merge pull request #464 from SimonRichardson/charm-hub-url
195191b Merge pull request #463 from SimonRichardson/charm-hub-origin
d6d157f Merge pull request #462 from SimonRichardson/charm-hub-find
6fab2ee Merge pull request #460 from SimonRichardson/charm-hub-info
5e61dd2 Merge pull request #459 from SimonRichardson/rename-upgrade-charm-refresh
73604c8 Merge pull request #456 from SimonRichardson/update-schema-2.9-rc3
6c0437a Merge pull request #457 from SimonRichardson/ensure-charm-store-prefix
eb849e4 Merge pull request #455 from SimonRichardson/2.9
1a77394 Merge pull request #449 from achilleasa/support-new-expose-params-for-applications
ad3c449 Merge pull request #448 from achilleasa/gen-2.9-beta-client
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.

4 participants