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

Added boolean parm 'always' to 'zhmcclient.Session.logon()' #1733

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changes/noissue.2.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Added a boolean parameter 'always' to the 'zhmcclient.Session.logon()' method,
which causes the session to always be logged on, regardless of an existing
session ID.
7 changes: 5 additions & 2 deletions zhmcclient/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def auto_updater(self):
return self._auto_updater

@logged_api_call
def logon(self, verify=False):
def logon(self, verify=False, always=False):
"""
Make sure this session object is logged on to the HMC.

Expand Down Expand Up @@ -708,6 +708,9 @@ def logon(self, verify=False):

verify (bool): Verify the validity of an existing session ID.

always (bool): Unconditionally log on, regardless of an existing
session ID.

Raises:

:exc:`~zhmcclient.HTTPError`
Expand All @@ -717,7 +720,7 @@ def logon(self, verify=False):
:exc:`~zhmcclient.ConnectionError`
"""
need_logon = False
if self._session_id is None:
if self._session_id is None or always:
need_logon = True
elif verify:
try:
Expand Down
Loading