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

Autogenerated install hooks fails to import basic layer #185

Closed
jacekn opened this issue Jul 5, 2018 · 0 comments
Closed

Autogenerated install hooks fails to import basic layer #185

jacekn opened this issue Jul 5, 2018 · 0 comments

Comments

@jacekn
Copy link

jacekn commented Jul 5, 2018

I have a charm that stopped working on trusty. I'm not sure when it last worked because most of my deployments are on xenial and xenial still works just fine.

Here is the hook error:

./hooks/install 
Traceback (most recent call last):
  File "./hooks/install", line 7, in <module>
    from charms.layer import basic
  File "lib/charms/layer/__init__.py", line 46, in <module>
    patch_options_interface()
  File "lib/charms/layer/__init__.py", line 42, in patch_options_interface
    options.__class__ = OptionsBackwardsCompatibilityHack
TypeError: __class__ assignment: only for heap types

Autogenerated install file looks like this:

#!/usr/bin/env python3

# Load modules from $JUJU_CHARM_DIR/lib
import sys
sys.path.append('lib')

from charms.layer import basic
basic.bootstrap_charm_deps()
basic.init_config_states()


# This will load and run the appropriate @hook and other decorated
# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive,
# and $JUJU_CHARM_DIR/hooks/relations.
#
# See https://jujucharms.com/docs/stable/authors-charm-building
# for more information on this pattern.
from charms.reactive import main
main()

I'm on juju 2.3.8 if that's important.

johnsca added a commit to canonical/layer-basic that referenced this issue Jul 5, 2018
The backwards compatibility hack from #116 doesn't work on trusty
because it has Python 3.4.  This makes it work with 3.4 / trusty with
even more hackery.

Depends on juju-solutions/layer-options#3
Depends on juju-solutions/layer-status#4
Fixes #117
Fixes canonical/charms.reactive#185
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

1 participant