Revision 24d1788b

b/snf-tools/synnefo_tools/burnin/__init__.py
190 190
        help="Turn off log output and only print the contents of the log "
191 191
             "file at the end of the test. Useful when burnin is used in "
192 192
             "script files and it's output is to be sent using email")
193
    parser.add_option(
194
        "--temp-directory", action="store",
195
        default="/tmp/", dest="temp_directory",
196
        help="Directory to use for saving temporary files")
193 197

  
194 198
    (opts, args) = parser.parse_args(args)
195 199

  
b/snf-tools/synnefo_tools/burnin/common.py
36 36

  
37 37
"""
38 38

  
39
import os
40 39
import re
41 40
import shutil
42 41
import unittest
......
194 193
    images = None
195 194
    flavors = None
196 195
    delete_stale = False
196
    temp_directory = None
197 197

  
198 198
    quotas = Proper(value=None)
199 199

  
......
271 271
        return username
272 272

  
273 273
    def _create_tmp_directory(self):
274
        """Create a tmp directory
275

  
276
        In my machine /tmp has not enough space for an image
277
        to be saves, so we are going to use the current directory.
278

  
279
        """
280
        temp_dir = tempfile.mkdtemp(dir=os.getcwd())
274
        """Create a tmp directory"""
275
        temp_dir = tempfile.mkdtemp(dir=self.temp_directory)
281 276
        self.info("Temp directory %s created", temp_dir)
282 277
        return temp_dir
283 278

  
......
574 569
    BurninTests.flavors = opts.flavors
575 570
    BurninTests.images = opts.images
576 571
    BurninTests.delete_stale = opts.delete_stale
572
    BurninTests.temp_directory = opts.temp_directory
577 573
    BurninTests.run_id = SNF_TEST_PREFIX + \
578 574
        datetime.datetime.strftime(curr_time, "%Y%m%d%H%M%S")
579 575

  
b/snf-tools/synnefo_tools/burnin/pithos_tests.py
85 85
    def test_004_upload_file(self):
86 86
        """Test uploading a txt file to Pithos"""
87 87
        # Create a tmp file
88
        with tempfile.TemporaryFile() as fout:
88
        with tempfile.TemporaryFile(dir=self.temp_directory) as fout:
89 89
            fout.write("This is a temp file")
90 90
            fout.seek(0, 0)
91 91
            # Upload the file,
......
97 97
    def test_005_download_file(self):
98 98
        """Test downloading the file from Pithos"""
99 99
        # Create a tmp directory to save the file
100
        with tempfile.TemporaryFile() as fout:
100
        with tempfile.TemporaryFile(dir=self.temp_directory) as fout:
101 101
            self.clients.pithos.download_object("test.txt", fout)
102 102
            # Now read the file
103 103
            fout.seek(0, 0)

Also available in: Unified diff