Use sudo when gather compute id information

Downstream computes are accessed via cloud-admin and does not have
access to /var/lib/nova/compute_id. Enable check via sudo to gather
compute uuid info.

Also remove trailing newline cat output of /var/lib/nova/compute_id file
before doing assert.

Change-Id: I6683727c31bd5a732ee463c72bc71d758ed37888
This commit is contained in:
jamepark4 2024-06-10 14:01:33 -04:00
parent d78d93803e
commit bdc7dfc00c

View File

@ -43,7 +43,9 @@ class TestStableCpuId(base.BaseWhiteboxComputeTest):
for hypervisor in hypervisors:
name = hypervisor['hypervisor_hostname']
ssh_client = clients.SSHClient(name)
uuid_on_disk = ssh_client.execute(f'cat {compute_id_path}')
uuid_on_disk = ssh_client.execute(f'cat {compute_id_path}',
sudo=True)
uuid_on_disk = uuid_on_disk.rstrip()
self.assertEqual(
hypervisor['id'],
uuid_on_disk,