Skip to content

Commit d15938d

Browse files
committed
fix swift action
1 parent 16fbe7f commit d15938d

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
CHANGES
22
=======
33

4+
1.0.32
5+
------
6+
7+
* fix swift symlink to json file
8+
9+
1.0.31
10+
------
11+
12+
* docu
13+
* handle exception
14+
* adds rudolf; extend gitignore; changelog
15+
416
1.0.30
517
------
618

watcher/cadf_strategy.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,38 @@ def determine_target_type_uri(self, req):
522522
uri = '/'.join(target_type_uri).lstrip('/')
523523
return self._add_prefix_target_type_uri(uri)
524524

525+
def determine_cadf_action(self, req, target_type_uri=None):
526+
"""
527+
determine the CADF action of a request
528+
529+
:param req: the request
530+
:param target_type_uri: (optional) the target type URI of the request path if already known.
531+
will attempt to determine otherwise
532+
:return: the CADF action of unknown
533+
"""
534+
cadf_action = taxonomy.UNKNOWN
535+
536+
try:
537+
# get the target type URI from request path if still unknown
538+
if common.is_none_or_unknown(target_type_uri):
539+
target_type_uri = self.determine_target_type_uri(req)
540+
541+
# lookup action in custom mapping if one exists
542+
if self.custom_action_config:
543+
custom_cadf_action = self._cadf_action_from_custom_action_config(target_type_uri, req.method, cadf_action)
544+
if not common.is_none_or_unknown(custom_cadf_action):
545+
cadf_action = custom_cadf_action
546+
547+
# if nothing was found, return cadf action based on request method and path
548+
if common.is_none_or_unknown(cadf_action):
549+
cadf_action = self._cadf_action_from_method_and_target_type_uri(req.method, target_type_uri)
550+
551+
except Exception as e:
552+
self.logger.debug("error while determining cadf action: {0}".format(str(e)))
553+
554+
finally:
555+
return cadf_action
556+
525557
def get_swift_account_container_object_id_from_path(self, path):
526558
path_regex = re.compile(
527559
r'/\S+AUTH_(?P<account_id>\S*?)(\/+?|$)'

watcher/watcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def get_target_project_id_from_keystone_token_info(self, token_info):
338338
finally:
339339
if project_id == taxonomy.UNKNOWN:
340340
self.logger.debug(
341-
"unable to get target.project_id for service type '{1}' from service catalog"
341+
"unable to get target.project_id '{0}' for service type '{1}' from service catalog"
342342
.format(project_id, self.service_type))
343343
else:
344344
self.logger.debug(

0 commit comments

Comments
 (0)