Merge pull request #967 from PrzemekWirkus/devel_shell_plugin_update

Host test minor shell plugin update and bugfix
pull/974/head
Martin Kojtal 2015-03-13 15:29:47 +00:00
commit d477c486d2
2 changed files with 6 additions and 1 deletions

View File

@ -79,6 +79,7 @@ class HostTestPluginBase:
ret = call(cmd, shell=shell) ret = call(cmd, shell=shell)
if ret: if ret:
self.print_plugin_error("[ret=%d] Command: %s"% (int(ret), cmd)) self.print_plugin_error("[ret=%d] Command: %s"% (int(ret), cmd))
return False
except Exception as e: except Exception as e:
result = False result = False
self.print_plugin_error("[ret=%d] Command: %s"% (int(ret), cmd)) self.print_plugin_error("[ret=%d] Command: %s"% (int(ret), cmd))

View File

@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
""" """
import os
from os.path import join, basename from os.path import join, basename
from host_test_plugins import HostTestPluginBase from host_test_plugins import HostTestPluginBase
@ -25,7 +26,7 @@ class HostTestPluginCopyMethod_Shell(HostTestPluginBase):
name = 'HostTestPluginCopyMethod_Shell' name = 'HostTestPluginCopyMethod_Shell'
type = 'CopyMethod' type = 'CopyMethod'
stable = True stable = True
capabilities = ['cp', 'copy', 'xcopy'] capabilities = ['shell', 'cp', 'copy', 'xcopy']
required_parameters = ['image_path', 'destination_disk'] required_parameters = ['image_path', 'destination_disk']
def setup(self, *args, **kwargs): def setup(self, *args, **kwargs):
@ -45,6 +46,9 @@ class HostTestPluginCopyMethod_Shell(HostTestPluginBase):
# Prepare correct command line parameter values # Prepare correct command line parameter values
image_base_name = basename(image_path) image_base_name = basename(image_path)
destination_path = join(destination_disk, image_base_name) 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 == 'copy': if capabilitity == 'cp' or capabilitity == 'copy' or capabilitity == 'copy':
copy_method = capabilitity copy_method = capabilitity
cmd = [copy_method, image_path, destination_path] cmd = [copy_method, image_path, destination_path]