Added 'sync' command after shell copy execution for posix OS

pull/1298/head
Przemek Wirkus 2015-08-14 14:53:50 +01:00
parent 074809da0f
commit 2875d4bffa
1 changed files with 12 additions and 9 deletions

View File

@ -34,13 +34,13 @@ class HostTestPluginCopyMethod_Shell(HostTestPluginBase):
"""
return True
def execute(self, capabilitity, *args, **kwargs):
def execute(self, capability, *args, **kwargs):
""" Executes capability by name.
Each capability may directly just call some command line
program or execute building pythonic function
"""
result = False
if self.check_parameters(capabilitity, *args, **kwargs) is True:
if self.check_parameters(capability, *args, **kwargs) is True:
image_path = kwargs['image_path']
destination_disk = kwargs['destination_disk']
# Wait for mount point to be ready
@ -48,14 +48,17 @@ class HostTestPluginCopyMethod_Shell(HostTestPluginBase):
# Prepare correct command line parameter values
image_base_name = basename(image_path)
destination_path = join(destination_disk, image_base_name)
if capabilitity == 'shell':
if os.name == 'nt': capabilitity = 'copy'
elif os.name == 'posix': capabilitity = 'cp'
if capabilitity == 'cp' or capabilitity == 'copy' or capabilitity == 'xcopy':
copy_method = capabilitity
if capability == 'shell':
if os.name == 'nt': capability = 'copy'
elif os.name == 'posix': capability = 'cp'
if capability == 'cp' or capability == 'copy' or capability == 'copy':
copy_method = capability
cmd = [copy_method, image_path, destination_path]
shell = not capabilitity == 'cp'
result = self.run_command(cmd, shell=shell)
if os.name == 'posix':
result = self.run_command(cmd, shell=False)
result = self.run_command(["sync"])
else:
result = self.run_command(cmd)
return result