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

Fix omitting credentials when CLI has already been instantiated #14449

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Changes from 2 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
22 changes: 20 additions & 2 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1847,9 +1847,27 @@ def cli(self):

@contextmanager
def omit_credentials(self):
self.omitting_credentials = True
change = not self.omitting_credentials # if not already set to omit
if change:
self.omitting_credentials = True
# if CLI is already created
if self._cli._configured:
for name, obj in self._cli.__dict__.items():
with contextlib.suppress(
AttributeError
): # not everything has an mro method, we don't care about them
if Base in obj.mro():
getattr(self._cli, name).omitting_credentials = True
yield
self.omitting_credentials = False
if change:
self.omitting_credentials = False
if self._cli._configured:
for name, obj in self._cli.__dict__.items():
with contextlib.suppress(
AttributeError
): # not everything has an mro method, we don't care about them
if Base in obj.mro():
getattr(self._cli, name).omitting_credentials = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be True or False, if it's a reversion of the previous action?


@contextmanager
def ui_session(self, testname=None, user=None, password=None, url=None, login=True):
Expand Down