Skip to content
Merged
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
13 changes: 11 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,24 @@ Fixed
* Fix orquesta with items task performance issue. Workflow runtime increase significantly when a
with items task has many items and result in many retries on write conflicts. A distributed lock
is acquired before write operations to avoid write conflicts. (bug fix) Stackstorm/orquesta#125
* Fix a bug with some API endpoints returning 500 internal server error when an exception contained
unicode data. (bug fix) #4598

2.10.4 - March 15, 2019
-----------------------

Fixed
~~~~~

* Fix inadvertent regression in notifier service which would cause generic action trigger to only
be dispatched for completed states even if custom states were specified using
``action_sensor.emit_when`` config option. (bug fix)
Reported by Shu Sugimoto (@shusugmt). #4591
* Make sure we don't log auth token and api key inside st2api log file if those values are provided
via query parameter and not header (``?x-auth-token=foo``, ``?st2-api-key=bar``). (bug fix) #4592
#4589
* Fix rendering of config_context in orquesta task that references action in different pack.
(bug fix) #4570
* Fix rendering of ``{{ config_context. }}`` in orquesta task that references action from a
different pack (bug fix) #4570 #4567
* Add missing default config location (``/etc/st2/st2.conf``) to the following services:
``st2actionrunner``, ``st2scheduler``, ``st2workflowengine``. (bug fix) #4596
* Update statsd metrics driver so any exception thrown by statsd library is treated as non fatal.
Expand Down
2 changes: 1 addition & 1 deletion contrib/examples/actions/pythonactions/fibonacci.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def fib(n):
print(results)
except Exception as e:
traceback.print_exc(file=sys.stderr)
sys.exit(str(e))
sys.exit(six.text_type(e))
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ def run(self, content):
repo_url = "https://github.com" + repo_half_url
output[repo_name] = repo_url
except Exception as e:
raise Exception("Could not parse data: {}".format(str(e)))
raise Exception("Could not parse data: {}".format(six.text_type(e)))

return (True, output)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ def run(self, data_to_push):
# Push data to a service here
print(str(each_item))
except Exception as e:
raise Exception("Process failed: {}".format(str(e)))
raise Exception("Process failed: {}".format(six.text_type(e)))

return (True, "Data pushed successfully")
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def main(args):
try:
payload = transformer.to_json(command_stdout, command_stderr, command_exitcode)
except Exception as e:
sys.stderr.write('JSON conversion failed. %s' % str(e))
sys.stderr.write('JSON conversion failed. %s' % six.text_type(e))
sys.exit(1)

sys.stdout.write(payload)
Expand Down
3 changes: 2 additions & 1 deletion contrib/linux/actions/wait_for_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import time

import six
from oslo_config import cfg

from st2common.runners.base_action import Action
Expand Down Expand Up @@ -31,7 +32,7 @@ def run(self, hostname, port, username, password=None, keyfile=None, ssh_timeout
return True
except Exception as e:
self.logger.info('Attempt %s failed (%s), sleeping for %s seconds...' %
(attempt, str(e), sleep_delay))
(attempt, six.text_type(e), sleep_delay))
time.sleep(sleep_delay)

raise Exception('Exceeded max retries (%s)' % (retries))
5 changes: 4 additions & 1 deletion contrib/packs/actions/pack_mgmt/get_installed.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import os
import yaml

import six

from git.repo import Repo
from git.exc import InvalidGitRepositoryError

Expand Down Expand Up @@ -57,7 +59,8 @@ def run(self, pack):
try:
details = self._parse_yaml_file(metadata_file)
except Exception as e:
error = ('Pack "%s" doesn\'t contain a valid pack.yaml file: %s' % (pack, str(e)))
error = ('Pack "%s" doesn\'t contain a valid pack.yaml file: %s' % (pack,
six.text_type(e)))
raise Exception(error)

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
# limitations under the License.

from __future__ import absolute_import

import eventlet
import traceback
import uuid
import datetime

import six
from jsonschema import exceptions as json_schema_exc

from st2common.runners.base import ActionRunner
Expand Down Expand Up @@ -259,7 +261,7 @@ def pre_run(self):
expected_type=dict)
except Exception as e:
message = ('Failed to parse action chain definition from "%s": %s' %
(chainspec_file, str(e)))
(chainspec_file, six.text_type(e)))
LOG.exception('Failed to load action chain definition.')
raise runner_exc.ActionRunnerPreRunError(message)

Expand All @@ -268,11 +270,11 @@ def pre_run(self):
except json_schema_exc.ValidationError as e:
# preserve the whole nasty jsonschema message as that is better to get to the
# root cause
message = str(e)
message = six.text_type(e)
LOG.exception('Failed to instantiate ActionChain.')
raise runner_exc.ActionRunnerPreRunError(message)
except Exception as e:
message = str(e)
message = six.text_type(e)
LOG.exception('Failed to instantiate ActionChain.')
raise runner_exc.ActionRunnerPreRunError(message)

Expand All @@ -288,7 +290,7 @@ def pre_run(self):
try:
self.chain_holder.validate()
except Exception as e:
raise runner_exc.ActionRunnerPreRunError(str(e))
raise runner_exc.ActionRunnerPreRunError(six.text_type(e))

def run(self, action_parameters):
# Run the action chain.
Expand Down Expand Up @@ -610,7 +612,7 @@ def _run_chain(self, action_parameters, resuming=False):

def _format_error(self, e, msg):
return {
'error': '%s. %s' % (msg, str(e)),
'error': '%s. %s' % (msg, six.text_type(e)),
'traceback': traceback.format_exc(10)
}

Expand Down Expand Up @@ -657,7 +659,7 @@ def _render_publish_vars(action_node, action_parameters, execution_result,
key = getattr(e, 'key', None)
value = getattr(e, 'value', None)
msg = ('Failed rendering value for publish parameter "%s" in task "%s" '
'(template string=%s): %s' % (key, action_node.name, value, str(e)))
'(template string=%s): %s' % (key, action_node.name, value, six.text_type(e)))
raise action_exc.ParameterRenderingFailedException(msg)

return rendered_result
Expand Down Expand Up @@ -699,7 +701,7 @@ def _resolve_params(action_node, original_parameters, results, chain_vars, chain
key = getattr(e, 'key', None)
value = getattr(e, 'value', None)
msg = ('Failed rendering value for action parameter "%s" in task "%s" '
'(template string=%s): %s') % (key, action_node.name, value, str(e))
'(template string=%s): %s') % (key, action_node.name, value, six.text_type(e))
raise action_exc.ParameterRenderingFailedException(msg)
LOG.debug('Rendered params: %s: Type: %s', rendered_params, type(rendered_params))
return rendered_params
Expand Down
13 changes: 11 additions & 2 deletions contrib/runners/action_chain_runner/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,28 @@
# limitations under the License.

from __future__ import absolute_import

import os
import re
import sys

from distutils.version import StrictVersion

# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here
PY3 = sys.version_info[0] == 3

if PY3:
text_type = str
else:
text_type = unicode

GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python'

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('Failed to import pip: %s' % (text_type(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)
Expand All @@ -41,7 +50,7 @@
try:
from pip._internal.req.req_file import parse_requirements
except ImportError as e:
print('Failed to import parse_requirements from pip: %s' % (str(e)))
print('Failed to import parse_requirements from pip: %s' % (text_type(e)))
print('Using pip: %s' % (str(pip_version)))
sys.exit(1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ def test_chain_runner_publish_param_rendering_failure(self, request):
# rendering failure
expected_error = ('Failed rendering value for publish parameter "p1" in '
'task "c2" (template string={{ not_defined }}):')
self.assertTrue(expected_error in str(e))
self.assertTrue(expected_error in six.text_type(e))
pass
else:
self.fail('Exception was not thrown')
Expand Down
13 changes: 11 additions & 2 deletions contrib/runners/announcement_runner/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,28 @@
# limitations under the License.

from __future__ import absolute_import

import os
import re
import sys

from distutils.version import StrictVersion

# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here
PY3 = sys.version_info[0] == 3

if PY3:
text_type = str
else:
text_type = unicode

GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python'

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('Failed to import pip: %s' % (text_type(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)
Expand All @@ -41,7 +50,7 @@
try:
from pip._internal.req.req_file import parse_requirements
except ImportError as e:
print('Failed to import parse_requirements from pip: %s' % (str(e)))
print('Failed to import parse_requirements from pip: %s' % (text_type(e)))
print('Using pip: %s' % (str(pip_version)))
sys.exit(1)

Expand Down
13 changes: 11 additions & 2 deletions contrib/runners/http_runner/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,28 @@
# limitations under the License.

from __future__ import absolute_import

import os
import re
import sys

from distutils.version import StrictVersion

# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here
PY3 = sys.version_info[0] == 3

if PY3:
text_type = str
else:
text_type = unicode

GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python'

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('Failed to import pip: %s' % (text_type(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)
Expand All @@ -41,7 +50,7 @@
try:
from pip._internal.req.req_file import parse_requirements
except ImportError as e:
print('Failed to import parse_requirements from pip: %s' % (str(e)))
print('Failed to import parse_requirements from pip: %s' % (text_type(e)))
print('Using pip: %s' % (str(pip_version)))
sys.exit(1)

Expand Down
2 changes: 1 addition & 1 deletion contrib/runners/http_runner/http_runner/http_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def run(self, action_parameters):
try:
result = client.run()
except requests.exceptions.Timeout as e:
result = {'error': str(e)}
result = {'error': six.text_type(e)}
status = LIVEACTION_STATUS_TIMED_OUT
else:
status = HttpRunner._get_result_status(result.get('status_code', None))
Expand Down
13 changes: 11 additions & 2 deletions contrib/runners/inquirer_runner/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,28 @@
# limitations under the License.

from __future__ import absolute_import

import os
import re
import sys

from distutils.version import StrictVersion

# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here
PY3 = sys.version_info[0] == 3

if PY3:
text_type = str
else:
text_type = unicode

GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python'

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('Failed to import pip: %s' % (text_type(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)
Expand All @@ -41,7 +50,7 @@
try:
from pip._internal.req.req_file import parse_requirements
except ImportError as e:
print('Failed to import parse_requirements from pip: %s' % (str(e)))
print('Failed to import parse_requirements from pip: %s' % (text_type(e)))
print('Using pip: %s' % (str(pip_version)))
sys.exit(1)

Expand Down
13 changes: 11 additions & 2 deletions contrib/runners/local_runner/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,28 @@
# limitations under the License.

from __future__ import absolute_import

import os
import re
import sys

from distutils.version import StrictVersion

# NOTE: This script can't rely on any 3rd party dependency so we need to use this code here
PY3 = sys.version_info[0] == 3

if PY3:
text_type = str
else:
text_type = unicode

GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python'

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('Failed to import pip: %s' % (text_type(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)
Expand All @@ -41,7 +50,7 @@
try:
from pip._internal.req.req_file import parse_requirements
except ImportError as e:
print('Failed to import parse_requirements from pip: %s' % (str(e)))
print('Failed to import parse_requirements from pip: %s' % (text_type(e)))
print('Using pip: %s' % (str(pip_version)))
sys.exit(1)

Expand Down
Loading