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

Ignore stdout/stderr messages before "yum history list" #158

Merged
merged 1 commit into from
Jul 31, 2023
Merged
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
13 changes: 11 additions & 2 deletions lib/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,19 @@ def get_last_yum_history_tid(self):
history_str = self.ssh(['yum', 'history', 'list', '--noplugins'])

history = history_str.splitlines()
line_index = None
for i in range(len(history)):
if history[i].startswith('--------'):
line_index = i
break

if line_index is None:
raise Exception('Unable to get yum transactions')

try:
return int(history[2].split()[0])
return int(history[line_index + 1].split()[0])
except ValueError:
raise Exception('Unable to parse correctly last yum history tid. Output\n:' + history_str)
raise Exception('Unable to parse correctly last yum history tid. Output:\n' + history_str)

def yum_install(self, packages, enablerepo=None):
logging.info('Install packages: %s on host %s' % (' '.join(packages), self))
Expand Down
Loading