Skip to content

Commit

Permalink
Merge pull request #4074 from StackStorm/v2_7_additional_changes
Browse files Browse the repository at this point in the history
Additional changes for v2.7.0
  • Loading branch information
Kami committed Apr 10, 2018
2 parents 812003b + 023012f commit e01d58a
Show file tree
Hide file tree
Showing 19 changed files with 224 additions and 52 deletions.
14 changes: 2 additions & 12 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Changelog
=========

in development
--------------


2.7.0 - April 06, 2018
----------------------

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

Contributed by @sumkire.
* Add new ``--python3`` flag to ``st2 pack install`` CLI command and ``python3`` parameter to
``packs.{install,setup_virtualenv}`` actions. When the value of this parameter is True, it
uses ``python3`` binary when creating virtual environment for that pack (based on the value of
``actionrunner.python3_binary`` config option).

Note: For this feature to work, Python 3 needs to be installed on the system and ``virtualenv``
package installed on the system needs to support Python 3 (it needs to be a recent version).
(new feature) #4016 #3922
* Added the ability of ``st2ctl`` to utilize environment variables from ``/etc/default/st2ctl``
(for Ubuntu/Debian) and ``/etc/sysconfig/st2ctl`` (RHEL/CentOS). This allows
deployments to override ``COMPONENTS`` and ``ST2_CONF`` in a global location
Expand Down Expand Up @@ -110,6 +98,8 @@ Fixed
* Make sure ``observer`` system role also grants ``pack_search`` permission. (bug fix) #4063 #4064

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

2.6.0 - January 19, 2018
------------------------
Expand Down
19 changes: 17 additions & 2 deletions scripts/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,25 @@

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)

try:
# pip < 10.0
from pip.req import parse_requirements
except ImportError:
print('Download pip:\n', GET_PIP)
sys.exit(1)
# pip >= 10.0

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('Using pip: %s' % (str(pip_version)))
sys.exit(1)

__all__ = [
'check_pip_version',
Expand Down
19 changes: 17 additions & 2 deletions st2actions/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,25 @@

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)

try:
# pip < 10.0
from pip.req import parse_requirements
except ImportError:
print('Download pip:\n', GET_PIP)
sys.exit(1)
# pip >= 10.0

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('Using pip: %s' % (str(pip_version)))
sys.exit(1)

__all__ = [
'check_pip_version',
Expand Down
19 changes: 17 additions & 2 deletions st2api/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,25 @@

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)

try:
# pip < 10.0
from pip.req import parse_requirements
except ImportError:
print('Download pip:\n', GET_PIP)
sys.exit(1)
# pip >= 10.0

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('Using pip: %s' % (str(pip_version)))
sys.exit(1)

__all__ = [
'check_pip_version',
Expand Down
6 changes: 3 additions & 3 deletions st2api/st2api/controllers/v1/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ def get_all(self):
# Return only the hooks known by this controller.
return self._hooks.get_all()

def get_one(self, name, requester_user):
triggers = self._hooks.get_triggers_for_hook(name)
def get_one(self, url, requester_user):
triggers = self._hooks.get_triggers_for_hook(url)

if not triggers:
abort(http_client.NOT_FOUND)
return

permission_type = PermissionType.WEBHOOK_VIEW
rbac_utils.assert_user_has_resource_db_permission(user_db=requester_user,
resource_db=WebhookDB(name=name),
resource_db=WebhookDB(name=url),
permission_type=permission_type)

# For demonstration purpose return 1st
Expand Down
19 changes: 17 additions & 2 deletions st2auth/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,25 @@

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)

try:
# pip < 10.0
from pip.req import parse_requirements
except ImportError:
print('Download pip:\n', GET_PIP)
sys.exit(1)
# pip >= 10.0

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('Using pip: %s' % (str(pip_version)))
sys.exit(1)

__all__ = [
'check_pip_version',
Expand Down
19 changes: 17 additions & 2 deletions st2client/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,25 @@

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)

try:
# pip < 10.0
from pip.req import parse_requirements
except ImportError:
print('Download pip:\n', GET_PIP)
sys.exit(1)
# pip >= 10.0

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('Using pip: %s' % (str(pip_version)))
sys.exit(1)

__all__ = [
'check_pip_version',
Expand Down
6 changes: 1 addition & 5 deletions st2client/st2client/commands/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,14 @@ def __init__(self, resource, *args, **kwargs):
metavar='pack',
help='Name of the %s in Exchange, or a git repo URL.' %
resource.get_plural_display_name().lower())
self.parser.add_argument('--python3',
action='store_true',
default=False,
help='Use Python 3 binary for pack virtual environment.')
self.parser.add_argument('--force',
action='store_true',
default=False,
help='Force pack installation.')

def run(self, args, **kwargs):
self._get_content_counts_for_pack(args, **kwargs)
return self.manager.install(args.packs, python3=args.python3, force=args.force, **kwargs)
return self.manager.install(args.packs, force=args.force, **kwargs)

def _get_content_counts_for_pack(self, args, **kwargs):
# Global content list, excluding "tests"
Expand Down
27 changes: 23 additions & 4 deletions st2client/st2client/commands/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

from __future__ import absolute_import

from st2client.models import Webhook
from st2client.commands import resource
from st2client.formatters import table
from st2client.models import Webhook


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


class WebhookListCommand(resource.ContentPackResourceListCommand):
display_attributes = ['type', 'pack', 'name', 'description', 'parameters']
display_attributes = ['url', 'type', 'description']

def run_and_print(self, args, **kwargs):
instances = self.run(args, **kwargs)

for instance in instances:
instance.url = instance.parameters['url']

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

class WebhookGetCommand(resource.ContentPackResourceGetCommand):
if args.json or args.yaml:
self.print_output(instances, table.MultiColumnTable,
attributes=args.attr, widths=args.width,
json=args.json, yaml=args.yaml)
else:
self.print_output(instances, table.MultiColumnTable,
attributes=args.attr, widths=args.width)


class WebhookGetCommand(resource.ResourceGetCommand):
display_attributes = ['all']
attribute_display_order = ['type', 'pack', 'name', 'description', 'parameters']
attribute_display_order = ['type', 'description']

pk_argument_name = 'url'
1 change: 1 addition & 0 deletions st2client/st2client/models/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ class Webhook(core.Resource):
_display_name = 'Webhook'
_plural = 'Webhooks'
_plural_display_name = 'Webhooks'
_repr_attributes = ['parameters', 'type', 'pack', 'name']
19 changes: 17 additions & 2 deletions st2common/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,25 @@

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)

try:
# pip < 10.0
from pip.req import parse_requirements
except ImportError:
print('Download pip:\n', GET_PIP)
sys.exit(1)
# pip >= 10.0

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('Using pip: %s' % (str(pip_version)))
sys.exit(1)

__all__ = [
'check_pip_version',
Expand Down
1 change: 1 addition & 0 deletions st2common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
'bin/migrations/v2.1/st2-migrate-datastore-scopes.py',
'bin/migrations/v2.1/st2-migrate-runners.sh',
'bin/st2-self-check',
'bin/st2-track-result',
'bin/st2-validate-pack-config',
'bin/st2-check-license'
]
Expand Down
6 changes: 3 additions & 3 deletions st2common/st2common/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3936,15 +3936,15 @@ paths:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/api/v1/webhooks/{name}:
/api/v1/webhooks/{url}:
get:
operationId: st2api.controllers.v1.webhooks:webhooks_controller.get_one
description: |
Get one action.
parameters:
- name: name
- name: url
in: path
description: Entity reference or id
description: Webhook relative URL path
type: string
required: true
x-parameters:
Expand Down
6 changes: 3 additions & 3 deletions st2common/st2common/openapi.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3932,15 +3932,15 @@ paths:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/api/v1/webhooks/{name}:
/api/v1/webhooks/{url}:
get:
operationId: st2api.controllers.v1.webhooks:webhooks_controller.get_one
description: |
Get one action.
parameters:
- name: name
- name: url
in: path
description: Entity reference or id
description: Webhook relative URL path
type: string
required: true
x-parameters:
Expand Down
19 changes: 17 additions & 2 deletions st2debug/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,25 @@

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)

try:
# pip < 10.0
from pip.req import parse_requirements
except ImportError:
print('Download pip:\n', GET_PIP)
sys.exit(1)
# pip >= 10.0

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('Using pip: %s' % (str(pip_version)))
sys.exit(1)

__all__ = [
'check_pip_version',
Expand Down
19 changes: 17 additions & 2 deletions st2exporter/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,25 @@

try:
import pip
from pip import __version__ as pip_version
except ImportError as e:
print('Failed to import pip: %s' % (str(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)

try:
# pip < 10.0
from pip.req import parse_requirements
except ImportError:
print('Download pip:\n', GET_PIP)
sys.exit(1)
# pip >= 10.0

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('Using pip: %s' % (str(pip_version)))
sys.exit(1)

__all__ = [
'check_pip_version',
Expand Down

0 comments on commit e01d58a

Please sign in to comment.