コード例 #1
0
    def test_transfer_local(self):
        tmpPath = tempfile.mkdtemp() 
        self.system['local']['imageDir'] = tmpPath
        self.system['ssh']['imageDir'] = tmpPath
       
        self.system['accesstype'] = 'local'

        transfer.transfer(self.system, __file__)

        ## make sure transferred file exists
        dir,fname = os.path.split(__file__)
        filePath = os.path.join(tmpPath, fname)
        assert os.path.exists(filePath)

        self.inodes = 0
        os.path.walk(tmpPath, self.inodeCounter, None)
        assert self.inodes == 1
        os.unlink(filePath)

        dname,fname = os.path.split(__file__)
        meta = os.path.join(dname, '__init__.py')
        
        transfer.transfer(self.system, __file__, meta)
        self.inodes = 0
        os.path.walk(tmpPath, self.inodeCounter, None)
        assert self.inodes == 2

        filePath = os.path.join(tmpPath, fname)
        metaPath = os.path.join(tmpPath, '__init__.py')

        os.unlink(filePath)
        os.unlink(metaPath)
        os.rmdir(tmpPath)
コード例 #2
0
ファイル: transfer_test.py プロジェクト: tristan0x/shifter
    def test_transfer_local(self):
        tmp_path = tempfile.mkdtemp()
        self.system['local']['imageDir'] = tmp_path
        self.system['ssh']['imageDir'] = tmp_path

        self.system['accesstype'] = 'local'

        transfer.transfer(self.system, __file__)

        ## make sure transferred file exists
        fname = os.path.split(__file__)[1]
        file_path = os.path.join(tmp_path, fname)
        assert os.path.exists(file_path)

        self.inodes = 0
        os.path.walk(tmp_path, self.inode_counter, None)
        assert self.inodes == 1
        os.unlink(file_path)

        dname, fname = os.path.split(__file__)
        meta = os.path.join(dname, '__init__.py')

        transfer.transfer(self.system, __file__, meta)
        self.inodes = 0
        os.path.walk(tmp_path, self.inode_counter, None)
        assert self.inodes == 2

        file_path = os.path.join(tmp_path, fname)
        meta_path = os.path.join(tmp_path, '__init__.py')

        os.unlink(file_path)
        os.unlink(meta_path)
        os.rmdir(tmp_path)
コード例 #3
0
ファイル: transfer_test.py プロジェクト: NERSC/shifter
    def test_transfer_local(self):
        tmp_path = tempfile.mkdtemp()
        self.system['local']['imageDir'] = tmp_path
        self.system['ssh']['imageDir'] = tmp_path

        self.system['accesstype'] = 'local'

        transfer.transfer(self.system, __file__)

        # make sure transferred file exists
        fname = os.path.split(__file__)[1]
        file_path = os.path.join(tmp_path, fname)
        self.assertTrue(os.path.exists(file_path))

        self.inodes = 0
        os.path.walk(tmp_path, self.inode_counter, None)
        self.assertEquals(self.inodes, 1)
        os.unlink(file_path)

        dname, fname = os.path.split(__file__)
        meta = os.path.join(dname, '__init__.py')

        transfer.transfer(self.system, __file__, meta)
        self.inodes = 0
        os.path.walk(tmp_path, self.inode_counter, None)
        self.assertEquals(self.inodes, 2)

        file_path = os.path.join(tmp_path, fname)
        meta_path = os.path.join(tmp_path, '__init__.py')

        os.unlink(file_path)
        os.unlink(meta_path)
        os.rmdir(tmp_path)
コード例 #4
0
ファイル: imageworker.py プロジェクト: bne86/shifter
def transfer_image(request, meta_only=False):
    """
    Transfers the image to the target system based on the configuration.

    Returns True on success
    """
    system = request['system']
    if system not in CONFIG['Platforms']:
        raise KeyError('%s is not in the configuration' % system)
    sysconf = CONFIG['Platforms'][system]
    meta = None
    if 'metafile' in request:
        meta = request['metafile']
    if meta_only:
        request['meta']['meta_only'] = True
        return transfer.transfer(sysconf, None, meta, logging)
    else:
        return transfer.transfer(sysconf, request['imagefile'], meta, logging)
コード例 #5
0
ファイル: imageworker.py プロジェクト: tristan0x/shifter
def transfer_image(request, meta_only=False):
    """
    Transfers the image to the target system based on the configuration.

    Returns True on success
    """
    system = request['system']
    if system not in CONFIG['Platforms']:
        raise KeyError('%s is not in the configuration' % system)
    sysconf = CONFIG['Platforms'][system]
    meta = None
    if 'metafile' in request:
        meta = request['metafile']
    if meta_only:
        request['meta']['meta_only'] = True
        return transfer.transfer(sysconf, None, meta, logging)
    else:
        return transfer.transfer(sysconf, request['imagefile'], meta, logging)