Skip to content

Conversation

@tonyandrewmeyer
Copy link
Contributor

The charm-user field is documented in the metadata.yaml file reference, but is missing from the charmcraft.yaml file reference, even though it does work there. This PR adds it to that reference.

As the docs currently are, it gives the incorrect impression that you cannot use the combined charmcraft.yaml file to specify charm-user, and must have separate metadata, actions, and config files.

@tonyandrewmeyer tonyandrewmeyer changed the title doc: add charm-user in the charmcraft.yaml file reference docs: add charm-user in the charmcraft.yaml file reference Feb 26, 2025
tonyandrewmeyer added a commit to canonical/operator that referenced this pull request Mar 3, 2025
Exposes the `charm-user` field in `CharmMeta`.

The field is added as a string (with type annotations providing the
three possible values) rather than an enum. We have a mixture in the
other meta fields - `RelationRole` is an enum, but `ResourceMeta.type`
is a string and `StorageMeta.type` is a string. It seems like
`charm-user` can go with the simpler form - and it's also easier to add
an enum later than it is to remove one.

Like most of the rest of the meta loading, there's also no validation
(that it's one of the three possible values) - it seems reasonable to
assume that if there's some other value in a production environment
that's a `charmcraft` bug (or there's a new type we don't handle yet)
and in development `charmcraft` will raise the problem when packing.

See also the [charmcraft
docs](https://canonical-charmcraft.readthedocs-hosted.com/en/stable/reference/files/metadata-yaml-file/#charm-user)
(and a [PR to fix it being missing from charmcraft.yaml
reference](canonical/charmcraft#2195)).

Fixes #1396
Copy link
Collaborator

@lengau lengau left a comment

Choose a reason for hiding this comment

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

Thanks! Could you do me a favour and add this key to one of the charmcraft YAML files under the basic smoke tests? I just looked and it doesn't seem like we're actually e2e testing this anywhere.

@tonyandrewmeyer
Copy link
Contributor Author

Could you do me a favour and add this key to one of the charmcraft YAML files under the basic smoke tests? I just looked and it doesn't seem like we're actually e2e testing this anywhere.

Done, assuming that adding the key is all that's required.

tonyandrewmeyer and others added 5 commits March 6, 2025 10:57
Some specific fixes to the Django tutorial:
* Don't need to explicitly have `python3 manage.py`. Django developers
are more used to `./manage.py` instead. I have updated the tutorial and
`task.yaml` file.
* Any reference to `/django-hello-world` in text has been updated to
`~/django-hello-world`.
* Updated indentation in a code snippet that was rendering incorrectly.

Additional reviewers: @jdkandersson
This PR is related to 12 Factor [SMTP
PR](canonical/paas-charm#32).

## Rationale

Some applications require an SMTP integration to send emails to their
clients. This PR is a follow-up to the latest [12 Factor
PR](canonical/paas-charm#32) for adding SMTP
integration.

## Changes

- Add commented-out SMTP relation required objects to extension
charmcraft.yaml.j2 files.
- Add references about SMTP into extension reference documents.
- Add documentation about SMTP integration and generated environment
variables
- Add the smtp charm lib to the initializer.

Reviewers:
@jdkandersson
@javierdelapuente
@erinecon

---------

Co-authored-by: Erin Conley <[email protected]>
@tonyandrewmeyer
Copy link
Contributor Author

I'm not sure of the conventions here - do I need to squash all the commits, and/or rebase? Or will you do that as part of the merge? Let me know if I need to do more.

@medubelko
Copy link
Contributor

@tonyandrewmeyer We'll squash on merge.

@lengau lengau merged commit 5996469 into canonical:main Mar 6, 2025
20 of 31 checks passed
erinecon added a commit to erinecon/charmcraft that referenced this pull request Mar 10, 2025
…al#2195)

The `charm-user` field is documented in the metadata.yaml file
reference, but is missing from the charmcraft.yaml file reference, even
though it does work there. This PR adds it to that reference.

As the docs currently are, it gives the incorrect impression that you
cannot use the combined charmcraft.yaml file to specify `charm-user`,
and must have separate metadata, actions, and config files.

---------

Co-authored-by: Erin Conley <[email protected]>
Co-authored-by: Ali UĞUR <[email protected]>
tonyandrewmeyer added a commit to tonyandrewmeyer/charmcraft that referenced this pull request Mar 13, 2025
…al#2195)

The `charm-user` field is documented in the metadata.yaml file
reference, but is missing from the charmcraft.yaml file reference, even
though it does work there. This PR adds it to that reference.

As the docs currently are, it gives the incorrect impression that you
cannot use the combined charmcraft.yaml file to specify `charm-user`,
and must have separate metadata, actions, and config files.

---------

Co-authored-by: Erin Conley <[email protected]>
Co-authored-by: Ali UĞUR <[email protected]>
dimaqq pushed a commit to dimaqq/operator that referenced this pull request Mar 17, 2025
Exposes the `charm-user` field in `CharmMeta`.

The field is added as a string (with type annotations providing the
three possible values) rather than an enum. We have a mixture in the
other meta fields - `RelationRole` is an enum, but `ResourceMeta.type`
is a string and `StorageMeta.type` is a string. It seems like
`charm-user` can go with the simpler form - and it's also easier to add
an enum later than it is to remove one.

Like most of the rest of the meta loading, there's also no validation
(that it's one of the three possible values) - it seems reasonable to
assume that if there's some other value in a production environment
that's a `charmcraft` bug (or there's a new type we don't handle yet)
and in development `charmcraft` will raise the problem when packing.

See also the [charmcraft
docs](https://canonical-charmcraft.readthedocs-hosted.com/en/stable/reference/files/metadata-yaml-file/#charm-user)
(and a [PR to fix it being missing from charmcraft.yaml
reference](canonical/charmcraft#2195)).

Fixes canonical#1396
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.

5 participants