diff options
Diffstat (limited to 'yardstick/benchmark/scenarios/networking/ping.py')
-rw-r--r-- | yardstick/benchmark/scenarios/networking/ping.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py index 2becdaf36..b41aa0d94 100644 --- a/yardstick/benchmark/scenarios/networking/ping.py +++ b/yardstick/benchmark/scenarios/networking/ping.py @@ -79,9 +79,10 @@ class Ping(base.Scenario): target_vm = self.scenario_cfg['target'] LOG.debug("ping '%s' '%s'", options, dest) - exit_status, stdout, stderr = self.connection.execute( - "/bin/sh -s {0} {1}".format(dest, options), - stdin=open(self.target_script, "r")) + with open(self.target_script, "r") as stdin_file: + exit_status, stdout, stderr = self.connection.execute( + "/bin/sh -s {0} {1}".format(dest, options), + stdin=stdin_file) if exit_status != 0: raise RuntimeError(stderr) |