From 9c19b4d635e8ab2aaf020ad641c8a560f7d26ca2 Mon Sep 17 00:00:00 2001 From: Edward Medvedev Date: Sat, 11 Feb 2017 03:44:43 +0100 Subject: [PATCH 1/2] Add pack groups to API --- st2common/st2common/models/api/pack.py | 9 ++++++++- st2common/st2common/models/db/pack.py | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/st2common/st2common/models/api/pack.py b/st2common/st2common/models/api/pack.py index 78e87f740f..a4a76d47e6 100644 --- a/st2common/st2common/models/api/pack.py +++ b/st2common/st2common/models/api/pack.py @@ -134,6 +134,12 @@ class PackAPI(BaseAPI): 'items': {'type': 'string'}, 'default': [] }, + 'groups': { + 'type': 'array', + 'description': 'Groups of actions inside the pack. Reserved for future use.', + 'items': {'type': 'object'}, + 'default': [] + }, 'system': { 'type': 'object', 'description': 'Specification for the system components and packages ' @@ -204,12 +210,13 @@ def to_model(cls, pack): email = pack.email contributors = getattr(pack, 'contributors', []) files = getattr(pack, 'files', []) + groups = getattr(pack, 'groups', {}) dependencies = getattr(pack, 'dependencies', []) system = getattr(pack, 'system', {}) model = cls.model(ref=ref, name=name, description=description, keywords=keywords, version=version, author=author, email=email, contributors=contributors, - files=files, dependencies=dependencies, system=system, + files=files, dependencies=dependencies, system=system, groups=groups, stackstorm_version=stackstorm_version) return model diff --git a/st2common/st2common/models/db/pack.py b/st2common/st2common/models/db/pack.py index 0410ea8879..031601c743 100644 --- a/st2common/st2common/models/db/pack.py +++ b/st2common/st2common/models/db/pack.py @@ -47,6 +47,7 @@ class PackDB(stormbase.StormFoundationDB, stormbase.UIDFieldMixin, email = me.EmailField() contributors = me.ListField(field=me.StringField()) files = me.ListField(field=me.StringField()) + groups = me.ListField(field=me.DictField()) dependencies = me.ListField(field=me.StringField()) system = me.DictField() From 6223af7d8b0ebac6a265d2c51361f93d9ef72af4 Mon Sep 17 00:00:00 2001 From: Edward Medvedev Date: Sat, 11 Feb 2017 03:54:05 +0100 Subject: [PATCH 2/2] Change default from object to array --- st2common/st2common/models/api/pack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st2common/st2common/models/api/pack.py b/st2common/st2common/models/api/pack.py index a4a76d47e6..613bd6172c 100644 --- a/st2common/st2common/models/api/pack.py +++ b/st2common/st2common/models/api/pack.py @@ -210,7 +210,7 @@ def to_model(cls, pack): email = pack.email contributors = getattr(pack, 'contributors', []) files = getattr(pack, 'files', []) - groups = getattr(pack, 'groups', {}) + groups = getattr(pack, 'groups', []) dependencies = getattr(pack, 'dependencies', []) system = getattr(pack, 'system', {})