-
Notifications
You must be signed in to change notification settings - Fork 122
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
docs: fix links that pointed to earlier Juju docs #1575
base: main
Are you sure you want to change the base?
Changes from all commits
d94f13e
c7919c3
f08d83e
af94c83
96392bf
acada32
d788c66
65bbef2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -25,7 +25,7 @@ def _on_leader_elected(self, event: ops.LeaderElectedEvent): | |||||
|
||||||
To have the leader notify other units about leadership changes, change data in a peer relation. | ||||||
|
||||||
> See more: [Peer Relations](https://juju.is/docs/juju/relation#heading--peer) | ||||||
> See more: {external+juju:ref}`Juju | Peer relations <relation>` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This goes to relations in general rather than peer relations. I think that's fine, but maybe the link text should just say "Relation"?
Suggested change
|
||||||
|
||||||
[note status="Use the peer relation rather than `leader-setting-changed`"] | ||||||
In the past, this was done by observing a `leader-setting-changed` event, which is now deprecated. | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ class HelloOperatorCharm(ops.CharmBase): | |
> - [`logging.getLogger().info()`](https://docs.python.org/3/library/logging.html#logging.Logger.info) | ||
> - [`logging.getLogger().debug()`](https://docs.python.org/3/library/logging.html#logging.Logger.debug) | ||
|
||
Juju automatically picks up logs from charm code that uses the Python [logging facility](https://docs.python.org/3/library/logging.html), so we can use the Juju [`debug-log` command](https://juju.is/docs/juju/juju-debug-log) to display logs for a model. Note that it shows logs from the charm code (charm container), but not the workload container. Read ["Use `juju debug-log`"](https://juju.is/docs/sdk/get-logs-from-a-kubernetes-charm#heading--use-juju-debug-log) for more information. | ||
Juju automatically picks up logs from charm code that uses the Python [logging facility](https://docs.python.org/3/library/logging.html), so we can use the Juju [`debug-log` command](inv:juju:std:label#command-juju-debug-log) to display logs for a model. Note that it shows logs from the charm code (charm container), but not the workload container. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed the link to https://juju.is/docs/sdk/get-logs-from-a-kubernetes-charm#heading--use-juju-debug-log because I can't find where this info has ended up. @tmihoc do you know whether we still have it somewhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if it's the same content, but I think we should be linking here: https://canonical-juju.readthedocs-hosted.com/en/latest/user/howto/manage-logs/ Also: we should make this a |
||
|
||
Besides logs, `stderr` is also captured by Juju. So, if a charm generates a warning, it will also end up in Juju's debug log. This behaviour is consistent between K8s charms and machine charms. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ requires: | |
|
||
Other than this, implement a subordinate relation in the same way as any other relation. Note however that subordinate units cannot see each other's peer data. | ||
|
||
> See also: [Charm taxonomy](https://juju.is/docs/sdk/charm-taxonomy#heading--subordinate-charms) | ||
> See also: {external+juju:ref}`Juju | Charm taxonomy <charm-taxonomy>` | ||
|
||
### Add code to use a relation | ||
|
||
|
@@ -123,11 +123,11 @@ To use data received through the relation, have your charm observe the `relation | |
framework.observe(self.on.replicas_relation_changed, self._update_configuration) | ||
``` | ||
|
||
> See more: [](ops.RelationChangedEvent), [`juju` | Relation (integration)](https://juju.is/docs/juju/relation#heading--permissions-around-relation-databags) | ||
> See more: [](ops.RelationChangedEvent), {external+juju:ref}`Juju | Relation (integration) <relation>` | ||
|
||
Most of the time, you should use the same holistic handler as when receiving other data, such as `secret-changed` and `config-changed`. To access the relation(s) in your holistic handler, use the [](ops.Model.get_relation) method or [](ops.Model.relations) attribute. | ||
|
||
> See also: {ref}`holistic-vs-delta-charms` | ||
> See also: [](/explanation/holistic-vs-delta-charms) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is out of scope of this PR, but I'm updating another instance elsewhere, so I'm using the same format here. |
||
|
||
If your change will have at most one relation on the endpoint, to get the `Relation` object use `Model.get_relation`; for example: | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,7 +204,7 @@ See the [layer specification](https://canonical-pebble.readthedocs-hosted.com/en | |
|
||
#### Add a configuration layer | ||
|
||
To add a configuration layer, call [`Container.add_layer`](ops.Container.add_layer) with a label for the layer, and the layer's contents as a YAML string, Python dict, or [`pebble.Layer`](#ops.pebble.Layer) object. | ||
To add a configuration layer, call [`Container.add_layer`](ops.Container.add_layer) with a label for the layer, and the layer's contents as a YAML string, Python dict, or [`pebble.Layer`](ops.pebble.Layer) object. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is out of scope of this PR, but it's the only instance that needs adjusting for consistency, so I'm including it here. |
||
|
||
You can see an example of `add_layer` under the ["Replan" heading](#replan). The `combine=True` argument tells Pebble to combine the named layer into an existing layer of that name (or add a layer if none by that name exists). Using `combine=True` is common when dynamically adding layers. | ||
|
||
|
@@ -823,6 +823,7 @@ Traceback (most recent call last): | |
ops.pebble.ExecError: non-zero exit code 143 executing ['sleep', '10'] | ||
``` | ||
|
||
(use-custom-notices-from-the-workload-container)= | ||
## Use custom notices from the workload container | ||
|
||
### Record a notice | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,6 @@ | |
# How to run workloads with a charm - machines | ||
|
||
There are several ways your charm might start a workload, depending on the type of charm you’re authoring. | ||
<!-- | ||
Before writing the code to start your workload, recall the [Lifecycle events](https://juju.is/docs/sdk/events) section, and note that when the `start` event is emitted, charm authors should ensure their workloads are configured to "persist in a started state without further intervention from Juju or an administrator". | ||
--> | ||
Comment on lines
-5
to
-7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure why this is commented out, but might as well remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was common in Discourse for people to leave old chunks of content commented out. I'm not sure why, or if the intention was to include it again in the future, or something else. The history could always be examined via the edit tracking, so it shouldn't have been for that. I've also taken the approach of removing it whenever I'm editing a file that has it (after checking that there isn't value to be added back in). |
||
|
||
For a machine charm, it is likely that packages will need to be fetched, installed and started to provide the desired charm functionality. This can be achieved by interacting with the system’s package manager, ensuring that package and service status is maintained by reacting to events accordingly. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,7 +136,6 @@ It is in our interest to move the handler logic for each `/hooks/<hook_name>` to | |
- We can avoid code duplication by accessing shared data via the CharmBase interface provided through `self`. | ||
- The code is all in one place, easier to maintain. | ||
- We automatically have one Python object we can test, instead of going back and forth between Bash scripts and Python wrappers. | ||
- We can use [the awesome testing Harness](https://juju.is/docs/sdk/testing). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My reasoning for this change: The preceding bullet already mentions testing. And Harness is not considered so awesome any more 💔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's fine to remove, but you could swap out Scenario for Harness (except you'd need to say "unit testing framework" or some other generic name) and it would still be true. |
||
|
||
So let's do that. | ||
|
||
|
@@ -206,7 +205,7 @@ That allows us to fetch the Relation wherever we need it and access its contents | |
) | ||
``` | ||
|
||
Note how `relation.data` provides an interface to the relation databag (more on that [here](https://juju.is/docs/sdk/relations#heading--relation-data)) and we need to select which part of that bag to access by passing an `ops.model.Unit` instance. | ||
Note how `relation.data` provides an interface to the relation databag (see [](ops.Relation.data)) and we need to select which part of that bag to access by passing an `ops.model.Unit` instance. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was going to a Juju reference page previously rather than to the ops API reference. I can't figure out where that is now: @tmihoc did it get removed? If it doesn't exist any more, I think maybe linking to the section in the relation how-to might be better here? |
||
|
||
#### Logging | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -522,7 +522,7 @@ Congratulations, your charm user can view the version of the workload deployed f | |
|
||
## Tear things down | ||
|
||
> See [Juju | Tear down your development environment automatically](https://juju.is/docs/juju/set-up--tear-down-your-test-environment#tear-down-automatically) | ||
> See the automatic teardown instructions in {external+juju:ref}`Juju | Manage your deployment environment <manage-your-deployment-environment>`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to link directly to the tear down section? If not that's fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I agree that would be better. I've asked Dora about adding a target so that we can directly link there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dwilding Added it in this PR: https://github.com/juju/juju/pull/18911/files |
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using the MyST format for the intersphinx link to allow backticks in the link title.