Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ Changed
Added
~~~~~
* added raw_string type to allow template strings to pass through variable processing (by @guzzijones12@gmail.com) #6351
* st2client now retries failed HTTP requests and times out instead of hanging when the API can't
be reached. Connection errors are retried for all requests; timeouts and 502 / 503 / 504
responses only for requests which are safe to send again (never ``POST``). Defaults: 3 retries
and a 10 second connect timeout. Configurable with ``--http-retries`` / ``--http-timeout``,
``ST2_HTTP_RETRIES`` / ``ST2_HTTP_TIMEOUT`` or ``http_retries`` / ``http_timeout`` in the
``[general]`` section of the CLI config. #6428 (by @Vipulucc115)

3.9.0 - October 10, 2025
------------------------
Expand Down
8 changes: 8 additions & 0 deletions conf/st2rc.sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ base_url = http://127.0.0.1
api_version = v1
# Path to the CA cert bundle used to validate the SSL certificates
cacert =
# Seconds to wait for the StackStorm API, both to connect and for each reply.
# If not set, connecting times out after 10 seconds and there is no limit on
# waiting for a reply.
# http_timeout = 30
# How many times a failed request is retried (default 3, 0 disables retrying).
# Connection errors are retried for all requests, timeouts and 502 / 503 / 504
# responses only for requests which are safe to send again (not POST).
# http_retries = 3

[cli]
debug = True
Expand Down
6 changes: 6 additions & 0 deletions st2client/st2client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
"api_version": ["general", "api_version"],
"api_key": ["credentials", "api_key"],
"cacert": ["general", "cacert"],
"timeout": ["general", "http_timeout"],
"retries": ["general", "http_retries"],
"debug": ["cli", "debug"],
"basic_auth": ["credentials", "basic_auth"],
}
Expand Down Expand Up @@ -101,6 +103,8 @@ def get_client(self, args, debug=False):
cli_options["cacert"] = True
elif cli_options["cacert"].lower() in ["false", "0", "f", "no"]:
cli_options["cacert"] = False
cli_options["timeout"] = getattr(args, "http_timeout", None)
cli_options["retries"] = getattr(args, "http_retries", None)
config_file_options = self._get_config_file_options(args=args)

kwargs = {}
Expand Down Expand Up @@ -402,6 +406,8 @@ def _authenticate_and_retrieve_auth_token(self, client, username, password):
client.endpoints["auth"],
cacert=client.cacert,
debug=client.debug,
timeout=client.timeout,
retries=client.retries,
)
instance = models.Token()
instance = manager.create(instance, auth=(username, password))
Expand Down
Loading
Loading