charms.openstack should fail gracefully when release_pkg is unset

Bug #1904494 reported by Linda Guo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
charms.openstack
Fix Committed
High
Linda Guo

Bug Description

 Generated a freenas Cinder storage plugin charm for an iscsi backend by:

$cookiecutter https://github.com/openstack-charmers/cinder-storage-backend-template.git

Charm install failed, because in lib/charm/openstack/cinder_freenas.py, in the charm class, didn't set 'release_pkg = version_package'.

charms_openstack should fail gracefully when release_pkg is unset and provide more helpful debug info

----------------------------------------
2020-11-17 03:30:31 WARNING install Traceback (most recent call last):
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/charm/hooks/install", line 22, in <module>
2020-11-17 03:30:31 WARNING install main()
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/.venv/lib/python3.5/site-packages/charms/reactive/__init__.py", line 74, in main
2020-11-17 03:30:31 WARNING install bus.dispatch(restricted=restricted_mode)
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/.venv/lib/python3.5/site-packages/charms/reactive/bus.py", line 390, in dispatch
2020-11-17 03:30:31 WARNING install _invoke(other_handlers)
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/.venv/lib/python3.5/site-packages/charms/reactive/bus.py", line 359, in _invoke
2020-11-17 03:30:31 WARNING install handler.invoke()
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/.venv/lib/python3.5/site-packages/charms/reactive/bus.py", line 181, in invoke
2020-11-17 03:30:31 WARNING install self._action(*args)
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/charm/reactive/layer_openstack.py", line 26, in default_install
2020-11-17 03:30:31 WARNING install with charm.provide_charm_instance() as instance:
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/.venv/lib/python3.5/site-packages/charms_openstack/charm/core.py", line 96, in __enter__
2020-11-17 03:30:31 WARNING install return BaseOpenStackCharm.singleton
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/.venv/lib/python3.5/site-packages/charms_openstack/charm/core.py", line 302, in singleton
2020-11-17 03:30:31 WARNING install release = _release_selector_function()
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/.venv/lib/python3.5/site-packages/charms_openstack/charm/defaults.py", line 108, in default_select_release
2020-11-17 03:30:31 WARNING install apt_cache_sufficient=(not singleton.source_config_key))
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/.venv/lib/python3.5/site-packages/charms_openstack/charm/core.py", line 527, in get_os_codename_package
2020-11-17 03:30:31 WARNING install pkg = cache[package]
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/.venv/lib/python3.5/site-packages/charmhelpers/fetch/ubuntu_apt_pkg.py", line 79, in __getitem__
2020-11-17 03:30:31 WARNING install apt_result = self._apt_cache_show([package])[package]
2020-11-17 03:30:31 WARNING install File "/var/lib/juju/agents/unit-cinder-freenas-0/.venv/lib/python3.5/site-packages/charmhelpers/fetch/ubuntu_apt_pkg.py", line 161, in _apt_cache_show
2020-11-17 03:30:31 WARNING install universal_newlines=True)
2020-11-17 03:30:31 WARNING install File "/usr/lib/python3.5/subprocess.py", line 626, in check_output
2020-11-17 03:30:31 WARNING install **kwargs).stdout
2020-11-17 03:30:31 WARNING install File "/usr/lib/python3.5/subprocess.py", line 693, in run
2020-11-17 03:30:31 WARNING install with Popen(*popenargs, **kwargs) as process:
2020-11-17 03:30:31 WARNING install File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
2020-11-17 03:30:31 WARNING install restore_signals, start_new_session)
2020-11-17 03:30:31 WARNING install File "/usr/lib/python3.5/subprocess.py", line 1490, in _execute_child
2020-11-17 03:30:31 WARNING install restore_signals, start_new_session, preexec_fn)
2020-11-17 03:30:31 WARNING install TypeError: Can't convert 'NoneType' object to str implicitly
2020-11-17 03:30:31 ERROR juju.worker.uniter.operation runhook.go:136 hook "install" (via explicit, bespoke hook script) failed: exit status 1
-----------------------------------------------------------------

Revision history for this message
Linda Guo (lihuiguo) wrote :
David Ames (thedac)
Changed in charms.openstack:
status: New → Triaged
importance: Undecided → High
Linda Guo (lihuiguo)
Changed in charms.openstack:
assignee: nobody → Linda Guo (lihuiguo)
Linda Guo (lihuiguo)
Changed in charms.openstack:
status: Triaged → In Progress
Revision history for this message
Linda Guo (lihuiguo) wrote :

Fix proposal:

charms.openstack raised a RuntimeError when release_pkg is not set

Linda Guo (lihuiguo)
Changed in charms.openstack:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.