Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
80d0e60
WIP https://github.com/StackStorm/st2/issues/2442
Nov 10, 2016
df7ba2c
Move test_http_runner.py to unit directory.
warrenvw Nov 17, 2016
908986e
Add HTTPDigestAuth mock test
warrenvw Nov 17, 2016
b828980
Remove import requests from test_http_runner.py
warrenvw Nov 23, 2016
9b8ec01
Show which packs has been installed
Dec 2, 2016
5bfe7fe
Add "fail_on_failure" option to pack register API and fail on failure…
Kami Dec 2, 2016
a6d8593
Update "register_pack" method to throw on failure if fail_on_failure …
Kami Dec 2, 2016
6f87a3e
Map jsonschema.ValidationError to http 400 status code.
Kami Dec 2, 2016
2ef129e
Include pack name in the eception message.
Kami Dec 2, 2016
135d538
Update affected tests.
Kami Dec 2, 2016
a1e1a1e
Implement basic authentication for core.http
warrenvw Dec 2, 2016
e2f3842
Add tests for pack registration API endpoint fail on failure behavior.
Kami Dec 2, 2016
813d156
Pass the `output_path` directory to the shell command subprocess as t…
tim-ireland Dec 2, 2016
5c6a0f4
Add missing space
warrenvw Dec 2, 2016
646b0a5
reformat changelog
LindsayHill Dec 2, 2016
28c24ae
Reformatted changelog
LindsayHill Dec 2, 2016
c7ef5b8
Merge branch 'master' of https://github.com/StackStorm/st2 into basic…
warrenvw Dec 2, 2016
71b7359
Merge branch 'basic_auth'
warrenvw Dec 2, 2016
4f0a620
DZ feedback
LindsayHill Dec 3, 2016
589bcd2
Fixes #3063. Stopped directly accessing dict keys to avoid KeyError
nzlosh Dec 3, 2016
b6a6de7
Add step to delete st2tests dir. in st2-self-check script
Dec 4, 2016
dce094c
Merge pull request #3088 from StackStorm/fix_base_path_issue
Kami Dec 4, 2016
79be97a
Log a message when failing to parse config using the parent process a…
Kami Dec 4, 2016
9257ea9
Correctly assign "_class_name" variable on the action wrapper class.
Kami Dec 4, 2016
445cce9
Add str call.
Kami Dec 4, 2016
5f16568
Update as per comments
Dec 4, 2016
330acbc
Merge pull request #3082 from StackStorm/LH/changelog_tidy
Dec 4, 2016
549aba8
Merge pull request #3084 from StackStorm/clean_self_check
humblearner Dec 4, 2016
325330e
Fix linter errors.
Dec 5, 2016
4e64843
Suppress intermediate output for formatters
Dec 5, 2016
1370b41
Prevent TaskIndicator from adding empty lines
Dec 5, 2016
c4c817e
Add final output for `pack remove` too
Dec 5, 2016
23ebde3
Merge pull request #3083 from nzlosh/actionalias_match_fix
Dec 5, 2016
f390cb0
Add warning
Dec 5, 2016
9c31910
Fix messed indent
Dec 5, 2016
00c5676
Merge pull request #3092 from StackStorm/DZ/add_warning
emedvedev Dec 5, 2016
aeb2b92
Update version to 2.2dev
StorminStanley Dec 6, 2016
bb2e954
Sync master changelog with v2.1 branch.
Kami Dec 6, 2016
dd6e5f6
Fix typo.
Kami Dec 6, 2016
4d42175
Add some additional tests for retry policy - verify that the liveaction
Kami Dec 6, 2016
8520f1d
Add another retry policy related test which verifies that multiple
Kami Dec 6, 2016
8de35d5
Merge pull request #3098 from StackStorm/retry_test_improvements
Kami Dec 6, 2016
c1ddeb1
Throw a more user-friendly exception when pack ref / name contains
Kami Dec 7, 2016
930b717
Update changelog.
Kami Dec 7, 2016
6b72fd9
Fix error message.
Kami Dec 7, 2016
8fb06b7
Add a test case for it.
Kami Dec 7, 2016
c26d3e2
Add test fixture.
Kami Dec 7, 2016
e78ce51
Throw more user-friendly exception if ref is not available and name
Kami Dec 7, 2016
700db91
Add a test case for it.
Kami Dec 7, 2016
c938d43
Merge pull request #3012 from warrenvw/master
warrenvw Dec 7, 2016
f42457a
Merge pull request #3078 from StackStorm/fix/pack_install_show
enykeev Dec 9, 2016
25a6a5f
Show which packs has been installed
Dec 2, 2016
937ad0b
Suppress intermediate output for formatters
Dec 5, 2016
7942094
Prevent TaskIndicator from adding empty lines
Dec 5, 2016
4ba56cf
Add final output for `pack remove` too
Dec 5, 2016
9823fea
Update changelog.
Kami Dec 11, 2016
945616e
Merge branch 'master' into register_api_fail_on_failure
Kami Dec 11, 2016
b4b95ba
Update all registrars code to throw a more user-friendly exception on
Kami Dec 11, 2016
44ab7a6
Update affected tests - we don't fail on invalid pack semver version (we
Kami Dec 11, 2016
b5c95a0
Update affected tests.
Kami Dec 11, 2016
c708ffb
Add another test for resource register fail on failure (invalid action
Kami Dec 11, 2016
c1ea8e1
Merge pull request #3097 from StackStorm/sync_up_changelog_with_21
Kami Dec 12, 2016
3ff55c3
Update changelog.
Kami Dec 12, 2016
5465b31
Merge branch 'master' into more_friendly_user_exception_on_invalid_pa…
Kami Dec 12, 2016
ddb9d3e
Merge pull request #3101 from StackStorm/more_friendly_user_exception…
Kami Dec 12, 2016
285b1dd
Merge branch 'more_friendly_user_exception_on_invalid_pack_param_name…
Kami Dec 12, 2016
b5b4313
Update changelog for core.http action change.
Kami Dec 12, 2016
ed8c773
Update changelog for core.http action change.
Kami Dec 12, 2016
1411a38
Merge branch 'master' into register_api_fail_on_failure
Kami Dec 12, 2016
0b43a82
Merge pull request #3106 from StackStorm/core_http_changelog
Kami Dec 12, 2016
d878a62
Merge pull request #3080 from StackStorm/register_api_fail_on_failure
Kami Dec 12, 2016
9bfa2b2
Merge branch 'register_api_fail_on_failure' into v2.1.1_changes
Kami Dec 12, 2016
35e9fe9
Use the same registration order inside the packs register API as we do
Kami Dec 13, 2016
8343338
Add tests which verify that pack register endpoint registers dependent
Kami Dec 13, 2016
9af2aec
Add test for resource register order inside packs register API endpoint.
Kami Dec 13, 2016
ce71f11
Display pack ref when running st2 pack list.
Kami Dec 13, 2016
ff0cfde
Fix "st2 pack get" command.
Kami Dec 13, 2016
53dff86
Fix "get_by_ref_or_id" to throw if model is not found.
Kami Dec 13, 2016
f8c5c47
Add a test case for retrieving packs by ref when pack ref != pack name.
Kami Dec 13, 2016
87ed1cc
Update changelog.
Kami Dec 13, 2016
1e01d2e
Update changelog.
Kami Dec 13, 2016
89d3e0b
Merge pull request #3081 from Plexxi/tim/debug_pass_cwd_to_shell_comm…
Kami Dec 14, 2016
f42f4d1
Fix broken assertion - it would always pass.
Kami Dec 14, 2016
3e936b3
Add tests for cwd for command processes.
Kami Dec 14, 2016
742c1b2
Update packs.load to register triggers by default.
Kami Dec 14, 2016
5b23731
Update description.
Kami Dec 14, 2016
8df8c5a
Update changelog.
Kami Dec 14, 2016
6c3b53d
corrected for LocalShellRunner to be able to handle CLI options as un…
userlocalhost Dec 14, 2016
17be74f
Merge branch 'bugfix/unables_to_handle_unicode' of https://github.com…
Kami Dec 14, 2016
1ebdb62
Update code so it also works on Python 3.
Kami Dec 14, 2016
6be9b00
Add another test for non unicode params.
Kami Dec 14, 2016
9d4acb8
Update changelog.
Kami Dec 14, 2016
0a243c7
Merge branch 'retrieve_packs_by_ref_or_name_or_id' into v2.1.1_changes
Kami Dec 14, 2016
7eaa711
Merge branch 'userlocalhost-bugfix/unables_to_handle_unicode' into v2…
Kami Dec 14, 2016
4d51dc5
Merge branch 'packs_load_register_triggers_by_default' into v2.1.1_ch…
Kami Dec 14, 2016
1116c1b
Merge branch 'consistent_register_order' into v2.1.1_changes
Kami Dec 14, 2016
96e43be
Merge branch 'test_for_debug_info' into v2.1.1_changes
Kami Dec 14, 2016
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
128 changes: 74 additions & 54 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,91 +1,111 @@
Changelog
=========

2.1.1 - in development
----------------------

* After running ``st2 pack install`` CLI command display which packs have been installed.
(improvement)
* Update ``/v1/packs/register`` API endpoint so it throws on failure (e.g. invalid pack or resource
metadata). This way the default behavior is consistent with default
``st2ctl reload --register-all`` behavior.

If user doesn't want the API endpoint to fail on failure, they can pass
``"fail_on_failure": false`` attribute in the request payload. (improvement)
* Throw a more user-friendly exception when registering packs (``st2ctl reload``) if pack ref /
name is invalid. (improvement)
* ``core.http`` action now also supports HTTP basic auth and digest authentication by passing
``username`` and ``password`` parameter to the action. (new feature)
* Fix ``GET /v1/packs/<pack ref or id>`` API endpoint - make sure pack object is correctly returned
when pack ref doesn't match pack name. Previously, 404 not found was thrown. (bug fix)
* Update local action runner so it supports and works with non-ascii (unicode) parameter keys and
values. (bug fix)

Contribution by Hiroyasu OHYAMA. #3116
* Update ``packs.load`` action to also register triggers by default. (improvement)
* Update ``/v1/packs/register`` API endpoint so it registers resources in the correct order which
is the same as order used in ``st2-register-content`` script. (bug fix)

2.1.0 - December 05, 2016
-------------------------

* Pack management changes:

- Add new ``stackstorm_version`` and ``system`` fields to the pack.yaml metadata file. Value of the
first field can contain a specific StackStorm version with which the pack is designed to work
with (e.g. ``>=1.6.0,<2.2.0`` or ``>2.0.0``). This field is checked when installing / registering
a pack and installation is aborted if pack doesn't support the currently running StackStorm version.
Second field can contain an object with optional system / OS level dependencies.
(new feature)
- Add new ``contributors`` field to the pack metadata file. This field can contain a list of
people who have contributed to the pack. The format is ``Name <email>``, e.g.
``Tomaz Muraus <tomaz@stackstorm.com>`` (new feature)
- Add support for default values and dynamic config values for nested config objects. (new feature, improvement)
- Add new ``st2-validate-pack-config`` tool for validating config file against a particular config
schema file. (new-feature)
- Improved pack validation - now when the packs are registered we check that:

+ ``version`` attribute in the pack metadata file matches valid semver format (e.g
``0.1.0``, ``2.0.0``, etc.)
+ ``email`` attribute (if specified) contains a valid email address. (improvement)
+ Only valid word characters (``a-z``, ``0-9`` and ``_``) used for action parameter
names. Previously, due to bug in the code, any character was allowed.

If validation fails, pack registration will fail. If you have an existing action or pack definition which
uses invalid characters, pack registration will fail. **You must update your packs**.
- For consistency with new pack name validation changes, sample ``hello-st2`` pack has been renamed
to ``hello_st2``.
- Fix ``packs.uninstall`` action so it also deletes ``configs`` and ``policies`` which belong to
the pack which is being uninstalled. (bug fix)
- Update ``packs.install`` action (``pack install`` command) to only load resources from the packs
which are being installed. Also update it and remove "restart sensor container" step from the
install workflow. This step hasn't been needed for a while now because sensor container
dynamically reads a list of available sensors from the database and starts the sub processes.
(improvement)
- Remove ``packs.info`` action because ``.gitinfo`` file has been deprecated with the new pack
management approach. Now pack directories are actual checkouts of the corresponding pack git
repositories so this file is not needed anymore.

* Add new ``POST /v1/actionalias/match`` API endpoint which allows users to perform ChatOps action
alias matching server-side. This makes it easier to build and maintain StackStorm ChatOps
clients / adapters for various protocols and mediums. Clients can now be very thin wrappers
around this new API endpoint.

Also add two new corresponding CLI commands - ``st2 alias-execution match`` and
``st2 alias-execution execute``. (new feature) #2895

Contributed by Anthony Shaw
* Only allow valid word characters (``a-z``, ``0-9`` and ``_``) to be used for action parameter
names. Previously, due to bug in the code, any character was allowed.

If you have an existing action definition which uses parameter with an invalid character, the
parameter name needs to be adjusted otherwise action registration will fail. (bug fix,
improvement)
``st2 alias-execution execute``. Contribution by Anthony Shaw. (new feature) #2895.
* Adding ability to pass complex array types via CLI by first trying to
seralize the array as JSON and then falling back to comma separated array.
* Add new ``core.pause`` action. This action behaves like sleep and can be used inside the action
chain or Mistral workflows where waiting / sleeping is desired before proceeding with a next
task. (new feature) #2933

Contribution by Paul Mulvihill.
* Improve API exception handling and make sure 400 status code is returned instead of 500 on
mongoengine field validation error. (improvement)
* Allow user to supply multiple resource ids using ``?id`` query parameter when filtering
"get all" API endpoint result set (e.g. `?id=1,2,3,4`). This allows for a better client and
servers performance when user is polling and interested in multiple resources such as polling on
multiple action executions. (improvement)
* Actually validate pack metadata file when registering packs. (bug fix, improvement)
* Improve pack validation - now when the packs are registered we require that
"version" attribute in the pack metadata file matches valid semver format and we also require
that "email" attribute (if specified) contains a valid email address. (improvement)
* For consistency with new pack name validation changes, sample ``hello-st2`` pack has been renamed
to ``hello_st2``.
* Add new ``stackstorm_version`` and ``system`` fields to the pack.yaml metadata file. Value of the
first field can contain a specific for StackStorm version with which the pack is designed to work
with (e.g. ``>=1.6.0,<2.2.0`` or ``>2.0.0``). This field is checked when installing / registering
a pack and installation is aborted if pack doesn't support StackStorm version which is currently
running. Second field can contain an object with optional system / OS level dependencies.
(new feature)
* Require pack metadata ``version`` attribute to contain a valid semver version identifier (e.g
``0.1.0``, ``2.0.0``, etc.). If version identifier is invalid, pack registration will fail.
(improvement)
task. Contribution by Paul Mulvihill. (new feature) #2933.
* When a policy cancels a request due to concurrency, it leaves end_timestamp set to None which
the notifier expects to be a date. This causes an exception in "isotime.format()". A patch was
released that catches this exception, and populates payload['end_timestamp'] with the equivalent
of "datetime.now()" when the exception occurs.
* Adding check for datastore Client expired tokens used in sensor container
* Add new ``contributors`` field to the pack metadata file. This field can contain a list of
people who have contributed to the pack. The format is ``Name <email>``, e.g.
``Tomaz Muraus <tomaz@stackstorm.com>`` (new feature)
* Update ``packs.install`` action (``pack install`` command) to only load resources from the packs
which are being installed. Also update it and remove "restart sensor container" step from the
install workflow. This step hasn't been needed for a while now because sensor container
dynamically reads a list of available sensors from the database and starts the sub processes.
(improvement)
* Improve API exception handling and make sure 400 status code is returned instead of 500 on
mongoengine field validation error. (improvement)
* Throw a more user-friendly exception if rendering a dynamic configuration value inside the config
fails. (improvement)
* Change st2api so that a full execution object is returned instead of an error message, when an
API client requests cancellation of an execution that is already canceled
* Remove ``packs.info`` action because ``.gitinfo`` file has been deprecated with the new pack
management approach. Now pack directories are actual checkouts of the corresponding pack git
repositories so this file is not needed anymore.
* Speed up short-lived Python runner actions by up to 70%. This way done by re-organizing and
re-factoring code to avoid expensive imports such as jsonschema, jinja2, kombu and mongoengine
in the places where those imports are not actually needed and by various other optimizations.
(improvement)
* Add new ``st2-validate-pack-config`` tool for validating config file against a particular config
schema file. (new-feature)
* Upgrade various internal Python library dependencies to the latest stable versions (gunicorn,
kombu, six, appscheduler, passlib, python-gnupg, semver, paramiko, python-keyczar, virtualenv).
* Improve performance of ``GET /executions/views/filters`` by creating additional indexes on
executions collection
* Add support for default values and dynamic config values for nested config objects. (new feature,
improvement)
* Throw a more user-friendly exception if rendering a dynamic configuration value inside the config
fails. (improvement)
* Allow user to supply multiple resource ids using ``?id`` query parameter when filtering
"get all" API endpoint result set (e.g. `?id=1,2,3,4`). This allows for a better client and
servers performance when user is polling and interested in multiple resources such as polling on
multiple action executions. (improvement)
* Upgrade various internal Python library dependencies to the latest stable versions (gunicorn,
kombu, six, appscheduler, passlib, python-gnupg, semver, paramiko, python-keyczar, virtualenv).
* Add support for ssh config file for ParamikoSSHrunner. Now ``ssh_config_file_path`` can be set
in st2 config and can be used to access remote hosts when ``use_ssh_config`` is set to
``True``. However, to access remote hosts, action paramters like username and
password/private_key, if provided with action, will have precedence over the config file
entry for the host. #2941 #3032 #3058 [Eric Edgar] (improvement)
* Fix ``packs.uninstall`` action so it also deletes ``configs`` and ``policies`` which belong to
the pack which is being uninstalled. (bug fix)
* Fix python action runner actions and make sure that modules from ``st2common/st2common/runners``
directory don't pollute ``PYTHONPATH`` for python runner actions. (bug fix)

Expand Down
4 changes: 2 additions & 2 deletions contrib/packs/actions/load.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
parameters:
register:
type: "string"
default: "actions,aliases,sensors"
description: "Possible options are all, sensors, actions, rules, aliases."
default: "actions,aliases,sensors,triggers"
description: "Possible options are all, sensors, actions, rules, aliases, triggers, configs."
packs:
type: "array"
description: "A list of packs to register / load resources from."
Expand Down
15 changes: 13 additions & 2 deletions contrib/runners/http_runner/http_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import uuid

import requests
from requests.auth import HTTPBasicAuth
from oslo_config import cfg

from st2common.runners.base import ActionRunner
Expand All @@ -40,6 +41,8 @@
RUNNER_HTTP_PROXY = 'http_proxy'
RUNNER_HTTPS_PROXY = 'https_proxy'
RUNNER_VERIFY_SSL_CERT = 'verify_ssl_cert'
RUNNER_USERNAME = 'username'
RUNNER_PASSWORD = 'password'

# Lookup constants for action params
ACTION_AUTH = 'auth'
Expand Down Expand Up @@ -77,6 +80,8 @@ def pre_run(self):

self._cookies = self.runner_parameters.get(RUNNER_COOKIES, None)
self._allow_redirects = self.runner_parameters.get(RUNNER_ALLOW_REDIRECTS, False)
self._username = self.runner_parameters.get(RUNNER_USERNAME, None)
self._password = self.runner_parameters.get(RUNNER_PASSWORD, None)
self._http_proxy = self.runner_parameters.get(RUNNER_HTTP_PROXY, None)
self._https_proxy = self.runner_parameters.get(RUNNER_HTTPS_PROXY, None)
self._verify_ssl_cert = self.runner_parameters.get(RUNNER_VERIFY_SSL_CERT, None)
Expand Down Expand Up @@ -133,7 +138,8 @@ def _get_http_client(self, action_parameters):
return HTTPClient(url=self._url, method=method, body=body, params=params,
headers=headers, cookies=self._cookies, auth=auth,
timeout=timeout, allow_redirects=self._allow_redirects,
proxies=proxies, files=files, verify=self._verify_ssl_cert)
proxies=proxies, files=files, verify=self._verify_ssl_cert,
username=self._username, password=self._password)

@staticmethod
def _get_result_status(status_code):
Expand All @@ -144,7 +150,7 @@ def _get_result_status(status_code):
class HTTPClient(object):
def __init__(self, url=None, method=None, body='', params=None, headers=None, cookies=None,
auth=None, timeout=60, allow_redirects=False, proxies=None,
files=None, verify=False):
files=None, verify=False, username=None, password=None):
if url is None:
raise Exception('URL must be specified.')

Expand Down Expand Up @@ -172,6 +178,8 @@ def __init__(self, url=None, method=None, body='', params=None, headers=None, co
self.proxies = proxies
self.files = files
self.verify = verify
self.username = username
self.password = password

def run(self):
results = {}
Expand All @@ -191,6 +199,9 @@ def run(self):
else:
data = self.body

if self.username or self.password:
self.auth = HTTPBasicAuth(self.username, self.password)

resp = requests.request(
self.method,
self.url,
Expand Down
6 changes: 6 additions & 0 deletions contrib/runners/http_runner/runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@
https_proxy:
description: A URL of a HTTPs proxy to use (e.g. http://10.10.1.10:3128).
type: string
password:
description: Password required by basic authentication.
type: string
url:
description: URL to the HTTP endpoint.
required: true
type: string
username:
description: Username required by basic authentication.
type: string
verify_ssl_cert:
default: true
description: Certificate for HTTPS request is verified by default using requests
Expand Down
22 changes: 22 additions & 0 deletions contrib/runners/http_runner/tests/unit/test_http_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,25 @@ def test_https_verify_false(self, mock_requests):
'GET', url, allow_redirects=False, auth=None, cookies=None,
data='', files=None, headers={}, params=None, proxies=None,
timeout=60, verify=False)

@mock.patch('http_runner.requests')
def test_https_auth_basic(self, mock_requests):
url = 'https://127.0.0.1:8888'
username = 'misspiggy'
password = 'kermit'
client = HTTPClient(url=url, username=username, password=password)
mock_result = MockResult()

mock_result.text = 'muppet show'
mock_result.headers = {'Authorization': 'bWlzc3BpZ2d5Omtlcm1pdA=='}
mock_result.status_code = 200

mock_requests.request.return_value = mock_result
result = client.run()

self.assertEqual(result['headers'], mock_result.headers)

mock_requests.request.assert_called_once_with(
'GET', url, allow_redirects=False, auth=client.auth, cookies=None,
data='', files=None, headers={}, params=None, proxies=None,
timeout=60, verify=False)
Loading