Skip to content

Commit 46014d9

Browse files
committed
fix detail route appending to get actions
1 parent 6364e1d commit 46014d9

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

actions/base_get_action.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ def run(self, endpoint_uri, **kwargs):
1414
endpoint_uri is pased from metadata file
1515
"""
1616

17+
if kwargs.get('id', False):
18+
# modify the `endpoint_uri` to use the detail route
19+
endpoint_uri = '{}{}/'.format(endpoint_uri, str(kwargs.pop('id')))
20+
self.logger.debug(
21+
'endpoint_uri transformed to {} because id was passed'.format(endpoint_uri)
22+
)
23+
1724
if kwargs.get('save_in_key_store') and not kwargs.get('save_in_key_store_key_name'):
1825
return (False, 'save_in_key_store_key_name MUST be used with save_in_key_store!')
1926

@@ -28,4 +35,4 @@ def run(self, endpoint_uri, **kwargs):
2835

2936
return (True, "Result stored in st2 key {}".format(key_name))
3037

31-
return self.get(endpoint_uri, **kwargs)
38+
return result

actions/lib/action.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ def _make_request(self, endpoint_uri, http_action, **kwargs):
2424
else:
2525
url = 'http://'
2626

27-
if kwargs.get('id', False):
28-
# modify the `endpoint_uri` to use the detail route
29-
endpoint_uri = '{}{}/'.format(endpoint_uri, str(kwargs.pop('id')))
30-
self.logger.debug(
31-
'endpoint_uri transformed to {} because id was passed'.format(endpoint_uri)
32-
)
33-
3427
url = url + self.config['hostname'] + endpoint_uri
3528

3629
headers = {

0 commit comments

Comments
 (0)