diff --git a/tests/cloud_tests/instances/base.py b/tests/cloud_tests/instances/base.py
index 9886cbc6..fb6fda45 100644
--- a/tests/cloud_tests/instances/base.py
+++ b/tests/cloud_tests/instances/base.py
@@ -22,6 +22,7 @@ class Instance(object):
self.properties = properties
self.config = config
self.features = features
+ self._tmp_count = 0
def execute(self, command, stdout=None, stderr=None, env=None,
rcs=None, description=None):
@@ -88,7 +89,7 @@ class Instance(object):
try:
self.write_data(script_path, script)
return self.execute(
- ['sudo', '/bin/bash', script_path], rcs=rcs,
+ ['/bin/bash', script_path], rcs=rcs,
description=description)
finally:
self.execute(['rm', '-f', script_path], rcs=rcs)
@@ -98,7 +99,7 @@ class Instance(object):
@return_value: path to new file in target
"""
- return self.execute(['mktemp'])[0].strip()
+ return "/tmp/%s-%04d" % (type(self).__name__, self._tmp_count)
def console_log(self):
"""Instance console.
diff --git a/tests/cloud_tests/instances/nocloudkvm.py b/tests/cloud_tests/instances/nocloudkvm.py
index 8a0e5319..cf5d5715 100644
--- a/tests/cloud_tests/instances/nocloudkvm.py
+++ b/tests/cloud_tests/instances/nocloudkvm.py
@@ -76,7 +76,7 @@ class NoCloudKVMInstance(base.Instance):
command = ['sh', '-c', command]
if self.pid:
- return self.ssh(command)
+ return self.ssh(['sudo'] + list(command))
else:
return self.mount_image_callback(command) + (0,)