Skip to content

Commit

Permalink
Enabled global storlet filters
Browse files Browse the repository at this point in the history
  • Loading branch information
JosepSampe committed Oct 6, 2017
1 parent e19b29b commit 7bc9810
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
28 changes: 20 additions & 8 deletions api/filters/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,15 +482,27 @@ def set_filter(r, target, filter_data, parameters, token):

try:
project_id = target.split('/', 3)[0]
swift_response = dict()
url = settings.SWIFT_URL + settings.SWIFT_API_VERSION + "/AUTH_" + project_id
storlet_file = open(filter_data["path"], 'r')
swift_client.put_object(url, token, "storlet",
filter_data["filter_name"],
storlet_file, None,
None, None, "application/octet-stream",
metadata, None, None, None, swift_response)

if project_id == 'global':
projects_crystal_enabled = r.lrange('projects_crystal_enabled', 0, -1)
for project_id in projects_crystal_enabled:
swift_response = dict()
url = settings.SWIFT_URL + settings.SWIFT_API_VERSION + "/AUTH_" + project_id
storlet_file = open(filter_data["path"], 'r')
swift_client.put_object(url, token, "storlet",
filter_data["filter_name"],
storlet_file, None,
None, None, "application/octet-stream",
metadata, None, None, None, swift_response)
else:
swift_response = dict()
url = settings.SWIFT_URL + settings.SWIFT_API_VERSION + "/AUTH_" + project_id
storlet_file = open(filter_data["path"], 'r')
swift_client.put_object(url, token, "storlet",
filter_data["filter_name"],
storlet_file, None,
None, None, "application/octet-stream",
metadata, None, None, None, swift_response)
except Exception as e:
logging.error(str(e))
raise SwiftClientError("A problem occurred accessing Swift")
Expand Down
1 change: 0 additions & 1 deletion api/policies/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ def deploy_static_policy(request, r, parsed_rule):
token = get_token_connection(request)
container = None
rules_to_parse = dict()
# TODO: get only the Crystal enabled projects
projects_crystal_enabled = r.lrange('projects_crystal_enabled', 0, -1)
project_list = get_project_list()

Expand Down

0 comments on commit 7bc9810

Please sign in to comment.