Add checking of existing script file on node in run_upgrade_script.
Move untar method from checkers to fuel_actions.AdminActions Use decorator retry for untar method. Delete context manager from upgrade_master. Change-Id: Ia5ff27bb54b4ce61caf1576c33d8a3bb838586e3 Closes-Bug: #1498353
This commit is contained in:
parent
e0fd4fe0a7
commit
99f739a1cc
|
@ -263,19 +263,11 @@ def check_file_exists(node_ssh, path):
|
|||
'Can not find {0}'.format(path))
|
||||
|
||||
|
||||
@logwrap
|
||||
def untar(node_ssh, name, path):
|
||||
filename, ext = os.path.splitext(name)
|
||||
cmd = "tar -xpvf" if ext.endswith("tar") else "lrzuntar"
|
||||
result = ''.join(node_ssh.execute(
|
||||
'cd {0} && {2} {1}'.format(path, name, cmd))['stdout'])
|
||||
logger.debug('Result from tar command is {0}'.format(result))
|
||||
|
||||
|
||||
@logwrap
|
||||
def run_script(node_ssh, script_path, script_name, password='admin',
|
||||
rollback=False, exit_code=0):
|
||||
path = os.path.join(script_path, script_name)
|
||||
check_file_exists(node_ssh, path)
|
||||
c_res = node_ssh.execute('chmod 755 {0}'.format(path))
|
||||
logger.debug("Result of cmod is {0}".format(c_res))
|
||||
if rollback:
|
||||
|
|
|
@ -26,6 +26,7 @@ from proboscis.asserts import assert_equal
|
|||
from fuelweb_test import logger
|
||||
from fuelweb_test import logwrap
|
||||
from fuelweb_test.helpers import checkers
|
||||
from fuelweb_test.helpers.decorators import retry
|
||||
|
||||
from fuelweb_test.helpers.regenerate_repo import regenerate_centos_repo
|
||||
from fuelweb_test.helpers.regenerate_repo import regenerate_ubuntu_repo
|
||||
|
@ -242,6 +243,19 @@ class AdminActions(BaseActions):
|
|||
"find /var/www/nailgun/targetimages/ -name 'env*{}*'"
|
||||
" -delete".format(distro.lower()))
|
||||
|
||||
@logwrap
|
||||
@retry(2)
|
||||
def untar(self, node_ssh, name, path):
|
||||
logger.info('Unpacking file')
|
||||
filename, ext = os.path.splitext(name)
|
||||
cmd = "tar -xpvf" if ext.endswith("tar") else "lrzuntar"
|
||||
result = node_ssh.execute(
|
||||
'cd {0} && {2} {1}'.format(path, name, cmd))
|
||||
stdout, stderr = ''.join(result['stdout']), ''.join(result['stderr'])
|
||||
logger.debug('Result from tar command is {0}\n{1}'.format(stdout,
|
||||
stderr))
|
||||
assert_equal(result['exit_code'], 0)
|
||||
|
||||
def upgrade_master_node(self):
|
||||
"""This method upgrades master node with current state."""
|
||||
|
||||
|
@ -252,8 +266,7 @@ class AdminActions(BaseActions):
|
|||
'/var',
|
||||
os.path.basename(hlp_data.
|
||||
TARBALL_PATH)))
|
||||
checkers.untar(master, os.path.basename(hlp_data.TARBALL_PATH),
|
||||
'/var')
|
||||
self.untar(master, os.path.basename(hlp_data.TARBALL_PATH), '/var')
|
||||
|
||||
keystone_pass = hlp_data.KEYSTONE_CREDS['password']
|
||||
checkers.run_script(master, '/var', 'upgrade.sh',
|
||||
|
|
Loading…
Reference in New Issue