diff --git a/common/OpTestUtil.py b/common/OpTestUtil.py index e34d2edc..5428585d 100644 --- a/common/OpTestUtil.py +++ b/common/OpTestUtil.py @@ -1688,7 +1688,7 @@ def setup_term(self, system, pty, ssh_obj=None, block=0): # Ctrl-L may cause a esc[J (erase) character to appear in the buffer. # Include this in the patterns that expect $ (end of line) rc = pty.expect(['login: (\x1b\[J)*$', ".*#(\x1b\[J)*$", ".*# (\x1b\[J)*$", ".*\$(\x1b\[J)*", - "~>(\x1b\[J)", "~ #(\x1b\[J)", ":~(\x1b\[J)*", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=30) + "~>(\x1b\[J)", "~ #(\x1b\[J)", ":~(\x1b\[J)", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=30) if rc == 0: track_obj.PS1_set, track_obj.LOGIN_set = self.get_login( system_obj.cv_HOST, term_obj, pty, self.build_prompt(system_obj.prompt)) @@ -1807,7 +1807,7 @@ def handle_password(self, term_obj, pty, command): raise CommandFailed(command, ''.join(failure_list_output), -1) return list_output, echo_rc - def run_command(self, term_obj, command, timeout=600, retry=5): + def run_command(self, term_obj, command, timeout=60, retry=0): # retry=0 will perform one pass counter = 0 while counter <= retry: @@ -2159,6 +2159,8 @@ def gather_os_logs(self, list_of_files=[], list_of_commands=[], collect_sosrepor def __gather_os_files_logs(self, list_of_files=[], output_dir=None): host = self.conf.host() + if self.distro_name() == 'rhel': + host.host_run_command("yum install rsyslog -y" default_files = ['/var/log/messages', '/var/log/boot.log'] list_of_files.extend(default_files) @@ -2191,6 +2193,7 @@ def __gather_os_command_logs(self, list_of_commands=[], collect_sosreport=False, if collect_sosreport: if 'rhel' in self.distro_name(): + host.host_run_command("yum install sos -y") cmd = 'yes "" | sosreport' str_msg = "Your sosreport has been generated and saved in:" elif 'sles' in self.distro_name(): @@ -2316,10 +2319,7 @@ def get_distro_src(self, package, dest_path, build_option=None, pack_dir=None): elif self.distro_name() == 'sles': host.host_run_command("zypper install -y rpm-build") - if package.startswith("kernel"): - s_cmd = f"zypper -n source-install kernel-source;cd /usr/src/packages/SOURCES/;./mkspec;cp {package}.spec ../SPECS/" - else: - s_cmd = f"zypper -n source-install {package};cd /usr/src/packages/SOURCES/;./mkspec;cp {package}.spec ../SPECS/" + s_cmd = f"zypper -n source-install {package};cd /usr/src/packages/SOURCES/;./mkspec;cp {package}.spec ../SPECS/" if host.host_run_command(s_cmd): spec_path = f"/usr/src/packages/SPECS/{package}.spec" @@ -2574,12 +2574,6 @@ def login(self, username=None, password=None): self.xAuthHeader['X-Auth-Token'] = match.group(1) self.jsonHeader.update(self.xAuthHeader) json_data = json.loads(r.text) - if json_data.get('token'): - json_data={ - "data": "User '%s' logged in" %username, - "message": "200 OK", - "status": "ok" - } log.debug("r.status_code={} json_data['status']={}" " r.text={} r.headers={} r.request.headers={}" .format(r.status_code, json_data['status'],