コード例 #1
0
 def test_run_command_string_unsafe_with_double_redirect_out(self):
     tmp_fd, tmp_path = tempfile.mkstemp()
     try:
         (rc, out, err) = self.module.run_command('echo "foo bar" >> %s' % tmp_path, use_unsafe_shell=True)
         self.assertEqual(rc, 0)
         self.assertTrue(os.path.exists(tmp_path))
         checksum = utils_checksum(tmp_path)
         self.assertEqual(checksum, 'd53a205a336e07cf9eac45471b3870f9489288ec')
     except:
         raise
     finally:
         self.cleanup_temp_file(tmp_fd, tmp_path)
コード例 #2
0
 def test_run_command_string_unsafe_with_double_redirect_out(self):
     tmp_fd, tmp_path = tempfile.mkstemp()
     try:
         (rc, out, err) = self.module.run_command('echo "foo bar" >> %s' % tmp_path, use_unsafe_shell=True)
         self.assertEqual(rc, 0)
         self.assertTrue(os.path.exists(tmp_path))
         checksum = utils_checksum(tmp_path)
         self.assertEqual(checksum, 'd53a205a336e07cf9eac45471b3870f9489288ec')
     except:
         raise
     finally:
         self.cleanup_temp_file(tmp_fd, tmp_path)