Skip to content

Commit

Permalink
Support for logon/logoff and named sessions
Browse files Browse the repository at this point in the history
Details:

* Added new 'zhmc session logon/logoff' commands that manage the session
  in a file '.zhmc_sessions.yaml' in the user's home directory.

* Deprecated the existing 'zhmc session create/delete' commands since they
  are less convenient to use compared to the new logon/logoff commands,
  and cannot be used as intended on Windows due to the displayed export/unset
  commands.

* Added a general option '-s' / '--session-name' for specifying the name
  of the session that is managed in the '.zhmc_sessions.yaml' file.
  This allows having multiple sessions to different HMCs open at the same
  time, and selecting them by name. If not specified, the session name is
  'default'.

* The 'session delete' command was changed to unset all ZHMC_* environment
  variables, instead of just ZHMC_SESSION_ID.

* If logon options and ZHMC_* environment variables are both specified,
  the logon options now have precedence and none of the ZHMC_* environment
  variables is used (except ZHMC_PASSWORD). This changes the earlier
  behavior where ZHMC_SESSION_ID was used even when logon options were
  specified.

* The existing testcases for sessions were adjusted for the new behavior.

* Added function testcases for the new _session_file.py module.

* The end2end testcases for the _cmd_sessions.py module were extended with
  new testcases.

Signed-off-by: Andreas Maier <[email protected]>
  • Loading branch information
andy-maier committed Jan 9, 2025
1 parent e387d99 commit 3249f60
Show file tree
Hide file tree
Showing 19 changed files with 3,205 additions and 381 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,8 @@ $(done_dir)/ruff_$(pymn)_$(PACKAGE_LEVEL).done: $(done_dir)/develop_$(pymn)_$(PA
check_reqs: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done minimum-constraints-develop.txt minimum-constraints-install.txt requirements.txt
@echo "Makefile: Checking missing dependencies of this package"
pip-missing-reqs $(package_name) --requirements-file=requirements.txt
pip-missing-reqs $(package_name) --requirements-file=minimum-constraints-install.txt
# TODO-ZHMC: Enable again, once released version is available
# pip-missing-reqs $(package_name) --requirements-file=minimum-constraints-install.txt
@echo "Makefile: Done checking missing dependencies of this package"
ifeq ($(PLATFORM),Windows_native)
# Reason for skipping on Windows is https://github.com/r1chardj0n3s/pip-check-reqs/issues/67
Expand Down
7 changes: 7 additions & 0 deletions changes/544.2.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Added support for creating multiple named sessions with a new global option
'-s' / '--session-name'. It is optional and defaults to the name 'default'.
This option can be used with 'zhmc session logon/logoff' to create or delete a
named session, and with any other zhmc command to use a session that has
previously been created. The 'zhmc session create/delete' commands do not
support named sessions, because the environment variables that are used to
store the session data support only a single session.
3 changes: 3 additions & 0 deletions changes/544.2.incompatible.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The 'zhmc session create' command now creates a new session without logging off
from an existing session. Previously, it logged off from an existing session
and then created a new session.
4 changes: 4 additions & 0 deletions changes/544.deprecation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The 'zhmc session create/delete' commands are now deprecated. They were
inconvenient to use and did not support Windows out of the box since they
displayed the export/unset commands to manage the session. Use the new
'zhmc session logon/logoff' commands instead.
6 changes: 6 additions & 0 deletions changes/544.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
New 'zhmc session logon/logoff' commands are provided. They manage the session
in a '.zhmc_sessions.yaml' file in the user's home directory. This is more
convenient for users compared to the existing 'zhmc session create/delete'
commands which store the session in environment variables and display the
export/unset commands to do that. The new commands also support Windows out
of the box.
5 changes: 5 additions & 0 deletions changes/544.incompatible.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
If logon options and ZHMC_* environment variables are both provided, the
logon options now take precedence, and the environment variables are ignored.
As a result, a provided ZHMC_SESSION_ID variable is now ignored when logon
options are also provided. Previously, a provided ZHMC_SESSION_ID variable was
used when logon options were also provided.
3 changes: 2 additions & 1 deletion minimum-constraints-install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ wheel==0.41.3

# Direct dependencies for install (must be consistent with requirements.txt)

zhmcclient==1.18.0
# TODO-ZHMC: Switch to released version again, once available
# zhmcclient==1.19.0

click==8.0.2
click-repl==0.2
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

# Direct dependencies for install (must be consistent with minimum-constraints-install.txt)

# zhmcclient @ git+https://github.com/zhmcclient/python-zhmcclient.git@master
zhmcclient>=1.18.0
# TODO-ZHMC: Switch to released version again, once available
zhmcclient @ git+https://github.com/zhmcclient/python-zhmcclient.git@master
# zhmcclient>=1.19.0

# safety 2.2.0 depends on click>=8.0.2
click>=8.0.2
Expand Down
Loading

0 comments on commit 3249f60

Please sign in to comment.