Skip to content

Commit e7651e8

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 78872ea commit e7651e8

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
@@ -606,10 +611,11 @@ def is_enabled(self) -> bool:
606611
# If XAPI is not ready yet, or the host is down, this will throw. We return False in that case.
607612
return False
608613

609-
def has_updates(self) -> bool:
614+
def has_updates(self, enablerepo=None):
615+
enablerepo_cmd = ['--enablerepo=%s' % enablerepo] if enablerepo is not None else []
610616
try:
611617
# yum check-update returns 100 if there are updates, 1 if there's an error, 0 if no updates
612-
self.ssh('yum check-update')
618+
self.ssh(f"yum check-update {enablerepo_cmd}")
613619
# returned 0, else there would have been a SSHCommandFailed
614620
return False
615621
except commands.SSHCommandFailed as e:

0 commit comments

Comments
 (0)