canonical / charmcraft

Collaborate, build and publish charmed operators for Kubernetes, Linux and Windows.
Apache License 2.0
65 stars 69 forks source link

`charmcraft init --profile machine` doesn't produce `config.yaml` #1139

Closed tmihoc closed 1 year ago

tmihoc commented 1 year ago

Bug Description

The charmcraft init --profile machine command output says to edit, among other things, the config.yaml file. However, when you inspect the files it has generated, there is no config.yaml file.

To Reproduce

  1. Run charmcraft init --profile machine.
  2. Inspect the files this has generated.

Environment

Charmcraft 2.3.0 on Multipass VM running Ubuntu 22.04

charmcraft.yaml

type: charm
bases:
  - build-on:
    - name: ubuntu
      channel: "22.04"
    run-on:
    - name: ubuntu
      channel: "22.04"

Relevant log output

$ charmcraft init --profile machine
Charmed operator package file and directory tree initialised.                              

Now edit the following package files to provide fundamental charm metadata and other information:                                                                                      

metadata.yaml                                                                              
config.yaml                                                                                
src/charm.py                                                                               
README.md                                      

$ ls
CONTRIBUTING.md  README.md        metadata.yaml   requirements.txt  tests
LICENSE          charmcraft.yaml  pyproject.toml  src               tox.ini
syu-w commented 1 year ago

@tmihoc Hi, the machine charm template does not include the config.yaml file as it is optional. Do you use it?

tmihoc commented 1 year ago

Hi @syu-w , I think the problem is not so much whether it is generated or not -- the default behavior should, of course, be whatever makes the most sense. The issue is that, when you run charmcraft init --profile machine, the output says:

Charmed operator package file and directory tree initialised.                              

Now edit the following package files to provide fundamental charm metadata and other information:                                                                                      

metadata.yaml                                                                              
config.yaml                                                                                
...

suggesting that the config.yaml file is among the files that are generated, whereas it is not. So either we generate that file or we don't mention it here, imo.

syu-w commented 1 year ago

The info had updated, and now it is only need to edit charmcraft.yaml after charmcraft init. metadata.yaml and config.yaml no longer in the default template. https://github.com/canonical/charmcraft/pull/1149