Ejemplo n.º 1
0
    def get(self, plugin_id, **kwargs):
        """
        Download plugin archive
        """
        # Verify plugin exists.
        plugin = get_blueprints_manager().get_plugin(plugin_id)

        archive_name = plugin.archive_name
        # attempting to find the archive file on the file system
        local_path = _get_plugin_archive_path(plugin_id, archive_name)
        if not os.path.isfile(local_path):
            raise RuntimeError("Could not find plugins archive; "
                               "Plugin ID: {0}".format(plugin_id))

        plugin_path = '{0}/{1}/{2}/{3}'.format(
            config.instance().file_server_resources_uri,
            'plugins',
            plugin_id,
            archive_name)

        return make_streaming_response(
            plugin_id,
            plugin_path,
            os.path.getsize(local_path),
            'tar.gz'
        )
Ejemplo n.º 2
0
    def get(self, plugin_id, **kwargs):
        """
        Download plugin archive
        """
        # Verify plugin exists.
        plugin = get_blueprints_manager().get_plugin(plugin_id)

        archive_name = plugin.archive_name
        # attempting to find the archive file on the file system
        local_path = _get_plugin_archive_path(plugin_id, archive_name)
        if not os.path.isfile(local_path):
            raise RuntimeError("Could not find plugins archive; "
                               "Plugin ID: {0}".format(plugin_id))

        plugin_path = '{0}/{1}/{2}/{3}'.format(
            config.instance().file_server_resources_uri,
            'plugins',
            plugin_id,
            archive_name)

        return make_streaming_response(
            plugin_id,
            plugin_path,
            os.path.getsize(local_path),
            'tar.gz'
        )
Ejemplo n.º 3
0
    def get(self, snapshot_id):
        snap = get_blueprints_manager().get_snapshot(snapshot_id)
        if snap.status == models.Snapshot.FAILED:
            raise manager_exceptions.SnapshotActionError(
                'Failed snapshot cannot be downloaded')

        snapshot_path = os.path.join(_get_snapshot_path(snapshot_id),
                                     '{0}.zip'.format(snapshot_id))

        snapshot_uri = '{0}/{1}/{2}/{2}.zip'.format(
            config.instance().file_server_resources_uri,
            config.instance().file_server_snapshots_folder, snapshot_id)

        return make_streaming_response(snapshot_id, snapshot_uri,
                                       os.path.getsize(snapshot_path), 'zip')
Ejemplo n.º 4
0
    def get(self, snapshot_id):
        get_blueprints_manager().get_snapshot(snapshot_id)

        snapshot_path = os.path.join(
            _get_snapshot_path(snapshot_id),
            '{0}.zip'.format(snapshot_id)
        )

        snapshot_uri = '{0}/{1}/{2}/{2}.zip'.format(
            config.instance().file_server_resources_uri,
            config.instance().file_server_snapshots_folder,
            snapshot_id
        )

        return make_streaming_response(
            snapshot_id,
            snapshot_uri,
            os.path.getsize(snapshot_path),
            'zip'
        )
Ejemplo n.º 5
0
    def get(self, snapshot_id):
        get_blueprints_manager().get_snapshot(snapshot_id)

        snapshot_path = os.path.join(
            _get_snapshot_path(snapshot_id),
            '{0}.zip'.format(snapshot_id)
        )

        snapshot_uri = '{0}/{1}/{2}/{2}.zip'.format(
            config.instance().file_server_resources_uri,
            config.instance().file_server_snapshots_folder,
            snapshot_id
        )

        return make_streaming_response(
            snapshot_id,
            snapshot_uri,
            os.path.getsize(snapshot_path),
            'zip'
        )
Ejemplo n.º 6
0
    def get(self, snapshot_id):
        snap = get_blueprints_manager().get_snapshot(snapshot_id)
        if snap.status == models.Snapshot.FAILED:
            raise manager_exceptions.SnapshotActionError(
                'Failed snapshot cannot be downloaded'
            )

        snapshot_path = os.path.join(
            _get_snapshot_path(snapshot_id),
            '{0}.zip'.format(snapshot_id)
        )

        snapshot_uri = '{0}/{1}/{2}/{2}.zip'.format(
            config.instance().file_server_resources_uri,
            config.instance().file_server_snapshots_folder,
            snapshot_id
        )

        return make_streaming_response(
            snapshot_id,
            snapshot_uri,
            os.path.getsize(snapshot_path),
            'zip'
        )