mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
185 lines
13 KiB
185 lines
13 KiB
# Generated by Django 4.1.13 on 2024-05-09 03:16
|
|
|
|
import common.db.encoder
|
|
from django.db import migrations, models
|
|
import private_storage.fields
|
|
import private_storage.storage.files
|
|
import simple_history.models
|
|
import uuid
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='AdHoc',
|
|
fields=[
|
|
('created_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by')),
|
|
('updated_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by')),
|
|
('date_created', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Date created')),
|
|
('date_updated', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
|
|
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
|
|
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
|
|
('name', models.CharField(max_length=128, verbose_name='Name')),
|
|
('pattern', models.CharField(default='all', max_length=1024, verbose_name='Pattern')),
|
|
('module', models.CharField(choices=[('shell', 'Shell'), ('win_shell', 'Powershell'), ('python', 'Python'), ('mysql', 'MySQL'), ('mariadb', 'MariaDB'), ('postgresql', 'PostgreSQL'), ('sqlserver', 'SQLServer'), ('oracle', 'Oracle'), ('raw', 'Raw')], default='shell', max_length=128, verbose_name='Module')),
|
|
('args', models.CharField(default='', max_length=8192, verbose_name='Args')),
|
|
('comment', models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='Comment')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Adhoc',
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='CeleryTask',
|
|
fields=[
|
|
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
|
|
('name', models.CharField(max_length=1024, verbose_name='Name')),
|
|
('date_last_publish', models.DateTimeField(null=True, verbose_name='Date last publish')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Celery Task',
|
|
'ordering': ('name',),
|
|
'permissions': [('view_taskmonitor', 'Can view task monitor')],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='CeleryTaskExecution',
|
|
fields=[
|
|
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
|
|
('name', models.CharField(max_length=1024, verbose_name='Name')),
|
|
('args', models.JSONField(verbose_name='Args')),
|
|
('kwargs', models.JSONField(verbose_name='Kwargs')),
|
|
('state', models.CharField(max_length=16, verbose_name='State')),
|
|
('is_finished', models.BooleanField(default=False, verbose_name='Finished')),
|
|
('date_published', models.DateTimeField(auto_now_add=True, verbose_name='Date published')),
|
|
('date_start', models.DateTimeField(null=True, verbose_name='Date start')),
|
|
('date_finished', models.DateTimeField(null=True, verbose_name='Date finished')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Celery Task Execution',
|
|
'ordering': ['-date_start'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='HistoricalJob',
|
|
fields=[
|
|
('created_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by')),
|
|
('updated_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by')),
|
|
('date_created', models.DateTimeField(blank=True, editable=False, null=True, verbose_name='Date created')),
|
|
('date_updated', models.DateTimeField(blank=True, editable=False, verbose_name='Date updated')),
|
|
('id', models.UUIDField(db_index=True, default=uuid.uuid4)),
|
|
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
|
|
('is_periodic', models.BooleanField(default=False, verbose_name='Periodic run')),
|
|
('interval', models.IntegerField(blank=True, default=24, null=True, verbose_name='Interval')),
|
|
('crontab', models.CharField(blank=True, max_length=128, null=True, verbose_name='Crontab')),
|
|
('name', models.CharField(max_length=128, null=True, verbose_name='Name')),
|
|
('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')),
|
|
('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')),
|
|
('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)),
|
|
('history_date', models.DateTimeField(db_index=True)),
|
|
('history_change_reason', models.CharField(max_length=100, null=True)),
|
|
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
|
],
|
|
options={
|
|
'verbose_name': 'historical Job',
|
|
'verbose_name_plural': 'historical Jobs',
|
|
'ordering': ('-history_date', '-history_id'),
|
|
'get_latest_by': ('history_date', 'history_id'),
|
|
},
|
|
bases=(simple_history.models.HistoricalChanges, models.Model),
|
|
),
|
|
migrations.CreateModel(
|
|
name='Job',
|
|
fields=[
|
|
('created_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by')),
|
|
('updated_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by')),
|
|
('date_created', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Date created')),
|
|
('date_updated', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
|
|
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
|
|
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
|
|
('is_periodic', models.BooleanField(default=False, verbose_name='Periodic run')),
|
|
('interval', models.IntegerField(blank=True, default=24, null=True, verbose_name='Interval')),
|
|
('crontab', models.CharField(blank=True, max_length=128, null=True, verbose_name='Crontab')),
|
|
('name', models.CharField(max_length=128, null=True, verbose_name='Name')),
|
|
('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')),
|
|
('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')),
|
|
('comment', models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='Comment')),
|
|
('version', models.IntegerField(default=0)),
|
|
],
|
|
options={
|
|
'verbose_name': 'Job',
|
|
'ordering': ['date_created'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='JobExecution',
|
|
fields=[
|
|
('created_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by')),
|
|
('updated_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by')),
|
|
('date_updated', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
|
|
('comment', models.TextField(blank=True, default='', verbose_name='Comment')),
|
|
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
|
|
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
|
|
('task_id', models.UUIDField(null=True)),
|
|
('status', models.CharField(default='running', max_length=16, verbose_name='Status')),
|
|
('job_version', models.IntegerField(default=0)),
|
|
('parameters', models.JSONField(default=dict, verbose_name='Parameters')),
|
|
('result', models.JSONField(blank=True, encoder=common.db.encoder.ModelJSONFieldEncoder, null=True, verbose_name='Result')),
|
|
('summary', models.JSONField(default=dict, encoder=common.db.encoder.ModelJSONFieldEncoder, verbose_name='Summary')),
|
|
('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Date created')),
|
|
('date_start', models.DateTimeField(db_index=True, null=True, verbose_name='Date start')),
|
|
('date_finished', models.DateTimeField(null=True, verbose_name='Date finished')),
|
|
('material', models.CharField(blank=True, default='', max_length=8192, null=True, verbose_name='Material')),
|
|
('job_type', models.CharField(choices=[('adhoc', 'Adhoc'), ('playbook', 'Playbook'), ('upload_file', 'Upload File')], default='adhoc', max_length=128, verbose_name='Material Type')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Job Execution',
|
|
'ordering': ['-date_created'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Playbook',
|
|
fields=[
|
|
('created_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Created by')),
|
|
('updated_by', models.CharField(blank=True, max_length=128, null=True, verbose_name='Updated by')),
|
|
('date_created', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Date created')),
|
|
('date_updated', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
|
|
('org_id', models.CharField(blank=True, db_index=True, default='', max_length=36, verbose_name='Organization')),
|
|
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
|
|
('name', models.CharField(max_length=128, null=True, verbose_name='Name')),
|
|
('path', private_storage.fields.PrivateFileField(storage=private_storage.storage.files.PrivateFileSystemStorage(), upload_to='playbooks/')),
|
|
('comment', models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='Comment')),
|
|
('create_method', models.CharField(choices=[('blank', 'Blank'), ('vcs', 'VCS')], default='blank', max_length=128, verbose_name='CreateMethod')),
|
|
('vcs_url', models.CharField(blank=True, default='', max_length=1024, null=True, verbose_name='VCS URL')),
|
|
],
|
|
options={
|
|
'ordering': ['date_created'],
|
|
'verbose_name': 'Playbook'
|
|
},
|
|
),
|
|
]
|