charm-tools icon indicating copy to clipboard operation
charm-tools copied to clipboard

'charm proof' parse error when layer.yaml missing/empty

Open erik78se opened this issue 6 years ago • 2 comments

  • Used: charm build, charm proof
  • Version of charm: 2.5.2

What version am I running?

snap info charm
name:      charm
summary:   charm and charm-tools
publisher: Cory Johns (johnsca)
contact:   [email protected]
license:   unset
description: |
  charmstore-client and charm-tools
commands:
  - charm
snap-id:      2Rryoc2ylScfbFl4eQtpntHD9iuZuMvt
tracking:     stable
refresh-date: 23 days ago, at 17:26 CET
channels:
  stable:    2.5.2                2019-02-07 (320) 47MB classic
  candidate: 2.5.2                2019-02-07 (320) 47MB classic
  beta:      2.5.2                2019-02-07 (320) 47MB classic
  edge:      2.5.2+git-3-gef3d9a6 2019-02-12 (326) 47MB classic
installed:   2.5.2                           (320) 47MB classic

I am using: Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic

Issue

I create a new charm with:

charm create -t bash h2"

My intention is to have NO interfaces / relations for this charm. E.g. "layers.yaml" is perfectly OK with being empty (at least not having to define any layers/interfaces).

This is also what the "charm create" creates for me (no layers.yaml is added).

$ ls h2
config.yaml  hooks  icon.svg  metadata.yaml  README.ex  revision

But, when I do a "charm proof", I get the information that my charm is error related to the layer.yaml.

$ charm proof
W: cannot parse /home/erik/Tutorial-Build-a-quick-charm/h2/layer.yaml: 'NoneType' object has no attribute 'get'
I: `display-name` not provided, add for custom naming in the UI
I: Includes template icon.svg file.
W: no copyright file
I: all charms should provide at least one thing

I expected the following

  • If the layer.yaml is empty or missing, 'charm proof' should be OK with that.
  • 'charm proof' should perhaps warn/error only if any charm interfaces are used and the file is still missing/empty

What I got

$ charm proof

charm proof
W: cannot parse /home/erik/Tutorial-Build-a-quick-charm/h2/layer.yaml: 'NoneType' object has no attribute 'get'

erik78se avatar Mar 04 '19 23:03 erik78se

If you're not planning to build your charm from layers, then it's probably better to not even have an empty layer.yaml file at all. But I agree that the warning is confusing and could be improved or skipped entirely.

johnsca avatar Mar 11 '19 16:03 johnsca

If you're not planning to build your charm from layers, then it's probably better to not even have an empty layer.yaml file at all. But I agree that the warning is confusing and could be improved or skipped entirely.

Totally, less confusing things = easier to learn and understand.

erik78se avatar Mar 16 '19 14:03 erik78se