- install_cmd = 'ssh {mgmt_ip} -q -n -o BatchMode=yes -o StrictHostKeyChecking=no -- sudo yum install sysstat --assumeyes'.format(
- mgmt_ip=mgmt_session.host,
- )
+ get_platform_cmd = 'ssh {host} -q -n -o BatchMode=yes -o StrictHostKeyChecking=no -- python3 -mplatform'
+ platform_result = subprocess.check_output(get_platform_cmd.format(host=mgmt_session.host), shell=True)
+ platform_match = re.search('(Ubuntu|fedora)-(\d+)', platform_result.decode('ascii'))
+ assert platform_match is not None
+ (dist, ver) = platform_match.groups()
+ if dist == 'fedora':
+ install_cmd = 'ssh {host} -q -n -o BatchMode=yes -o StrictHostKeyChecking=no -- sudo yum install sysstat --assumeyes'.format(
+ host=mgmt_session.host,
+ )
+ elif dist == 'Ubuntu':
+ install_cmd = 'ssh {host} -q -n -o BatchMode=yes -o StrictHostKeyChecking=no -- sudo apt-get -q -y install sysstat'.format(
+ host=mgmt_session.host,
+ )