[2.7] JUJU_HOOK_NAME is only present in debug-hooks sessions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
High
|
Dmitrii Shcherbakov | ||
2.7 |
Fix Released
|
High
|
Heather Lanigan |
Bug Description
JUJU_HOOK_NAME is only added to tmux sessions created via debug-hooks.
Contrary to that, JUJU_{ACTION, FUNCTION}_NAME is always set for functions and they are not handled by debug-hooks at all.
Docs suggest that JUJU_HOOK_NAME is "available to charms during hook execution." which is incorrect:
https:/
It is possible to extract a hook name from JUJU_CONTEXT_ID but its format (<unit_
https:/
https:/
------------
The reason why JUJU_HOOK_NAME is needed is to give charm frameworks an identification mechanism for what exactly gets executed: an action or a hook for a regular event.
While currently the presence/lack of JUJU_{ACTION,
-----------
Another reason to consider this is that Python charms can only rely on argv[0] on Linux distributions - not Windows. For Windows Python places a full path after symlink resolution into argv[0].
Example: for hooks/install -> ..\lib\charm.py, argv[0] will be <disk-letter>
https:/
https:/
The Windows-specific replacement logic:
https:/
description: | updated |
Changed in juju: | |
status: | Triaged → In Progress |
Changed in juju: | |
status: | In Progress → Fix Committed |
Changed in juju: | |
assignee: | nobody → Dmitrii Shcherbakov (dmitriis) |
Changed in juju: | |
status: | Fix Committed → Fix Released |
Suggestion: https:/ /github. com/juju/ juju/pull/ 10969