From cc5b37350c9fdde531d13076ef0471c5ca0df803 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Tue, 29 Nov 2022 19:37:11 +0800 Subject: [PATCH 1/4] perf: domain del nodes --- apps/assets/serializers/domain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/assets/serializers/domain.py b/apps/assets/serializers/domain.py index f60cb9516..3e2b4889f 100644 --- a/apps/assets/serializers/domain.py +++ b/apps/assets/serializers/domain.py @@ -24,7 +24,7 @@ class DomainSerializer(BulkOrgResourceModelSerializer): model = Domain fields_mini = ['id', 'name'] fields_small = fields_mini + ['comment'] - fields_m2m = ['nodes', 'assets'] + fields_m2m = ['assets'] read_only_fields = ['asset_count', 'gateway_count', 'date_created'] fields = fields_small + fields_m2m + read_only_fields From e191a197c6b71ed0be7a62b10cdc1af658401448 Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Tue, 29 Nov 2022 19:44:12 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E5=89=A9?= =?UTF-8?q?=E4=BD=99=E6=B5=81=E7=A8=8B,=20=E4=BF=AE=E6=94=B9=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ops/api/adhoc.py | 7 +- apps/ops/api/job.py | 18 +++-- apps/ops/api/playbook.py | 8 ++- .../ops/migrations/0036_auto_20221129_1529.py | 26 ++++++++ .../ops/migrations/0037_auto_20221129_1926.py | 26 ++++++++ apps/ops/migrations/0038_playbook_org_id.py | 18 +++++ .../ops/migrations/0039_auto_20221129_1932.py | 25 +++++++ apps/ops/models/adhoc.py | 36 ++-------- apps/ops/models/job.py | 9 ++- apps/ops/models/playbook.py | 6 +- apps/ops/serializers/adhoc.py | 65 ++----------------- apps/ops/serializers/job.py | 3 +- apps/ops/serializers/playbook.py | 5 +- apps/ops/tasks.py | 11 +--- 14 files changed, 144 insertions(+), 119 deletions(-) create mode 100644 apps/ops/migrations/0036_auto_20221129_1529.py create mode 100644 apps/ops/migrations/0037_auto_20221129_1926.py create mode 100644 apps/ops/migrations/0038_playbook_org_id.py create mode 100644 apps/ops/migrations/0039_auto_20221129_1932.py diff --git a/apps/ops/api/adhoc.py b/apps/ops/api/adhoc.py index 9889349df..aca7047f1 100644 --- a/apps/ops/api/adhoc.py +++ b/apps/ops/api/adhoc.py @@ -2,6 +2,8 @@ # from rest_framework import viewsets + +from orgs.mixins.api import OrgBulkModelViewSet from ..models import AdHoc from ..serializers import ( AdHocSerializer @@ -12,6 +14,7 @@ __all__ = [ ] -class AdHocViewSet(viewsets.ModelViewSet): - queryset = AdHoc.objects.all() +class AdHocViewSet(OrgBulkModelViewSet): serializer_class = AdHocSerializer + permission_classes = () + model = AdHoc diff --git a/apps/ops/api/job.py b/apps/ops/api/job.py index e668bcee0..65d741b52 100644 --- a/apps/ops/api/job.py +++ b/apps/ops/api/job.py @@ -5,10 +5,16 @@ from ops.serializers.job import JobSerializer, JobExecutionSerializer __all__ = ['JobViewSet', 'JobExecutionViewSet'] -from ops.tasks import run_ops_job, run_ops_job_executions +from ops.tasks import run_ops_job_execution from orgs.mixins.api import OrgBulkModelViewSet +def set_task_to_serializer_data(serializer, task): + data = getattr(serializer, "_data", {}) + data["task_id"] = task.id + setattr(serializer, "_data", data) + + class JobViewSet(OrgBulkModelViewSet): serializer_class = JobSerializer model = Job @@ -23,23 +29,25 @@ class JobViewSet(OrgBulkModelViewSet): def perform_create(self, serializer): instance = serializer.save() if instance.instant: - run_ops_job.delay(instance.id) + execution = instance.create_execution() + task = run_ops_job_execution.delay(execution.id) + set_task_to_serializer_data(serializer, task) class JobExecutionViewSet(OrgBulkModelViewSet): serializer_class = JobExecutionSerializer http_method_names = ('get', 'post', 'head', 'options',) - # filter_fields = ('type',) permission_classes = () model = JobExecution def perform_create(self, serializer): instance = serializer.save() - run_ops_job_executions.delay(instance.id) + task = run_ops_job_execution.delay(instance.id) + set_task_to_serializer_data(serializer, task) def get_queryset(self): query_set = super().get_queryset() job_id = self.request.query_params.get('job_id') if job_id: - self.queryset = query_set.filter(job_id=job_id) + query_set = query_set.filter(job_id=job_id) return query_set diff --git a/apps/ops/api/playbook.py b/apps/ops/api/playbook.py index 2cb846c0e..bda7dfe33 100644 --- a/apps/ops/api/playbook.py +++ b/apps/ops/api/playbook.py @@ -2,7 +2,8 @@ import os import zipfile from django.conf import settings -from rest_framework import viewsets + +from orgs.mixins.api import OrgBulkModelViewSet from ..models import Playbook from ..serializers.playbook import PlaybookSerializer @@ -15,9 +16,10 @@ def unzip_playbook(src, dist): fz.extract(file, dist) -class PlaybookViewSet(viewsets.ModelViewSet): - queryset = Playbook.objects.all() +class PlaybookViewSet(OrgBulkModelViewSet): serializer_class = PlaybookSerializer + permission_classes = () + model = Playbook def perform_create(self, serializer): instance = serializer.save() diff --git a/apps/ops/migrations/0036_auto_20221129_1529.py b/apps/ops/migrations/0036_auto_20221129_1529.py new file mode 100644 index 000000000..a766ee72d --- /dev/null +++ b/apps/ops/migrations/0036_auto_20221129_1529.py @@ -0,0 +1,26 @@ +# Generated by Django 3.2.14 on 2022-11-29 07:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ops', '0035_jobexecution_org_id'), + ] + + operations = [ + migrations.AlterModelOptions( + name='job', + options={'ordering': ['date_created']}, + ), + migrations.AlterModelOptions( + name='jobexecution', + options={'ordering': ['-date_created']}, + ), + migrations.AddField( + model_name='job', + name='use_parameter_define', + field=models.BooleanField(default=False, verbose_name='Use Parameter Define'), + ), + ] diff --git a/apps/ops/migrations/0037_auto_20221129_1926.py b/apps/ops/migrations/0037_auto_20221129_1926.py new file mode 100644 index 000000000..086a93cd7 --- /dev/null +++ b/apps/ops/migrations/0037_auto_20221129_1926.py @@ -0,0 +1,26 @@ +# Generated by Django 3.2.14 on 2022-11-29 11:26 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ops', '0036_auto_20221129_1529'), + ] + + operations = [ + migrations.RenameField( + model_name='adhoc', + old_name='owner', + new_name='creator', + ), + migrations.AddField( + model_name='adhoc', + name='org_id', + field=models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization'), + ), + migrations.DeleteModel( + name='AdHocExecution', + ), + ] diff --git a/apps/ops/migrations/0038_playbook_org_id.py b/apps/ops/migrations/0038_playbook_org_id.py new file mode 100644 index 000000000..0de95334c --- /dev/null +++ b/apps/ops/migrations/0038_playbook_org_id.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.14 on 2022-11-29 11:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ops', '0037_auto_20221129_1926'), + ] + + operations = [ + migrations.AddField( + model_name='playbook', + name='org_id', + field=models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization'), + ), + ] diff --git a/apps/ops/migrations/0039_auto_20221129_1932.py b/apps/ops/migrations/0039_auto_20221129_1932.py new file mode 100644 index 000000000..f54ed1cbe --- /dev/null +++ b/apps/ops/migrations/0039_auto_20221129_1932.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.14 on 2022-11-29 11:32 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('ops', '0038_playbook_org_id'), + ] + + operations = [ + migrations.RemoveField( + model_name='playbook', + name='owner', + ), + migrations.AddField( + model_name='playbook', + name='creator', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Creator'), + ), + ] diff --git a/apps/ops/models/adhoc.py b/apps/ops/models/adhoc.py index e94223fb9..2c0cf9940 100644 --- a/apps/ops/models/adhoc.py +++ b/apps/ops/models/adhoc.py @@ -1,21 +1,18 @@ # ~*~ coding: utf-8 ~*~ -import os.path import uuid from django.db import models from django.utils.translation import ugettext_lazy as _ -from common.db.models import BaseCreateUpdateModel from common.utils import get_logger -from .base import BaseAnsibleJob, BaseAnsibleExecution -from ..ansible import AdHocRunner +from orgs.mixins.models import JMSOrgBaseModel -__all__ = ["AdHoc", "AdHocExecution"] +__all__ = ["AdHoc"] logger = get_logger(__file__) -class AdHoc(BaseCreateUpdateModel): +class AdHoc(JMSOrgBaseModel): class Modules(models.TextChoices): shell = 'shell', _('Shell') winshell = 'win_shell', _('Powershell') @@ -26,7 +23,7 @@ class AdHoc(BaseCreateUpdateModel): module = models.CharField(max_length=128, choices=Modules.choices, default=Modules.shell, verbose_name=_('Module')) args = models.CharField(max_length=1024, default='', verbose_name=_('Args')) - owner = models.ForeignKey('users.User', verbose_name=_("Creator"), on_delete=models.SET_NULL, null=True) + creator = models.ForeignKey('users.User', verbose_name=_("Creator"), on_delete=models.SET_NULL, null=True) @property def row_count(self): @@ -41,28 +38,3 @@ class AdHoc(BaseCreateUpdateModel): def __str__(self): return "{}: {}".format(self.module, self.args) - - -class AdHocExecution(BaseAnsibleExecution): - """ - AdHoc running history. - """ - task = models.ForeignKey('AdHoc', verbose_name=_("Adhoc"), related_name='executions', on_delete=models.CASCADE) - - def get_runner(self): - inv = self.task.inventory - inv.write_to_file(self.inventory_path) - - runner = AdHocRunner( - self.inventory_path, self.task.module, module_args=self.task.args, - pattern=self.task.pattern, project_dir=self.private_dir - ) - return runner - - def task_display(self): - return str(self.task) - - class Meta: - db_table = "ops_adhoc_execution" - get_latest_by = 'date_start' - verbose_name = _("AdHoc execution") diff --git a/apps/ops/models/job.py b/apps/ops/models/job.py index 3795a0455..e74258b55 100644 --- a/apps/ops/models/job.py +++ b/apps/ops/models/job.py @@ -45,6 +45,7 @@ class Job(JMSOrgBaseModel, PeriodTaskModelMixin): runas = models.CharField(max_length=128, default='root', verbose_name=_('Runas')) runas_policy = models.CharField(max_length=128, choices=RunasPolicies.choices, default=RunasPolicies.skip, verbose_name=_('Runas policy')) + use_parameter_define = models.BooleanField(default=False, verbose_name=(_('Use Parameter Define'))) parameters_define = models.JSONField(default=dict, verbose_name=_('Parameters define')) comment = models.CharField(max_length=1024, default='', verbose_name=_('Comment'), null=True, blank=True) @@ -77,9 +78,9 @@ class Job(JMSOrgBaseModel, PeriodTaskModelMixin): return total_cost / finished_count if finished_count else 0 def get_register_task(self): - from ..tasks import run_ops_job + from ..tasks import run_ops_job_execution name = "run_ops_job_period_{}".format(str(self.id)[:8]) - task = run_ops_job.name + task = run_ops_job_execution.name args = (str(self.id),) kwargs = {} return name, task, args, kwargs @@ -108,6 +109,10 @@ class JobExecution(JMSOrgBaseModel): date_start = models.DateTimeField(null=True, verbose_name=_('Date start'), db_index=True) date_finished = models.DateTimeField(null=True, verbose_name=_("Date finished")) + @property + def job_type(self): + return self.job.type + def get_runner(self): inv = self.job.inventory inv.write_to_file(self.inventory_path) diff --git a/apps/ops/models/playbook.py b/apps/ops/models/playbook.py index 10be7bd06..9af396124 100644 --- a/apps/ops/models/playbook.py +++ b/apps/ops/models/playbook.py @@ -5,14 +5,14 @@ from django.conf import settings from django.db import models from django.utils.translation import gettext_lazy as _ -from common.db.models import BaseCreateUpdateModel +from orgs.mixins.models import JMSOrgBaseModel -class Playbook(BaseCreateUpdateModel): +class Playbook(JMSOrgBaseModel): id = models.UUIDField(default=uuid.uuid4, primary_key=True) name = models.CharField(max_length=128, verbose_name=_('Name'), null=True) path = models.FileField(upload_to='playbooks/') - owner = models.ForeignKey('users.User', verbose_name=_("Owner"), on_delete=models.SET_NULL, null=True) + creator = models.ForeignKey('users.User', verbose_name=_("Creator"), on_delete=models.SET_NULL, null=True) @property def work_path(self): diff --git a/apps/ops/serializers/adhoc.py b/apps/ops/serializers/adhoc.py index f5d8d4780..fdbb9a397 100644 --- a/apps/ops/serializers/adhoc.py +++ b/apps/ops/serializers/adhoc.py @@ -6,70 +6,15 @@ import datetime from rest_framework import serializers from common.drf.fields import ReadableHiddenField -from ..models import AdHoc, AdHocExecution +from orgs.mixins.serializers import BulkOrgResourceModelSerializer +from ..models import AdHoc -class AdHocSerializer(serializers.ModelSerializer): - owner = ReadableHiddenField(default=serializers.CurrentUserDefault()) +class AdHocSerializer(BulkOrgResourceModelSerializer, serializers.ModelSerializer): + creator = ReadableHiddenField(default=serializers.CurrentUserDefault()) row_count = serializers.IntegerField(read_only=True) size = serializers.IntegerField(read_only=True) class Meta: model = AdHoc - fields = ["id", "name", "module", "row_count", "size", "args", "owner", "date_created", "date_updated"] - - -class AdHocExecutionSerializer(serializers.ModelSerializer): - stat = serializers.SerializerMethodField() - last_success = serializers.ListField(source='success_hosts') - last_failure = serializers.DictField(source='failed_hosts') - - class Meta: - model = AdHocExecution - fields_mini = ['id'] - fields_small = fields_mini + [ - 'timedelta', 'result', 'summary', 'short_id', - 'is_finished', 'is_success', - 'date_start', 'date_finished', - ] - fields_fk = ['task', 'task_display'] - fields_custom = ['stat', 'last_success', 'last_failure'] - fields = fields_small + fields_fk + fields_custom - - @staticmethod - def get_task(obj): - return obj.task.id - - @staticmethod - def get_stat(obj): - count_failed_hosts = len(obj.failed_hosts) - count_success_hosts = len(obj.success_hosts) - count_total = count_success_hosts + count_failed_hosts - return { - "total": count_total, - "success": count_success_hosts, - "failed": count_failed_hosts - } - - -class AdHocExecutionExcludeResultSerializer(AdHocExecutionSerializer): - class Meta: - model = AdHocExecution - fields = [ - 'id', 'task', 'task_display', 'hosts_amount', 'adhoc', 'date_start', 'stat', - 'date_finished', 'timedelta', 'is_finished', 'is_success', - 'short_id', 'adhoc_short_id', 'last_success', 'last_failure' - ] - - -class AdHocExecutionNestSerializer(serializers.ModelSerializer): - last_success = serializers.ListField(source='success_hosts') - last_failure = serializers.DictField(source='failed_hosts') - last_run = serializers.CharField(source='short_id') - - class Meta: - model = AdHocExecution - fields = ( - 'last_success', 'last_failure', 'last_run', 'timedelta', - 'is_finished', 'is_success' - ) + fields = ["id", "name", "module", "row_count", "size", "args", "creator", "date_created", "date_updated"] diff --git a/apps/ops/serializers/job.py b/apps/ops/serializers/job.py index e5d76f85b..5775c7094 100644 --- a/apps/ops/serializers/job.py +++ b/apps/ops/serializers/job.py @@ -15,6 +15,7 @@ class JobSerializer(BulkOrgResourceModelSerializer, PeriodTaskSerializerMixin): read_only_fields = ["id", "date_last_run", "date_created", "date_updated", "average_time_cost"] fields = read_only_fields + [ "name", "instant", "type", "module", "args", "playbook", "assets", "runas_policy", "runas", "owner", + "use_parameter_define", "parameters_define", "timeout", "chdir", @@ -28,7 +29,7 @@ class JobExecutionSerializer(serializers.ModelSerializer): class Meta: model = JobExecution read_only_fields = ["id", "task_id", "timedelta", "time_cost", 'is_finished', 'date_start', 'date_created', - 'is_success', 'task_id', 'short_id'] + 'is_success', 'task_id', 'short_id', 'job_type'] fields = read_only_fields + [ "job", "parameters" ] diff --git a/apps/ops/serializers/playbook.py b/apps/ops/serializers/playbook.py index 7ca165501..0dc1c458e 100644 --- a/apps/ops/serializers/playbook.py +++ b/apps/ops/serializers/playbook.py @@ -4,6 +4,7 @@ from rest_framework import serializers from common.drf.fields import ReadableHiddenField from ops.models import Playbook +from orgs.mixins.serializers import BulkOrgResourceModelSerializer def parse_playbook_name(path): @@ -11,8 +12,8 @@ def parse_playbook_name(path): return file_name.split(".")[-2] -class PlaybookSerializer(serializers.ModelSerializer): - owner = ReadableHiddenField(default=serializers.CurrentUserDefault()) +class PlaybookSerializer(BulkOrgResourceModelSerializer, serializers.ModelSerializer): + creator = ReadableHiddenField(default=serializers.CurrentUserDefault()) def create(self, validated_data): name = validated_data.get('name') diff --git a/apps/ops/tasks.py b/apps/ops/tasks.py index 51541dd32..bd4d5d448 100644 --- a/apps/ops/tasks.py +++ b/apps/ops/tasks.py @@ -30,18 +30,11 @@ def run_ops_job(job_id): job = get_object_or_none(Job, id=job_id) with tmp_to_org(job.org): execution = job.create_execution() - try: - execution.start() - except SoftTimeLimitExceeded: - execution.set_error('Run timeout') - logger.error("Run adhoc timeout") - except Exception as e: - execution.set_error(e) - logger.error("Start adhoc execution error: {}".format(e)) + run_ops_job_execution(execution) @shared_task(soft_time_limit=60, queue="ansible", verbose_name=_("Run ansible task execution")) -def run_ops_job_executions(execution_id, **kwargs): +def run_ops_job_execution(execution_id, **kwargs): execution = get_object_or_none(JobExecution, id=execution_id) with tmp_to_org(execution.org): try: From d741f1434266fa62c089db912c26e5d200921651 Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Tue, 29 Nov 2022 19:47:45 +0800 Subject: [PATCH 3/4] feat: merge migrations --- ...6_auto_20221128_1839_0039_auto_20221129_1932.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 apps/ops/migrations/0040_merge_0036_auto_20221128_1839_0039_auto_20221129_1932.py diff --git a/apps/ops/migrations/0040_merge_0036_auto_20221128_1839_0039_auto_20221129_1932.py b/apps/ops/migrations/0040_merge_0036_auto_20221128_1839_0039_auto_20221129_1932.py new file mode 100644 index 000000000..c0bbcb9a1 --- /dev/null +++ b/apps/ops/migrations/0040_merge_0036_auto_20221128_1839_0039_auto_20221129_1932.py @@ -0,0 +1,14 @@ +# Generated by Django 3.2.14 on 2022-11-29 11:47 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('ops', '0036_auto_20221128_1839'), + ('ops', '0039_auto_20221129_1932'), + ] + + operations = [ + ] From 82a8118ca0f14e5e77f766213a99939514f952d4 Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Tue, 29 Nov 2022 19:52:48 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0comment=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ops/migrations/0041_auto_20221129_1952.py | 23 +++++++++++++++++++ apps/ops/models/adhoc.py | 2 ++ apps/ops/models/playbook.py | 1 + apps/ops/serializers/adhoc.py | 3 ++- apps/ops/serializers/playbook.py | 2 +- 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 apps/ops/migrations/0041_auto_20221129_1952.py diff --git a/apps/ops/migrations/0041_auto_20221129_1952.py b/apps/ops/migrations/0041_auto_20221129_1952.py new file mode 100644 index 000000000..fb3411a4d --- /dev/null +++ b/apps/ops/migrations/0041_auto_20221129_1952.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.14 on 2022-11-29 11:52 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ops', '0040_merge_0036_auto_20221128_1839_0039_auto_20221129_1932'), + ] + + operations = [ + migrations.AddField( + model_name='adhoc', + name='comment', + field=models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='Comment'), + ), + migrations.AddField( + model_name='playbook', + name='comment', + field=models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='Comment'), + ), + ] diff --git a/apps/ops/models/adhoc.py b/apps/ops/models/adhoc.py index 2c0cf9940..890a47b91 100644 --- a/apps/ops/models/adhoc.py +++ b/apps/ops/models/adhoc.py @@ -24,6 +24,8 @@ class AdHoc(JMSOrgBaseModel): verbose_name=_('Module')) args = models.CharField(max_length=1024, default='', verbose_name=_('Args')) creator = models.ForeignKey('users.User', verbose_name=_("Creator"), on_delete=models.SET_NULL, null=True) + comment = models.CharField(max_length=1024, default='', verbose_name=_('Comment'), null=True, blank=True) + @property def row_count(self): diff --git a/apps/ops/models/playbook.py b/apps/ops/models/playbook.py index 9af396124..eb767649a 100644 --- a/apps/ops/models/playbook.py +++ b/apps/ops/models/playbook.py @@ -13,6 +13,7 @@ class Playbook(JMSOrgBaseModel): name = models.CharField(max_length=128, verbose_name=_('Name'), null=True) path = models.FileField(upload_to='playbooks/') creator = models.ForeignKey('users.User', verbose_name=_("Creator"), on_delete=models.SET_NULL, null=True) + comment = models.CharField(max_length=1024, default='', verbose_name=_('Comment'), null=True, blank=True) @property def work_path(self): diff --git a/apps/ops/serializers/adhoc.py b/apps/ops/serializers/adhoc.py index fdbb9a397..48ddf6567 100644 --- a/apps/ops/serializers/adhoc.py +++ b/apps/ops/serializers/adhoc.py @@ -17,4 +17,5 @@ class AdHocSerializer(BulkOrgResourceModelSerializer, serializers.ModelSerialize class Meta: model = AdHoc - fields = ["id", "name", "module", "row_count", "size", "args", "creator", "date_created", "date_updated"] + fields = ["id", "name", "module", "row_count", "size", "args", "creator", "comment", "date_created", + "date_updated"] diff --git a/apps/ops/serializers/playbook.py b/apps/ops/serializers/playbook.py index 0dc1c458e..57c7f2fe5 100644 --- a/apps/ops/serializers/playbook.py +++ b/apps/ops/serializers/playbook.py @@ -25,5 +25,5 @@ class PlaybookSerializer(BulkOrgResourceModelSerializer, serializers.ModelSerial class Meta: model = Playbook fields = [ - "id", "name", "path", "date_created", "owner", "date_updated" + "id", "name", "path", "comment", "date_created", "creator", "date_updated" ]