Skip to content
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

charm build fails with AttributeError: 'WheelhouseTactic' object has no attribute '_layer_refs' #594

Closed
mthaddon opened this issue Jan 28, 2021 · 4 comments

Comments

@mthaddon
Copy link
Contributor

mthaddon commented Jan 28, 2021

What version am I running?

I ran the following command: snap info charm and got the following ouput:

name:      charm
summary:   charm and charm-tools
publisher: Canonical✓
store-url: https://snapcraft.io/charm
contact:   https://discourse.juju.is/c/charming
license:   unset
description: |
  charmstore-client and charm-tools
commands:
  - charm
snap-id:      2Rryoc2ylScfbFl4eQtpntHD9iuZuMvt
tracking:     latest/stable
refresh-date: today at 09:19 CET
channels:
  latest/stable:    2.8.1 2021-01-27 (602) 119MB classic
  latest/candidate: 2.8.1 2021-01-27 (602) 119MB classic
  latest/beta:      2.8.1 2021-01-27 (602) 119MB classic
  latest/edge:      2.8.1 2021-01-27 (602) 119MB classic
installed:          2.8.1            (602) 119MB classic

I am using: ubuntu 20.04

Running the following:

git clone lp:charm-k8s-mariadb
cd charm-k8s-mariadb
tox -e build

I get this error:

Traceback (most recent call last):
  File "/snap/charm/602/bin/charm-build", line 33, in <module>
    sys.exit(load_entry_point('charm-tools==2.8.1', 'console_scripts', 'charm-build')())
  File "/snap/charm/602/lib/python3.6/site-packages/charmtools/build/builder.py", line 1173, in main
    build()
  File "/snap/charm/602/lib/python3.6/site-packages/charmtools/build/builder.py", line 821, in __call__
    self.generate()
  File "/snap/charm/602/lib/python3.6/site-packages/charmtools/build/builder.py", line 759, in generate
    self.formulate_plan(layers)
  File "/snap/charm/602/lib/python3.6/site-packages/charmtools/build/builder.py", line 583, in formulate_plan
    self.plan = self.plan_layers(layers, output_files)
  File "/snap/charm/602/lib/python3.6/site-packages/charmtools/build/builder.py", line 419, in plan_layers
    wh_tactic.combine(existing_tactic)
  File "/snap/charm/602/lib/python3.6/site-packages/charmtools/build/tactics.py", line 1066, in combine
    self._layer_refs.update(existing._layer_refs)
AttributeError: 'WheelhouseTactic' object has no attribute '_layer_refs'
ERROR: InvocationError for command /snap/bin/charm build . --build-dir /tmp (exited with code 1)
@johnsca
Copy link
Contributor

johnsca commented Jan 28, 2021

Because that charm is using layer:caas-base, this error is actually coming from that layer's custom WheelhouseTactic implementation. Interestingly, the approach that that layer's tactic uses is more similar to the way charmcraft pre-builds the venv rather than building it at deploy time the way the default WheelhouseTactic does, but it has also gotten out of sync with the default tactic and missed some fixes and improvements made to that tactic.

The charmcraft / layer:caas-base approach has significant performance advantages during install and upgrade, but has the downside of opening the charm up to architecture-specific binaries ending up in the charm. This will be addressed with Metadata v2 and CharmHub via the extended architecture info, but it might be worth considering adding that type of build as an option in the current default tactic and fold layer:caas-base's custom tactic back into the default.

@johnsca
Copy link
Contributor

johnsca commented Jan 28, 2021

Upon further review, this actually came in from #585 (specifically, this section).

@johnsca
Copy link
Contributor

johnsca commented Jan 28, 2021

This could (and probably should) still be fixed in the caas-base layer (by at least porting over the improvements to combine the wheelhouse.txt file from each layer and doing the install at the end rather than per-layer, which came in #569), but in the meantime, you can work around it by adding the --ignore-lock-file option to your charm build call when building k8s charms.

@johnsca
Copy link
Contributor

johnsca commented Jan 28, 2021

Ok, closing this in favor of juju-solutions/layer-caas-base#27 and #596

@johnsca johnsca closed this as completed Jan 28, 2021
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

No branches or pull requests

2 participants