mirror of https://github.com/jumpserver/jumpserver
ibuler
2 years ago
35 changed files with 3584 additions and 3159 deletions
@ -1,73 +0,0 @@
|
||||
# Generated by Django 3.2.13 on 2022-10-09 08:50 |
||||
|
||||
from django.db import migrations |
||||
|
||||
|
||||
def migrate_create_history_account(apps, schema_editor): |
||||
db_alias = schema_editor.connection.alias |
||||
account_model = apps.get_model('assets', 'Account') |
||||
history_account_model = apps.get_model('assets', 'HistoricalAccount') |
||||
history_accounts = [] |
||||
for account in account_model.objects.using(db_alias).all(): |
||||
data = { |
||||
'id': account.id, |
||||
'secret': account.secret, |
||||
'secret_type': account.secret_type, |
||||
'history_date': account.date_created, |
||||
} |
||||
history_accounts.append(history_account_model(**data)) |
||||
history_account_model.objects.using(db_alias).bulk_create(history_accounts) |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
dependencies = [ |
||||
('assets', '0106_auto_20220916_1556'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.RemoveField( |
||||
model_name='historicalaccount', |
||||
name='asset', |
||||
), |
||||
migrations.RemoveField( |
||||
model_name='historicalaccount', |
||||
name='comment', |
||||
), |
||||
migrations.RemoveField( |
||||
model_name='historicalaccount', |
||||
name='created_by', |
||||
), |
||||
migrations.RemoveField( |
||||
model_name='historicalaccount', |
||||
name='date_created', |
||||
), |
||||
migrations.RemoveField( |
||||
model_name='historicalaccount', |
||||
name='date_updated', |
||||
), |
||||
migrations.RemoveField( |
||||
model_name='historicalaccount', |
||||
name='name', |
||||
), |
||||
migrations.RemoveField( |
||||
model_name='historicalaccount', |
||||
name='org_id', |
||||
), |
||||
migrations.RemoveField( |
||||
model_name='historicalaccount', |
||||
name='privileged', |
||||
), |
||||
migrations.RemoveField( |
||||
model_name='historicalaccount', |
||||
name='su_from', |
||||
), |
||||
migrations.RemoveField( |
||||
model_name='historicalaccount', |
||||
name='username', |
||||
), |
||||
migrations.RemoveField( |
||||
model_name='historicalaccount', |
||||
name='version', |
||||
), |
||||
migrations.RunPython(migrate_create_history_account), |
||||
] |
@ -1,83 +0,0 @@
|
||||
# Generated by Django 3.2.14 on 2022-10-13 09:51 |
||||
|
||||
import common.db.fields |
||||
from django.conf import settings |
||||
from django.db import migrations, models |
||||
import django.db.models.deletion |
||||
import uuid |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
||||
('assets', '0108_migrate_automation'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.RenameModel( |
||||
old_name='ChangePasswordAutomation', |
||||
new_name='ChangeSecretAutomation', |
||||
), |
||||
migrations.AddField( |
||||
model_name='baseautomation', |
||||
name='is_active', |
||||
field=models.BooleanField(default=True, verbose_name='Is active'), |
||||
), |
||||
migrations.AddField( |
||||
model_name='changesecretautomation', |
||||
name='password_rules', |
||||
field=models.JSONField(default=dict, verbose_name='Password rules'), |
||||
), |
||||
migrations.AddField( |
||||
model_name='changesecretautomation', |
||||
name='password_strategy', |
||||
field=models.CharField(choices=[('specific', 'Specific'), ('random_one', 'All assets use the same random password'), ('random_all', 'All assets use different random password')], default='random_one', max_length=16, verbose_name='Password strategy'), |
||||
), |
||||
migrations.AddField( |
||||
model_name='changesecretautomation', |
||||
name='secret_types', |
||||
field=models.JSONField(default=list, verbose_name='Secret types'), |
||||
), |
||||
migrations.AddField( |
||||
model_name='changesecretautomation', |
||||
name='ssh_key', |
||||
field=common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='SSH key'), |
||||
), |
||||
migrations.AddField( |
||||
model_name='changesecretautomation', |
||||
name='ssh_key_change_strategy', |
||||
field=models.CharField(choices=[('add', 'Append SSH KEY'), ('set', 'Empty and append SSH KEY'), ('set_jms', 'Replace (The key generated by JumpServer) ')], default='add', max_length=16, verbose_name='SSH key strategy'), |
||||
), |
||||
migrations.AddField( |
||||
model_name='changesecretautomation', |
||||
name='ssh_key_strategy', |
||||
field=models.CharField(choices=[('specific', 'Specific'), ('random_one', 'All assets use the same random password'), ('random_all', 'All assets use different random password')], default='random_one', max_length=16), |
||||
), |
||||
migrations.AlterField( |
||||
model_name='changesecretautomation', |
||||
name='recipients', |
||||
field=models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='Recipient'), |
||||
), |
||||
migrations.CreateModel( |
||||
name='ChangeSecretRecord', |
||||
fields=[ |
||||
('created_by', models.CharField(blank=True, max_length=32, null=True, verbose_name='Created by')), |
||||
('updated_by', models.CharField(blank=True, max_length=32, 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)), |
||||
('old_secret', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='Old secret')), |
||||
('new_secret', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='Secret')), |
||||
('date_started', models.DateTimeField(blank=True, null=True, verbose_name='Date started')), |
||||
('date_finished', models.DateTimeField(blank=True, null=True, verbose_name='Date finished')), |
||||
('status', models.CharField(default='pending', max_length=16)), |
||||
('error', models.TextField(blank=True, null=True, verbose_name='Error')), |
||||
('account', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='assets.account')), |
||||
('execution', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assets.automationexecution')), |
||||
], |
||||
options={ |
||||
'verbose_name': 'Change secret', |
||||
}, |
||||
), |
||||
] |
@ -1,24 +0,0 @@
|
||||
# Generated by Django 3.2.14 on 2022-10-14 11:40 |
||||
|
||||
from django.db import migrations, models |
||||
import django.db.models.deletion |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('assets', '0109_auto_20221013_1751'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.CreateModel( |
||||
name='GatherFactsAutomation', |
||||
fields=[ |
||||
('baseautomation_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='assets.baseautomation')), |
||||
], |
||||
options={ |
||||
'verbose_name': 'Gather asset facts', |
||||
}, |
||||
bases=('assets.baseautomation',), |
||||
), |
||||
] |
@ -1,23 +0,0 @@
|
||||
# Generated by Django 3.2.14 on 2022-10-17 06:41 |
||||
|
||||
from django.db import migrations, models |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('assets', '0110_gatherfactsautomation'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.AddField( |
||||
model_name='platformprotocol', |
||||
name='default', |
||||
field=models.BooleanField(default=True, verbose_name='Default'), |
||||
), |
||||
migrations.AddField( |
||||
model_name='platformprotocol', |
||||
name='required', |
||||
field=models.BooleanField(default=False, verbose_name='Required'), |
||||
), |
||||
] |
@ -1,5 +1,5 @@
|
||||
from .change_secret import * |
||||
from .account_discovery import * |
||||
from .account_reconcile import * |
||||
from .account_verify import * |
||||
from .discovery_account import * |
||||
from .push_account import * |
||||
from .verify_secret import * |
||||
from .gather_facts import * |
||||
|
@ -1,16 +1,15 @@
|
||||
from django.utils.translation import ugettext_lazy as _ |
||||
|
||||
from ops.const import StrategyChoice |
||||
from .base import BaseAutomation |
||||
|
||||
|
||||
class ReconcileAutomation(BaseAutomation): |
||||
class DiscoveryAccountAutomation(BaseAutomation): |
||||
class Meta: |
||||
verbose_name = _("Reconcile strategy") |
||||
verbose_name = _("Discovery account automation") |
||||
|
||||
def to_attr_json(self): |
||||
attr_json = super().to_attr_json() |
||||
attr_json.update({ |
||||
'type': StrategyChoice.push |
||||
'type': 'discover_account' |
||||
}) |
||||
return attr_json |
@ -1,17 +1,15 @@
|
||||
from django.utils.translation import ugettext_lazy as _ |
||||
|
||||
from ops.const import StrategyChoice |
||||
from ops.ansible.runner import PlaybookRunner |
||||
from .base import BaseAutomation |
||||
|
||||
|
||||
class DiscoveryAutomation(BaseAutomation): |
||||
class PushAccountAutomation(BaseAutomation): |
||||
class Meta: |
||||
verbose_name = _("Discovery strategy") |
||||
verbose_name = _("Push automation") |
||||
|
||||
def to_attr_json(self): |
||||
attr_json = super().to_attr_json() |
||||
attr_json.update({ |
||||
'type': StrategyChoice.collect |
||||
'type': 'push_account' |
||||
}) |
||||
return attr_json |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue