Generated relation and storage hooks are broken in 1.10 #69

Closed
axw opened this Issue Dec 7, 2015 · 4 comments

Comments

Projects
None yet
5 participants
Member

axw commented Dec 7, 2015

I've just built a reactive charm with 1.10, and had errors in storage-attached due to the generated hook file having a blank line before the shebang. Probably broken with the change over to using Python 3.

Owner

cmars commented Dec 7, 2015

I can confirm, my layered charms are affected. All the relation hooks seem to have the extra line before the shebang.

gnuoy commented Dec 7, 2015

Me too. Blank line at top of generated hook file and python3 seems to fail to import charms.reactive:

$ ./hooks/database-relation-changed
./hooks/database-relation-changed: line 5: import: command not found
./hooks/database-relation-changed: line 6: syntax error near unexpected token 'lib'' ./hooks/database-relation-changed: line 6:sys.path.append('lib')'
$ sed -i -e "1d" ./hooks/database-relation-changed
$ ./hooks/database-relation-changed
Traceback (most recent call last):
File "./hooks/database-relation-changed", line 13, in
from charms.reactive import main
ImportError: No module named 'charms'
$ sed -i -e 's/python3/python/' ./hooks/database-relation-changed
$ ./hooks/database-relation-changed
$

@marcoceppi marcoceppi added this to the PATCH milestone Dec 7, 2015

@johnsca johnsca closed this in 742f669 Dec 7, 2015

marcoceppi added a commit that referenced this issue Dec 7, 2015

Merge pull request #71 from johnsca/issue-69
Fix #69: newline before shebang in generated hooks
Owner

cmars commented Dec 7, 2015

Thanks for this. When will this fix be available in ppa:juju/stable?

Member

johnsca commented Dec 7, 2015

For reference, @gnuoy's import issue after fixing the leading newline was due to juju-solutions/reactive-base-layer#10 not having been merged, which has since been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment