Skip to content

Commit ce9b679

Browse files
rushikeshjadhavDatBewar
authored andcommitted
Add enablerepo support to yum update and check-update in Host methods
Tests that want to test linstor upgrade can enablerepo during execution Signed-off-by: Rushikesh Jadhav <rushikesh7@gmail.com>
1 parent 9ed5181 commit ce9b679

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lib/host.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,11 @@ def pool_has_vm(self, vm_uuid: str, vm_type: str = 'vm') -> bool:
480480
else:
481481
return self.xe('vm-list', {'uuid': vm_uuid}, minimal=True) == vm_uuid
482482

483+
def install_updates(self, enablerepo=None):
484+
logging.info("Install updates on host %s" % self)
485+
enablerepo_cmd = ['--enablerepo=%s' % enablerepo] if enablerepo is not None else []
486+
return self.ssh(f"yum update -y {enablerepo_cmd}")
487+
483488
def get_system_uuid(self) -> str:
484489
"""Get system uuid of current host.
485490
@@ -593,10 +598,11 @@ def is_enabled(self) -> bool:
593598
# If XAPI is not ready yet, or the host is down, this will throw. We return False in that case.
594599
return False
595600

596-
def has_updates(self) -> bool:
601+
def has_updates(self, enablerepo=None):
602+
enablerepo_cmd = ['--enablerepo=%s' % enablerepo] if enablerepo is not None else []
597603
try:
598604
# yum check-update returns 100 if there are updates, 1 if there's an error, 0 if no updates
599-
self.ssh('yum check-update')
605+
self.ssh(f"yum check-update {enablerepo_cmd}")
600606
# returned 0, else there would have been a SSHCommandFailed
601607
return False
602608
except commands.SSHCommandFailed as e:

0 commit comments

Comments
 (0)