diff --git a/apps/i18n/core/en/LC_MESSAGES/django.po b/apps/i18n/core/en/LC_MESSAGES/django.po index a89e1c5f6..f2217b7b4 100644 --- a/apps/i18n/core/en/LC_MESSAGES/django.po +++ b/apps/i18n/core/en/LC_MESSAGES/django.po @@ -4192,11 +4192,11 @@ msgid "Upload File" msgstr "" #: ops/const.py:44 -msgid "Privileged Only" +msgid "Privileged only" msgstr "" #: ops/const.py:45 -msgid "Privileged First" +msgid "Privileged first" msgstr "" #: ops/const.py:50 ops/const.py:61 @@ -4291,7 +4291,7 @@ msgid "Args" msgstr "" #: ops/models/base.py:19 -msgid "Account policy" +msgid "Run as policy" msgstr "" #: ops/models/base.py:20 @@ -4342,7 +4342,7 @@ msgid "Celery Task Execution" msgstr "" #: ops/models/job.py:147 -msgid "Chdir" +msgid "Run dir" msgstr "" #: ops/models/job.py:148 @@ -4358,11 +4358,11 @@ msgid "Parameters define" msgstr "" #: ops/models/job.py:155 -msgid "Runas" +msgid "Run as" msgstr "" #: ops/models/job.py:157 -msgid "Runas policy" +msgid "Run as policy" msgstr "" #: ops/models/job.py:221 terminal/notifications.py:174 diff --git a/apps/i18n/core/ja/LC_MESSAGES/django.po b/apps/i18n/core/ja/LC_MESSAGES/django.po index 64bcc3781..45140420b 100644 --- a/apps/i18n/core/ja/LC_MESSAGES/django.po +++ b/apps/i18n/core/ja/LC_MESSAGES/django.po @@ -4340,11 +4340,11 @@ msgid "Upload File" msgstr "ファイルのアップロード" #: ops/const.py:44 -msgid "Privileged Only" +msgid "Privileged only" msgstr "特権アカウントのみ" #: ops/const.py:45 -msgid "Privileged First" +msgid "Privileged first" msgstr "特権アカウント優先" #: ops/const.py:50 ops/const.py:61 @@ -4449,7 +4449,7 @@ msgstr "アルグ" # msgid "Creator" # msgstr "作成者" #: ops/models/base.py:19 -msgid "Account policy" +msgid "Run as policy" msgstr "アカウント ポリシー" #: ops/models/base.py:20 @@ -4500,7 +4500,7 @@ msgid "Celery Task Execution" msgstr "Celery タスク実行" #: ops/models/job.py:147 -msgid "Chdir" +msgid "Run dir" msgstr "実行ディレクトリ" #: ops/models/job.py:148 @@ -4516,11 +4516,11 @@ msgid "Parameters define" msgstr "パラメータ定義" #: ops/models/job.py:155 -msgid "Runas" +msgid "Run as" msgstr "ユーザーとして実行" #: ops/models/job.py:157 -msgid "Runas policy" +msgid "Run as policy" msgstr "ユーザー ポリシー" #: ops/models/job.py:221 terminal/notifications.py:174 diff --git a/apps/i18n/core/zh/LC_MESSAGES/django.po b/apps/i18n/core/zh/LC_MESSAGES/django.po index 1bbbcfbeb..d38016479 100644 --- a/apps/i18n/core/zh/LC_MESSAGES/django.po +++ b/apps/i18n/core/zh/LC_MESSAGES/django.po @@ -4263,11 +4263,11 @@ msgid "Upload File" msgstr "上传" #: ops/const.py:44 -msgid "Privileged Only" +msgid "Privileged only" msgstr "仅限特权账号" #: ops/const.py:45 -msgid "Privileged First" +msgid "Privileged first" msgstr "特权账号优先" #: ops/const.py:50 ops/const.py:61 @@ -4364,7 +4364,7 @@ msgstr "参数" # msgid "Creator" # msgstr "创建者" #: ops/models/base.py:19 -msgid "Account policy" +msgid "Run as policy" msgstr "账号策略" #: ops/models/base.py:20 @@ -4415,7 +4415,7 @@ msgid "Celery Task Execution" msgstr "Celery 任务执行" #: ops/models/job.py:147 -msgid "Chdir" +msgid "Run dir" msgstr "运行目录" #: ops/models/job.py:148 @@ -4431,11 +4431,11 @@ msgid "Parameters define" msgstr "参数定义" #: ops/models/job.py:155 -msgid "Runas" +msgid "Run as" msgstr "运行用户" #: ops/models/job.py:157 -msgid "Runas policy" +msgid "Run as policy" msgstr "用户策略" #: ops/models/job.py:221 terminal/notifications.py:174 diff --git a/apps/ops/const.py b/apps/ops/const.py index 61f0b5e32..ee4e90a91 100644 --- a/apps/ops/const.py +++ b/apps/ops/const.py @@ -41,8 +41,8 @@ class Types(models.TextChoices): class RunasPolicies(models.TextChoices): - privileged_only = 'privileged_only', _('Privileged Only') - privileged_first = 'privileged_first', _('Privileged First') + privileged_only = 'privileged_only', _('Privileged only') + privileged_first = 'privileged_first', _('Privileged first') skip = 'skip', _('Skip') diff --git a/apps/ops/migrations/0001_initial.py b/apps/ops/migrations/0001_initial.py index d0ce8a4b3..8057e1485 100644 --- a/apps/ops/migrations/0001_initial.py +++ b/apps/ops/migrations/0001_initial.py @@ -1,11 +1,13 @@ # Generated by Django 4.1.13 on 2024-05-09 03:16 -import common.db.encoder -from django.db import migrations, models +import uuid + import private_storage.fields import private_storage.storage.files import simple_history.models -import uuid +from django.db import migrations, models + +import common.db.encoder class Migration(migrations.Migration): @@ -82,13 +84,13 @@ class Migration(migrations.Migration): ('instant', models.BooleanField(default=False)), ('args', models.CharField(blank=True, default='', max_length=8192, null=True, verbose_name='Args')), ('module', models.CharField(choices=[('shell', 'Shell'), ('win_shell', 'Powershell'), ('python', 'Python'), ('mysql', 'MySQL'), ('postgresql', 'PostgreSQL'), ('sqlserver', 'SQLServer'), ('raw', 'Raw'), ('huawei', 'HUAWEI')], default='shell', max_length=128, null=True, verbose_name='Module')), - ('chdir', models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='Chdir')), + ('chdir', models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='Run dir')), ('timeout', models.IntegerField(default=-1, verbose_name='Timeout (Seconds)')), ('type', models.CharField(choices=[('adhoc', 'Adhoc'), ('playbook', 'Playbook'), ('upload_file', 'Upload File')], default='adhoc', max_length=128, verbose_name='Type')), ('use_parameter_define', models.BooleanField(default=False, verbose_name='Use Parameter Define')), ('parameters_define', models.JSONField(default=dict, verbose_name='Parameters define')), - ('runas', models.CharField(default='root', max_length=128, verbose_name='Runas')), - ('runas_policy', models.CharField(choices=[('privileged_only', 'Privileged Only'), ('privileged_first', 'Privileged First'), ('skip', 'Skip')], default='skip', max_length=128, verbose_name='Runas policy')), + ('runas', models.CharField(default='root', max_length=128, verbose_name='Run as')), + ('runas_policy', models.CharField(choices=[('privileged_only', 'Privileged only'), ('privileged_first', 'Privileged first'), ('skip', 'Skip')], default='skip', max_length=128, verbose_name='Run as policy')), ('comment', models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='Comment')), ('version', models.IntegerField(default=0)), ('history_id', models.AutoField(primary_key=True, serialize=False)), @@ -120,13 +122,13 @@ class Migration(migrations.Migration): ('instant', models.BooleanField(default=False)), ('args', models.CharField(blank=True, default='', max_length=8192, null=True, verbose_name='Args')), ('module', models.CharField(choices=[('shell', 'Shell'), ('win_shell', 'Powershell'), ('python', 'Python'), ('mysql', 'MySQL'), ('postgresql', 'PostgreSQL'), ('sqlserver', 'SQLServer'), ('raw', 'Raw'), ('huawei', 'HUAWEI')], default='shell', max_length=128, null=True, verbose_name='Module')), - ('chdir', models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='Chdir')), + ('chdir', models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='Run dir')), ('timeout', models.IntegerField(default=-1, verbose_name='Timeout (Seconds)')), ('type', models.CharField(choices=[('adhoc', 'Adhoc'), ('playbook', 'Playbook'), ('upload_file', 'Upload File')], default='adhoc', max_length=128, verbose_name='Type')), ('use_parameter_define', models.BooleanField(default=False, verbose_name='Use Parameter Define')), ('parameters_define', models.JSONField(default=dict, verbose_name='Parameters define')), - ('runas', models.CharField(default='root', max_length=128, verbose_name='Runas')), - ('runas_policy', models.CharField(choices=[('privileged_only', 'Privileged Only'), ('privileged_first', 'Privileged First'), ('skip', 'Skip')], default='skip', max_length=128, verbose_name='Runas policy')), + ('runas', models.CharField(default='root', max_length=128, verbose_name='Run as')), + ('runas_policy', models.CharField(choices=[('privileged_only', 'Privileged only'), ('privileged_first', 'Privileged first'), ('skip', 'Skip')], default='skip', max_length=128, verbose_name='Run as policy')), ('comment', models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='Comment')), ('version', models.IntegerField(default=0)), ], diff --git a/apps/ops/models/base.py b/apps/ops/models/base.py index 3d6d1438d..64225cecb 100644 --- a/apps/ops/models/base.py +++ b/apps/ops/models/base.py @@ -1,11 +1,11 @@ +import logging import os.path import uuid -import logging +from django.conf import settings from django.db import models -from django.utils.translation import gettext_lazy as _ from django.utils import timezone -from django.conf import settings +from django.utils.translation import gettext_lazy as _ from orgs.mixins.models import JMSOrgBaseModel from ..ansible.inventory import JMSInventory @@ -16,7 +16,7 @@ class BaseAnsibleJob(PeriodTaskModelMixin, JMSOrgBaseModel): owner = models.ForeignKey('users.User', verbose_name=_("Creator"), on_delete=models.SET_NULL, null=True) assets = models.ManyToManyField('assets.Asset', verbose_name=_("Assets")) account = models.CharField(max_length=128, default='root', verbose_name=_('Account')) - account_policy = models.CharField(max_length=128, default='root', verbose_name=_('Account policy')) + account_policy = models.CharField(max_length=128, default='root', verbose_name=_('Run as policy')) last_execution = models.ForeignKey('BaseAnsibleExecution', verbose_name=_("Last execution"), on_delete=models.SET_NULL, null=True) date_last_run = models.DateTimeField(null=True, verbose_name=_('Date last run')) diff --git a/apps/ops/models/job.py b/apps/ops/models/job.py index 9e7fcd511..fea3679c7 100644 --- a/apps/ops/models/job.py +++ b/apps/ops/models/job.py @@ -144,7 +144,7 @@ class Job(JMSOrgBaseModel, PeriodTaskModelMixin): args = models.CharField(max_length=8192, default='', verbose_name=_('Args'), null=True, blank=True) module = models.CharField(max_length=128, choices=JobModules.choices, default=JobModules.shell, verbose_name=_('Module'), null=True) - chdir = models.CharField(default="", max_length=1024, verbose_name=_('Chdir'), null=True, blank=True) + chdir = models.CharField(default="", max_length=1024, verbose_name=_('Run dir'), null=True, blank=True) timeout = models.IntegerField(default=-1, verbose_name=_('Timeout (Seconds)')) playbook = models.ForeignKey('ops.Playbook', verbose_name=_("Playbook"), null=True, on_delete=models.SET_NULL) type = models.CharField(max_length=128, choices=Types.choices, default=Types.adhoc, verbose_name=_("Type")) @@ -152,9 +152,9 @@ class Job(JMSOrgBaseModel, PeriodTaskModelMixin): assets = models.ManyToManyField('assets.Asset', verbose_name=_("Assets")) use_parameter_define = models.BooleanField(default=False, verbose_name=(_('Use Parameter Define'))) parameters_define = models.JSONField(default=dict, verbose_name=_('Parameters define')) - runas = models.CharField(max_length=128, default='root', verbose_name=_('Runas')) + runas = models.CharField(max_length=128, default='root', verbose_name=_('Run as')) runas_policy = models.CharField(max_length=128, choices=RunasPolicies.choices, default=RunasPolicies.skip, - verbose_name=_('Runas policy')) + verbose_name=_('Run as policy')) comment = models.CharField(max_length=1024, default='', verbose_name=_('Comment'), null=True, blank=True) version = models.IntegerField(default=0) history = HistoricalRecords()