Skip to content

Commit 944e7cd

Browse files
David MeuDavidMeu
authored andcommitted
Merge branch 'master' into adding_get_by_ref
2 parents 89da5c1 + 38012c9 commit 944e7cd

File tree

11 files changed

+66
-14
lines changed

11 files changed

+66
-14
lines changed

CHANGELOG.rst

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,26 @@ Changelog
44
in development
55
--------------
66

7+
Fixed
8+
~~~~~
9+
10+
* Fix Type error for ``time_diff`` critera comparison. convert the timediff value as float to match
11+
``timedelta.total_seconds()`` return. #5462
12+
13+
Contributed by @blackstrip
14+
715
Added
816
~~~~~
917

10-
* Added st2 API get action parameters by ref.
18+
* Added st2 API get action parameters by ref. #5509
1119

1220
API endpoint ``/api/v1/actions/views/parameters/{action_id}`` takes now ``ref_or_id``.
1321

1422
Contributed by @DavidMeu
1523

16-
Added
17-
~~~~~
24+
* Enable setting ttl for MockDatastoreService. #5468
25+
26+
Contributed by @ytjohn
1827

1928
* Added st2 API and CLI command for actions clone operation.
2029

@@ -39,6 +48,10 @@ Added
3948

4049
Contributed by @khushboobhatia01
4150

51+
* Added pysocks python package for SOCKS proxy support. #5460
52+
53+
Contributed by @kingsleyadam
54+
4255
Fixed
4356
~~~~~
4457

@@ -48,6 +61,10 @@ Fixed
4861

4962
* Fix ``st2-self-check`` script reporting falsey success when the nested workflows runs failed. #5487
5063

64+
* Use byte type lock name which is supported by all tooz drivers. #5529
65+
66+
Contributed by @khushboobhatia01
67+
5168
3.6.0 - October 29, 2021
5269
------------------------
5370

@@ -4215,4 +4232,4 @@ v0.5.1 - November 3rd, 2014
42154232
Added
42164233
~~~~~
42174234

4218-
* Initial public release
4235+
* Initial public release

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ check-python-packages-nightly:
269269
@echo ""
270270

271271
test -f $(VIRTUALENV_COMPONENTS_DIR)/bin/activate || $(PYTHON_VERSION) -m venv $(VIRTUALENV_COMPONENTS_DIR) --system-site-packages
272+
$(VIRTUALENV_COMPONENTS_DIR)/bin/pip install wheel
272273
@for component in $(COMPONENTS_WITHOUT_ST2TESTS); do \
273274
echo "==========================================================="; \
274275
echo "Checking component:" $$component; \

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pyinotify==0.9.6; platform_system=="Linux"
5050
pymongo==3.11.3
5151
pyparsing<3
5252
pyrabbit
53+
pysocks
5354
python-dateutil==2.8.1
5455
python-editor==1.0.4
5556
python-json-logger

st2client/in-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ cryptography
1818
orjson
1919
# needed by requests
2020
chardet
21+
# required for SOCKS proxy support (HTTP_PROXY, HTTPS_PROXY, NO_PROXY)
22+
pysocks

st2client/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jsonschema==2.6.0
1515
orjson==3.5.2
1616
prettytable==2.1.0
1717
prompt-toolkit==1.0.15
18+
pysocks
1819
python-dateutil==2.8.1
1920
python-editor==1.0.4
2021
pytz==2021.1

st2common/st2common/openapi.yaml.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,15 +461,15 @@ paths:
461461
description: Unexpected error
462462
schema:
463463
$ref: '#/definitions/Error'
464-
/api/v1/actions/views/parameters/{action_id}:
464+
/api/v1/actions/views/parameters/{ref_or_id}:
465465
get:
466466
operationId: st2api.controllers.v1.action_views:parameters_view_controller.get_one
467467
description: |
468468
Get parameters for an action.
469469
parameters:
470-
- name: action_id
470+
- name: ref_or_id
471471
in: path
472-
description: Entity id
472+
description: Entity reference or id
473473
type: string
474474
required: true
475475
x-parameters:

st2common/st2common/operators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def _timediff(diff_target, period_seconds, operator):
314314
# Note: date_utils.parse uses dateutil.parse which is way more flexible then strptime and
315315
# supports many date formats
316316
diff_target_utc = date_utils.parse(diff_target)
317-
return operator((utc_now - diff_target_utc).total_seconds(), period_seconds)
317+
return operator((utc_now - diff_target_utc).total_seconds(), float(period_seconds))
318318

319319

320320
def timediff_lt(value, criteria_pattern):

st2common/st2common/services/executions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def update_execution(liveaction_db, publish=True, set_result_size=False):
196196
"""
197197
execution = ActionExecution.get(liveaction__id=str(liveaction_db.id))
198198

199-
with coordination.get_coordinator().get_lock(str(liveaction_db.id)):
199+
with coordination.get_coordinator().get_lock(str(liveaction_db.id).encode()):
200200
# Skip execution object update when action is already in completed state.
201201
if execution.status in action_constants.LIVEACTION_COMPLETED_STATES:
202202
LOG.debug(

st2common/st2common/services/workflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ def handle_action_execution_completion(ac_ex_db):
938938
task_ex_id = ac_ex_db.context["orquesta"]["task_execution_id"]
939939

940940
# Acquire lock before write operations.
941-
with coord_svc.get_coordinator(start_heart=True).get_lock(wf_ex_id):
941+
with coord_svc.get_coordinator(start_heart=True).get_lock(str(wf_ex_id).encode()):
942942
# Get execution records for logging purposes.
943943
wf_ex_db = wf_db_access.WorkflowExecution.get_by_id(wf_ex_id)
944944
task_ex_db = wf_db_access.TaskExecution.get_by_id(task_ex_id)

st2common/tests/unit/test_operators.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,20 @@ def test_timediff_lt_fail(self):
943943
"Passed test_timediff_lt with None as criteria_pattern.",
944944
)
945945

946+
def test_timediff_lt_webui_value(self):
947+
op = operators.get_operator("timediff_lt")
948+
self.assertTrue(
949+
op(date_utils.get_datetime_utc_now().isoformat(), "10"),
950+
"Failed test_timediff_lt_webui_value.",
951+
)
952+
953+
def test_timediff_lt_webui_value_fail(self):
954+
op = operators.get_operator("timediff_lt")
955+
self.assertFalse(
956+
op("2014-07-01T00:01:01.000000", "10"),
957+
"Passed test_timediff_lt_webui_value.",
958+
)
959+
946960
def test_timediff_gt(self):
947961
op = operators.get_operator("timediff_gt")
948962
self.assertTrue(op("2014-07-01T00:01:01.000000", 1), "Failed test_timediff_gt.")
@@ -958,6 +972,20 @@ def test_timediff_gt_fail(self):
958972
"Passed test_timediff_gt with None as criteria_pattern.",
959973
)
960974

975+
def test_timediff_gt_webui_value(self):
976+
op = operators.get_operator("timediff_gt")
977+
self.assertTrue(
978+
op("2014-07-01T00:01:01.000000", "1"),
979+
"Failed test_timediff_gt_webui_value.",
980+
)
981+
982+
def test_timediff_gt_webui_value_fail(self):
983+
op = operators.get_operator("timediff_gt")
984+
self.assertFalse(
985+
op(date_utils.get_datetime_utc_now().isoformat(), "10"),
986+
"Passed test_timediff_gt_webui_value.",
987+
)
988+
961989
def test_exists(self):
962990
op = operators.get_operator("exists")
963991
self.assertTrue(op(False, None), "Should return True")

0 commit comments

Comments
 (0)