Example #1
0
    def ensure_filename_reference(self, filename, checksum):
	logger.debug("Ensuring filename reference %s for file %s" % \
			(checksum, filename))
        reference_path = self._reference_path_from_filename(filename)
        ensure_directory(os.path.dirname(reference_path))
        with open(reference_path, 'w') as f:
            f.write(checksum)
Example #2
0
    def test_ensure_directory_uses_conn_if_provided(self):
        conn = Mock()
        conn.modules.os.path.exists.return_value = False

        ensure_directory('dir', conn)

        conn.modules.os.path.exists.assert_called_once_with('dir')
        conn.modules.os.makedirs.assert_called_once_with('dir')
Example #3
0
    def ensure_directory(self, path):
	ensure_directory(path, self.rpyc_conn)
Example #4
0
def create_host_buffer(host):
    logger.debug("Creating host buffer for host %s" % host)
    buffer_path = os.path.join(MESSOR_BUFFER, "hosts", host)
    ensure_directory(buffer_path)
Example #5
0
    def test_ensure_directory_not_mks_dir_if_exists(self):
        self.exists.return_value = True

        ensure_directory('dir')

	self.assertEqual(0, len(self.makedirs.mock_calls))
Example #6
0
    def test_ensure_directory_mks_dir_if_not_exists(self):
        self.exists.return_value = False

        ensure_directory('dir')

	self.makedirs.assert_called_once_with('dir')