Skip to content

Commit e01d58a

Browse files
authored
Merge pull request #4074 from StackStorm/v2_7_additional_changes
Additional changes for v2.7.0
2 parents 812003b + 023012f commit e01d58a

File tree

19 files changed

+224
-52
lines changed

19 files changed

+224
-52
lines changed

CHANGELOG.rst

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
Changelog
22
=========
33

4-
in development
5-
--------------
6-
7-
84
2.7.0 - April 06, 2018
95
----------------------
106

@@ -17,14 +13,6 @@ Added
1713
* Add support for utf-8 / unicode characters in the pack config files. (improvement) #3980 #3989
1814

1915
Contributed by @sumkire.
20-
* Add new ``--python3`` flag to ``st2 pack install`` CLI command and ``python3`` parameter to
21-
``packs.{install,setup_virtualenv}`` actions. When the value of this parameter is True, it
22-
uses ``python3`` binary when creating virtual environment for that pack (based on the value of
23-
``actionrunner.python3_binary`` config option).
24-
25-
Note: For this feature to work, Python 3 needs to be installed on the system and ``virtualenv``
26-
package installed on the system needs to support Python 3 (it needs to be a recent version).
27-
(new feature) #4016 #3922
2816
* Added the ability of ``st2ctl`` to utilize environment variables from ``/etc/default/st2ctl``
2917
(for Ubuntu/Debian) and ``/etc/sysconfig/st2ctl`` (RHEL/CentOS). This allows
3018
deployments to override ``COMPONENTS`` and ``ST2_CONF`` in a global location
@@ -110,6 +98,8 @@ Fixed
11098
* Make sure ``observer`` system role also grants ``pack_search`` permission. (bug fix) #4063 #4064
11199

112100
Reported by @SURAJTHEGREAT.
101+
* Fix st2 webhook get -h which was asking for a name or id as opposed to the URL of the webhook.
102+
Also, fix st2 webhook list to explicitly add a webhook column. (bugfix) #4048
113103

114104
2.6.0 - January 19, 2018
115105
------------------------

scripts/dist_utils.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@
2525

2626
try:
2727
import pip
28+
from pip import __version__ as pip_version
29+
except ImportError as e:
30+
print('Failed to import pip: %s' % (str(e)))
31+
print('')
32+
print('Download pip:\n%s' % (GET_PIP))
33+
sys.exit(1)
34+
35+
try:
36+
# pip < 10.0
2837
from pip.req import parse_requirements
2938
except ImportError:
30-
print('Download pip:\n', GET_PIP)
31-
sys.exit(1)
39+
# pip >= 10.0
40+
41+
try:
42+
from pip._internal.req.req_file import parse_requirements
43+
except ImportError as e:
44+
print('Failed to import parse_requirements from pip: %s' % (str(e)))
45+
print('Using pip: %s' % (str(pip_version)))
46+
sys.exit(1)
3247

3348
__all__ = [
3449
'check_pip_version',

st2actions/dist_utils.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@
2525

2626
try:
2727
import pip
28+
from pip import __version__ as pip_version
29+
except ImportError as e:
30+
print('Failed to import pip: %s' % (str(e)))
31+
print('')
32+
print('Download pip:\n%s' % (GET_PIP))
33+
sys.exit(1)
34+
35+
try:
36+
# pip < 10.0
2837
from pip.req import parse_requirements
2938
except ImportError:
30-
print('Download pip:\n', GET_PIP)
31-
sys.exit(1)
39+
# pip >= 10.0
40+
41+
try:
42+
from pip._internal.req.req_file import parse_requirements
43+
except ImportError as e:
44+
print('Failed to import parse_requirements from pip: %s' % (str(e)))
45+
print('Using pip: %s' % (str(pip_version)))
46+
sys.exit(1)
3247

3348
__all__ = [
3449
'check_pip_version',

st2api/dist_utils.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@
2525

2626
try:
2727
import pip
28+
from pip import __version__ as pip_version
29+
except ImportError as e:
30+
print('Failed to import pip: %s' % (str(e)))
31+
print('')
32+
print('Download pip:\n%s' % (GET_PIP))
33+
sys.exit(1)
34+
35+
try:
36+
# pip < 10.0
2837
from pip.req import parse_requirements
2938
except ImportError:
30-
print('Download pip:\n', GET_PIP)
31-
sys.exit(1)
39+
# pip >= 10.0
40+
41+
try:
42+
from pip._internal.req.req_file import parse_requirements
43+
except ImportError as e:
44+
print('Failed to import parse_requirements from pip: %s' % (str(e)))
45+
print('Using pip: %s' % (str(pip_version)))
46+
sys.exit(1)
3247

3348
__all__ = [
3449
'check_pip_version',

st2api/st2api/controllers/v1/webhooks.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,16 @@ def get_all(self):
100100
# Return only the hooks known by this controller.
101101
return self._hooks.get_all()
102102

103-
def get_one(self, name, requester_user):
104-
triggers = self._hooks.get_triggers_for_hook(name)
103+
def get_one(self, url, requester_user):
104+
triggers = self._hooks.get_triggers_for_hook(url)
105105

106106
if not triggers:
107107
abort(http_client.NOT_FOUND)
108108
return
109109

110110
permission_type = PermissionType.WEBHOOK_VIEW
111111
rbac_utils.assert_user_has_resource_db_permission(user_db=requester_user,
112-
resource_db=WebhookDB(name=name),
112+
resource_db=WebhookDB(name=url),
113113
permission_type=permission_type)
114114

115115
# For demonstration purpose return 1st

st2auth/dist_utils.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@
2525

2626
try:
2727
import pip
28+
from pip import __version__ as pip_version
29+
except ImportError as e:
30+
print('Failed to import pip: %s' % (str(e)))
31+
print('')
32+
print('Download pip:\n%s' % (GET_PIP))
33+
sys.exit(1)
34+
35+
try:
36+
# pip < 10.0
2837
from pip.req import parse_requirements
2938
except ImportError:
30-
print('Download pip:\n', GET_PIP)
31-
sys.exit(1)
39+
# pip >= 10.0
40+
41+
try:
42+
from pip._internal.req.req_file import parse_requirements
43+
except ImportError as e:
44+
print('Failed to import parse_requirements from pip: %s' % (str(e)))
45+
print('Using pip: %s' % (str(pip_version)))
46+
sys.exit(1)
3247

3348
__all__ = [
3449
'check_pip_version',

st2client/dist_utils.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@
2525

2626
try:
2727
import pip
28+
from pip import __version__ as pip_version
29+
except ImportError as e:
30+
print('Failed to import pip: %s' % (str(e)))
31+
print('')
32+
print('Download pip:\n%s' % (GET_PIP))
33+
sys.exit(1)
34+
35+
try:
36+
# pip < 10.0
2837
from pip.req import parse_requirements
2938
except ImportError:
30-
print('Download pip:\n', GET_PIP)
31-
sys.exit(1)
39+
# pip >= 10.0
40+
41+
try:
42+
from pip._internal.req.req_file import parse_requirements
43+
except ImportError as e:
44+
print('Failed to import parse_requirements from pip: %s' % (str(e)))
45+
print('Using pip: %s' % (str(pip_version)))
46+
sys.exit(1)
3247

3348
__all__ = [
3449
'check_pip_version',

st2client/st2client/commands/pack.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,14 @@ def __init__(self, resource, *args, **kwargs):
185185
metavar='pack',
186186
help='Name of the %s in Exchange, or a git repo URL.' %
187187
resource.get_plural_display_name().lower())
188-
self.parser.add_argument('--python3',
189-
action='store_true',
190-
default=False,
191-
help='Use Python 3 binary for pack virtual environment.')
192188
self.parser.add_argument('--force',
193189
action='store_true',
194190
default=False,
195191
help='Force pack installation.')
196192

197193
def run(self, args, **kwargs):
198194
self._get_content_counts_for_pack(args, **kwargs)
199-
return self.manager.install(args.packs, python3=args.python3, force=args.force, **kwargs)
195+
return self.manager.install(args.packs, force=args.force, **kwargs)
200196

201197
def _get_content_counts_for_pack(self, args, **kwargs):
202198
# Global content list, excluding "tests"

st2client/st2client/commands/webhook.py

+23-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515

1616
from __future__ import absolute_import
1717

18-
from st2client.models import Webhook
1918
from st2client.commands import resource
19+
from st2client.formatters import table
20+
from st2client.models import Webhook
2021

2122

2223
class WebhookBranch(resource.ResourceBranch):
@@ -32,9 +33,27 @@ def __init__(self, description, app, subparsers, parent_parser=None):
3233

3334

3435
class WebhookListCommand(resource.ContentPackResourceListCommand):
35-
display_attributes = ['type', 'pack', 'name', 'description', 'parameters']
36+
display_attributes = ['url', 'type', 'description']
37+
38+
def run_and_print(self, args, **kwargs):
39+
instances = self.run(args, **kwargs)
40+
41+
for instance in instances:
42+
instance.url = instance.parameters['url']
3643

44+
instances = sorted(instances, key=lambda k: k.url)
3745

38-
class WebhookGetCommand(resource.ContentPackResourceGetCommand):
46+
if args.json or args.yaml:
47+
self.print_output(instances, table.MultiColumnTable,
48+
attributes=args.attr, widths=args.width,
49+
json=args.json, yaml=args.yaml)
50+
else:
51+
self.print_output(instances, table.MultiColumnTable,
52+
attributes=args.attr, widths=args.width)
53+
54+
55+
class WebhookGetCommand(resource.ResourceGetCommand):
3956
display_attributes = ['all']
40-
attribute_display_order = ['type', 'pack', 'name', 'description', 'parameters']
57+
attribute_display_order = ['type', 'description']
58+
59+
pk_argument_name = 'url'

st2client/st2client/models/webhook.py

+1
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ class Webhook(core.Resource):
2828
_display_name = 'Webhook'
2929
_plural = 'Webhooks'
3030
_plural_display_name = 'Webhooks'
31+
_repr_attributes = ['parameters', 'type', 'pack', 'name']

st2common/dist_utils.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@
2525

2626
try:
2727
import pip
28+
from pip import __version__ as pip_version
29+
except ImportError as e:
30+
print('Failed to import pip: %s' % (str(e)))
31+
print('')
32+
print('Download pip:\n%s' % (GET_PIP))
33+
sys.exit(1)
34+
35+
try:
36+
# pip < 10.0
2837
from pip.req import parse_requirements
2938
except ImportError:
30-
print('Download pip:\n', GET_PIP)
31-
sys.exit(1)
39+
# pip >= 10.0
40+
41+
try:
42+
from pip._internal.req.req_file import parse_requirements
43+
except ImportError as e:
44+
print('Failed to import parse_requirements from pip: %s' % (str(e)))
45+
print('Using pip: %s' % (str(pip_version)))
46+
sys.exit(1)
3247

3348
__all__ = [
3449
'check_pip_version',

st2common/setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
'bin/migrations/v2.1/st2-migrate-datastore-scopes.py',
6060
'bin/migrations/v2.1/st2-migrate-runners.sh',
6161
'bin/st2-self-check',
62+
'bin/st2-track-result',
6263
'bin/st2-validate-pack-config',
6364
'bin/st2-check-license'
6465
]

st2common/st2common/openapi.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3936,15 +3936,15 @@ paths:
39363936
description: Unexpected error
39373937
schema:
39383938
$ref: '#/definitions/Error'
3939-
/api/v1/webhooks/{name}:
3939+
/api/v1/webhooks/{url}:
39403940
get:
39413941
operationId: st2api.controllers.v1.webhooks:webhooks_controller.get_one
39423942
description: |
39433943
Get one action.
39443944
parameters:
3945-
- name: name
3945+
- name: url
39463946
in: path
3947-
description: Entity reference or id
3947+
description: Webhook relative URL path
39483948
type: string
39493949
required: true
39503950
x-parameters:

st2common/st2common/openapi.yaml.j2

+3-3
Original file line numberDiff line numberDiff line change
@@ -3932,15 +3932,15 @@ paths:
39323932
description: Unexpected error
39333933
schema:
39343934
$ref: '#/definitions/Error'
3935-
/api/v1/webhooks/{name}:
3935+
/api/v1/webhooks/{url}:
39363936
get:
39373937
operationId: st2api.controllers.v1.webhooks:webhooks_controller.get_one
39383938
description: |
39393939
Get one action.
39403940
parameters:
3941-
- name: name
3941+
- name: url
39423942
in: path
3943-
description: Entity reference or id
3943+
description: Webhook relative URL path
39443944
type: string
39453945
required: true
39463946
x-parameters:

st2debug/dist_utils.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@
2525

2626
try:
2727
import pip
28+
from pip import __version__ as pip_version
29+
except ImportError as e:
30+
print('Failed to import pip: %s' % (str(e)))
31+
print('')
32+
print('Download pip:\n%s' % (GET_PIP))
33+
sys.exit(1)
34+
35+
try:
36+
# pip < 10.0
2837
from pip.req import parse_requirements
2938
except ImportError:
30-
print('Download pip:\n', GET_PIP)
31-
sys.exit(1)
39+
# pip >= 10.0
40+
41+
try:
42+
from pip._internal.req.req_file import parse_requirements
43+
except ImportError as e:
44+
print('Failed to import parse_requirements from pip: %s' % (str(e)))
45+
print('Using pip: %s' % (str(pip_version)))
46+
sys.exit(1)
3247

3348
__all__ = [
3449
'check_pip_version',

st2exporter/dist_utils.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@
2525

2626
try:
2727
import pip
28+
from pip import __version__ as pip_version
29+
except ImportError as e:
30+
print('Failed to import pip: %s' % (str(e)))
31+
print('')
32+
print('Download pip:\n%s' % (GET_PIP))
33+
sys.exit(1)
34+
35+
try:
36+
# pip < 10.0
2837
from pip.req import parse_requirements
2938
except ImportError:
30-
print('Download pip:\n', GET_PIP)
31-
sys.exit(1)
39+
# pip >= 10.0
40+
41+
try:
42+
from pip._internal.req.req_file import parse_requirements
43+
except ImportError as e:
44+
print('Failed to import parse_requirements from pip: %s' % (str(e)))
45+
print('Using pip: %s' % (str(pip_version)))
46+
sys.exit(1)
3247

3348
__all__ = [
3449
'check_pip_version',

0 commit comments

Comments
 (0)