Change install_updates according to new way of updating Fuel Master
Change-Id: Idd383bdc84fa4ed4f1a43bb11c308f2a296316d7 Closes-Bug: #1621842
This commit is contained in:
parent
3d02bb43e9
commit
e6f4e01ae5
@ -13,7 +13,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from devops.helpers.helpers import tcp_ping_
|
from devops.helpers.helpers import tcp_ping_
|
||||||
@ -620,54 +619,41 @@ class EnvironmentModel(six.with_metaclass(SingletonMeta, object)):
|
|||||||
def admin_install_updates(self):
|
def admin_install_updates(self):
|
||||||
"""Update packages using yum and install updates via
|
"""Update packages using yum and install updates via
|
||||||
update-master-node.sh tool"""
|
update-master-node.sh tool"""
|
||||||
logger.info('Searching for updates..')
|
logger.info('Searching for python-cudet package')
|
||||||
update_command = 'yum clean expire-cache && ' \
|
|
||||||
'yum update -y 2>>/var/log/yum-update-error.log'
|
|
||||||
|
|
||||||
logger.info('Performing yum clean and update commands')
|
search_command = 'yum search python-cudet'
|
||||||
update_result = self.ssh_manager.execute_on_remote(
|
|
||||||
|
search_result = self.ssh_manager.check_call(
|
||||||
ip=self.ssh_manager.admin_ip,
|
ip=self.ssh_manager.admin_ip,
|
||||||
cmd=update_command,
|
command=search_command)
|
||||||
err_msg='Packages update failed, inspect logs for details')
|
|
||||||
|
|
||||||
logger.info('Packages were updated successfully')
|
assert_true(
|
||||||
|
"Warning: No matches found for: " not in search_result.stderr_str,
|
||||||
|
"python-cudet wasn't found")
|
||||||
|
|
||||||
# Check if any packets were updated and update was successful
|
install_command = 'yum install -y python-cudet'
|
||||||
match_updated_count = re.search(r'Upgrade\s+(\d+)\s+Package',
|
|
||||||
update_result['stdout_str'])
|
|
||||||
# In case of package replacement, the new one is marked as
|
|
||||||
# installed and the old one as removed
|
|
||||||
match_installed_count = re.search(r'Install\s+(\d+)\s+Package',
|
|
||||||
update_result['stdout_str'])
|
|
||||||
match_complete_message = re.search(r'Complete!',
|
|
||||||
update_result['stdout_str'])
|
|
||||||
|
|
||||||
match_no_updates = re.search("No Packages marked for Update",
|
self.ssh_manager.check_call(
|
||||||
update_result['stdout_str'])
|
|
||||||
|
|
||||||
if match_no_updates or not match_complete_message \
|
|
||||||
or not (match_updated_count or match_installed_count):
|
|
||||||
logger.warning('No updates were found or update was incomplete.')
|
|
||||||
return
|
|
||||||
|
|
||||||
updates_count = 0
|
|
||||||
|
|
||||||
if match_updated_count:
|
|
||||||
updates_count += int(match_updated_count.group(1))
|
|
||||||
|
|
||||||
if match_installed_count:
|
|
||||||
updates_count += int(match_installed_count.group(1))
|
|
||||||
|
|
||||||
logger.info('{0} package(s) were updated'.format(updates_count))
|
|
||||||
|
|
||||||
logger.info('Applying updates via update-master-node.sh')
|
|
||||||
cmd = '/usr/share/fuel-utils/update-master-node.sh'
|
|
||||||
|
|
||||||
self.ssh_manager.execute_on_remote(
|
|
||||||
ip=self.ssh_manager.admin_ip,
|
ip=self.ssh_manager.admin_ip,
|
||||||
cmd=cmd,
|
command=install_command,
|
||||||
err_msg='Update failed, inspect logs for details',
|
verbose=True)
|
||||||
)
|
|
||||||
|
logger.info('prepare Fuel node for updating')
|
||||||
|
prepare_command = 'update-prepare prepare master'
|
||||||
|
|
||||||
|
self.ssh_manager.check_call(
|
||||||
|
ip=self.ssh_manager.admin_ip,
|
||||||
|
command=prepare_command,
|
||||||
|
verbose=True)
|
||||||
|
|
||||||
|
logger.info('update Fuel node')
|
||||||
|
update_command = 'update-prepare update master'
|
||||||
|
|
||||||
|
self.ssh_manager.check_call(
|
||||||
|
ip=self.ssh_manager.admin_ip,
|
||||||
|
command=update_command,
|
||||||
|
verbose=True)
|
||||||
|
|
||||||
logger.info('Update successful')
|
logger.info('Update successful')
|
||||||
|
|
||||||
# Modifies a resolv.conf on the Fuel master node and returns
|
# Modifies a resolv.conf on the Fuel master node and returns
|
||||||
|
Loading…
Reference in New Issue
Block a user