Skip to content

Commit a4eb408

Browse files
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 <[email protected]>
1 parent 199a1f0 commit a4eb408

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/host.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,10 @@ def pool_has_vm(self, vm_uuid, vm_type='vm'):
359359
else:
360360
return self.xe('vm-list', {'uuid': vm_uuid}, minimal=True) == vm_uuid
361361

362-
def install_updates(self):
362+
def install_updates(self, enablerepo=None):
363363
logging.info("Install updates on host %s" % self)
364-
return self.ssh(['yum', 'update', '-y'])
364+
enablerepo_cmd = ['--enablerepo=%s' % enablerepo] if enablerepo is not None else []
365+
return self.ssh(['yum', 'update', '-y'] + enablerepo_cmd)
365366

366367
def restart_toolstack(self, verify=False):
367368
logging.info("Restart toolstack on host %s" % self)
@@ -376,10 +377,11 @@ def is_enabled(self) -> bool:
376377
# If XAPI is not ready yet, or the host is down, this will throw. We return False in that case.
377378
return False
378379

379-
def has_updates(self):
380+
def has_updates(self, enablerepo=None):
381+
enablerepo_cmd = ['--enablerepo=%s' % enablerepo] if enablerepo is not None else []
380382
try:
381383
# yum check-update returns 100 if there are updates, 1 if there's an error, 0 if no updates
382-
self.ssh(['yum', 'check-update'])
384+
self.ssh(['yum', 'check-update'] + enablerepo_cmd)
383385
# returned 0, else there would have been a SSHCommandFailed
384386
return False
385387
except commands.SSHCommandFailed as e:

0 commit comments

Comments
 (0)