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

The charm is not installable: 'sudo -u www-data /srv/app/venv/bin/python3 /srv/app/init.py' exit status 1. #3

Open
taurus-forever opened this issue Mar 29, 2023 · 0 comments
Assignees

Comments

@taurus-forever
Copy link

Hi,

The charm is not installable.

STR:

> juju deploy hello-juju
Located charm "hello-juju" in charm-hub, revision 8
Deploying "hello-juju" from charm-hub charm "hello-juju", revision 8 in channel stable on focal

Actual result:

Model     Controller  Cloud/Region         Version  SLA          Timestamp
default9  local       localhost/localhost  2.9.42   unsupported  18:36:11+02:00

App         Version  Status  Scale  Charm       Channel  Rev  Exposed  Message
hello-juju           error       1  hello-juju  stable     8  no       hook failed: "install"

Unit           Workload  Agent  Machine  Public address  Ports  Message
hello-juju/0*  error     idle   0        10.85.186.171          hook failed: "install"

Machine  State    Address        Inst id        Series  AZ  Message
0        started  10.85.186.171  juju-035d98-0  focal       Running

Debug log:

unit-hello-juju-0: 18:31:12 INFO unit.hello-juju/0.juju-log Running legacy hooks/install.
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install Traceback (most recent call last):
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install   File "/srv/app/init.py", line 3, in <module>
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install     hello_juju.db.create_all()
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install   File "/srv/app/venv/lib/python3.8/site-packages/flask_sqlalchemy/extension.py", line 884, in create_all
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install     self._call_for_binds(bind_key, "create_all")
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install   File "/srv/app/venv/lib/python3.8/site-packages/flask_sqlalchemy/extension.py", line 855, in _call_for_binds
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install     engine = self.engines[key]
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install   File "/srv/app/venv/lib/python3.8/site-packages/flask_sqlalchemy/extension.py", line 636, in engines
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install     app = current_app._get_current_object()  # type: ignore[attr-defined]
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install   File "/srv/app/venv/lib/python3.8/site-packages/werkzeug/local.py", line 513, in _get_current_object
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install     raise RuntimeError(unbound_message) from None
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install RuntimeError: Working outside of application context.
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install 
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install This typically means that you attempted to use functionality that needed
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install the current application. To solve this, set up an application context
unit-hello-juju-0: 18:31:20 WARNING unit.hello-juju/0.install with app.app_context(). See the documentation for more information.
unit-hello-juju-0: 18:31:20 ERROR unit.hello-juju/0.juju-log Uncaught exception while in charm code:
Traceback (most recent call last):
  File "./src/charm.py", line 229, in <module>
    main(HelloJujuCharm)
  File "/var/lib/juju/agents/unit-hello-juju-0/charm/venv/ops/main.py", line 404, in main
    framework.reemit()
  File "/var/lib/juju/agents/unit-hello-juju-0/charm/venv/ops/framework.py", line 732, in reemit
    self._reemit()
  File "/var/lib/juju/agents/unit-hello-juju-0/charm/venv/ops/framework.py", line 767, in _reemit
    custom_handler(event)
  File "./src/charm.py", line 64, in _on_install
    self._setup_application()
  File "./src/charm.py", line 165, in _setup_application
    self._create_database_tables()
  File "./src/charm.py", line 225, in _create_database_tables
    check_call(["sudo", "-u", "www-data", f"{VENV_ROOT}/bin/python3", f"{APP_PATH}/init.py"])
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-u', 'www-data', '/srv/app/venv/bin/python3', '/srv/app/init.py']' returned non-zero exit status 1.
unit-hello-juju-0: 18:31:21 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1

Env: juju 2.9.42, Ubuntu 22.04, lxd 5.0.2-838e1b2.

@taurus-forever taurus-forever changed the title The charm is not installable: subprocess.CalledProcessError: Command 'sudo -u www-data /srv/app/venv/bin/python3 /srv/app/init.py' returned non-zero exit status 1. The charm is not installable: 'sudo -u www-data /srv/app/venv/bin/python3 /srv/app/init.py' returned non-zero exit status 1. Mar 29, 2023
@taurus-forever taurus-forever changed the title The charm is not installable: 'sudo -u www-data /srv/app/venv/bin/python3 /srv/app/init.py' returned non-zero exit status 1. The charm is not installable: 'sudo -u www-data /srv/app/venv/bin/python3 /srv/app/init.py' exit status 1. Mar 29, 2023
@jnsgruk jnsgruk self-assigned this Mar 30, 2023
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