Skip to content

Commit

Permalink
Added boolean parm 'always' to 'zhmcclient.Session.logon()'
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Maier <[email protected]>
  • Loading branch information
andy-maier committed Jan 8, 2025
1 parent d55c092 commit 07eb7e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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

0 comments on commit 07eb7e7

Please sign in to comment.