adam-stokes / juju-charm-ghost Goto Github PK
View Code? Open in Web Editor NEWJuju Ghost charm - based on charms.reactive
Home Page: http://ghost.org
License: MIT License
Juju Ghost charm - based on charms.reactive
Home Page: http://ghost.org
License: MIT License
https://github.com/battlemidget/juju-charm-ghost/blob/master/lib/charms/layer/ghost.py#L36 - here, ghost_source
can be "False" if hookenv.resource_get
fails to find the resource.
In that case you get this traceback instead of a nice message about not finding the resource:
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached error: could not download resource: HTTP request failed: resource#ghost/ghost-stable not found
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached Traceback (most recent call last):
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached File "/var/lib/juju/agents/unit-ghost-0/charm/hooks/app-storage-attached", line 19, in <module>
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached main()
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached File "/usr/local/lib/python3.5/dist-packages/charms/reactive/__init__.py", line 78, in main
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached bus.dispatch()
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 434, in dispatch
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached _invoke(other_handlers)
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 417, in _invoke
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached handler.invoke()
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 291, in invoke
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached self._action(*args)
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached File "/var/lib/juju/agents/unit-ghost-0/charm/reactive/ghost.py", line 50, in check_app_config
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached ghost.update_ghost()
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached File "lib/charms/layer/ghost.py", line 57, in update_ghost
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached download_archive()
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached File "lib/charms/layer/ghost.py", line 37, in download_archive
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached hookenv.log("Extracting Ghost: {}".format(' '.join(cmd)))
unit-ghost-0: 16:56:57 INFO unit.ghost/0.app-storage-attached TypeError: sequence item 2: expected str instance, bool found
unit-ghost-0: 16:56:57 ERROR juju.worker.uniter.operation hook "app-storage-attached" failed: exit status 1
The link is now https://github.com/TryGhost/Ghost/releases/download/0.11.3/Ghost-0.11.3.zip
So the real problem is we should be using resources and storing this zip in the charmstore. This bug is to track that work.
I built the latest from:
https://github.com/battlemidget/charm-layer-ghost
https://github.com/battlemidget/juju-layer-node
deployed with juju-1:
$ juju-1 version
1.25.5-xenial-amd64
On local provider I get the following:
$ juju-1 status --format=tabular
[Services]
NAME STATUS EXPOSED CHARM
ghost error false local:xenial/ghost-0
ghost-trusty error false local:trusty/ghost-0
[Units]
ID WORKLOAD-STATE AGENT-STATE VERSION MACHINE PORTS PUBLIC-ADDRESS MESSAGE
ghost-trusty/0 error idle 1.25.5.1 2 10.0.3.94 hook failed: "storage-attached"
ghost/0 error idle 1.25.5.1 1 10.0.3.64 hook failed: "storage-attached"
[Machines]
ID STATE VERSION DNS INS-ID SERIES HARDWARE
0 started 1.25.5.1 localhost localhost xenial
1 started 1.25.5.1 10.0.3.64 arosales-local-machine-1 xenial arch=amd64
2 started 1.25.5.1 10.0.3.94 arosales-local-machine-2 trusty arch=amd64
Error in question is:
2016-06-27 23:35:23 INFO app-storage-attached Successfully installed Jinja2-2.8 MarkupSafe-0.23 PyYAML-3.11 Tempita-0.5.2 charmhelpers-0.7.0 charms.reactive-0.4.4 netaddr-0.7.18 pip-8.1.2 pyaml-15.8.2 shell-1.0.1 six-1.10.0 toml-0.9.1
2016-06-27 23:35:23 INFO juju-log Reactive main running for hook app-storage-attached
2016-06-27 23:35:23 INFO app-storage-attached Traceback (most recent call last):
2016-06-27 23:35:23 INFO app-storage-attached File "/var/lib/juju/agents/unit-ghost-trusty-0/charm/hooks/app-storage-attached", line 19, in <module>
2016-06-27 23:35:23 INFO app-storage-attached main()
2016-06-27 23:35:23 INFO app-storage-attached File "/usr/local/lib/python3.4/dist-packages/charms/reactive/__init__.py", line 76, in main
2016-06-27 23:35:23 INFO app-storage-attached bus.discover()
2016-06-27 23:35:23 INFO app-storage-attached File "/usr/local/lib/python3.4/dist-packages/charms/reactive/bus.py", line 458, in discover
2016-06-27 23:35:23 INFO app-storage-attached _register_handlers_from_file(filepath)
2016-06-27 23:35:23 INFO app-storage-attached File "/usr/local/lib/python3.4/dist-packages/charms/reactive/bus.py", line 484, in _register_handlers_from_file
2016-06-27 23:35:23 INFO app-storage-attached _load_module(filepath)
2016-06-27 23:35:23 INFO app-storage-attached File "/usr/local/lib/python3.4/dist-packages/charms/reactive/bus.py", line 471, in _load_module
2016-06-27 23:35:23 INFO app-storage-attached sys.modules[modname] = load_source(modname, realpath)
2016-06-27 23:35:23 INFO app-storage-attached File "/usr/local/lib/python3.4/dist-packages/charms/reactive/bus.py", line 35, in load_source
2016-06-27 23:35:23 INFO app-storage-attached return SourceFileLoader(modname, realpath).load_module()
2016-06-27 23:35:23 INFO app-storage-attached File "<frozen importlib._bootstrap>", line 539, in _check_name_wrapper
2016-06-27 23:35:23 INFO app-storage-attached File "<frozen importlib._bootstrap>", line 1614, in load_module
2016-06-27 23:35:23 INFO app-storage-attached File "<frozen importlib._bootstrap>", line 596, in _load_module_shim
2016-06-27 23:35:23 INFO app-storage-attached File "<frozen importlib._bootstrap>", line 1220, in load
2016-06-27 23:35:23 INFO app-storage-attached File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
2016-06-27 23:35:23 INFO app-storage-attached File "<frozen importlib._bootstrap>", line 1129, in _exec
2016-06-27 23:35:23 INFO app-storage-attached File "<frozen importlib._bootstrap>", line 1471, in exec_module
2016-06-27 23:35:23 INFO app-storage-attached File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
2016-06-27 23:35:23 INFO app-storage-attached File "/var/lib/juju/agents/unit-ghost-trusty-0/charm/reactive/ghost.py", line 14, in <module>
2016-06-27 23:35:23 INFO app-storage-attached from nodejs import node_dist_dir, npm
2016-06-27 23:35:23 INFO app-storage-attached ImportError: No module named 'nodejs'
2016-06-27 23:35:23 ERROR juju.worker.uniter.operation runhook.go:107 hook "app-storage-attached" failed: exit status 1
ghost/reactive/ghost.py
1 import os
2 import sys
3 from charms.reactive import (
4 hook,
5 when,
6 only_once,
7 is_state
8 )
9
10 from charmhelpers.core import hookenv, host
11 from charmhelpers.core.templating import render
12
13 # ./lib/nodejs.py
14 from nodejs import node_dist_dir, npm
I did some Google'ing for import on nodejs, but didn't come up with anything trival. This also fails from the python interpreter:
$ python
Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from nodejs import node_dist_dir, npm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named nodejs
>>> from node import node_dist_dir, npm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named node
At this point I thought I would log an issue and seek assistance from folks a lot more knowledgeable than myself. The issue is most likely pilot error, thus apologies and advance.
Full unit logs attached:
unit-ghost-trusty-0.log.txt
Hi,
The design team at Canonical would like to update charm icons to fit within the new circular format, as displayed in the current GUI.
This will improve how charms are displayed in the store, search results and on charm details pages.
I've attached a new version of the charm icon. If you're happy with this change, please could you update the icon and let us know when it's done.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.