-
-
Notifications
You must be signed in to change notification settings - Fork 579
Rename "Dns" playbook to "DNS". Closes #3281 #3288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
05be7ca
e43c8a9
30d00f4
126f803
cd025bc
0472d77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl | ||
| # See the file 'LICENSE' for copying permission. | ||
|
|
||
|
|
||
| from django.db import migrations | ||
|
|
||
|
|
||
| def migrate(apps, schema_editor): | ||
| PlaybookConfig = apps.get_model("playbooks_manager", "PlaybookConfig") | ||
| PlaybookConfig.objects.filter(name="Dns").update(name="DNS") | ||
|
|
||
|
|
||
| def reverse_migrate(apps, schema_editor): | ||
| PlaybookConfig = apps.get_model("playbooks_manager", "PlaybookConfig") | ||
| PlaybookConfig.objects.filter(name="DNS").update(name="Dns") | ||
|
||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("playbooks_manager", "0062_add_cleanbrowsing_to_free_to_use"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RunPython(migrate, reverse_migrate), | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ import { render, screen, fireEvent } from "@testing-library/react"; | |
| import { BrowserRouter } from "react-router-dom"; | ||
| import { InvestigationFlow } from "../../../../src/components/investigations/flow/InvestigationFlow"; | ||
|
|
||
| jest.mock("reactflow/dist/style.css", () => {}); | ||
| jest.mock("reactflow/dist/style.css", () => { }); | ||
|
||
|
|
||
| describe("test InvestigationFlow", () => { | ||
| // mock needed for testing flow https://reactflow.dev/learn/advanced-use/testing#using-jest | ||
|
|
@@ -89,7 +89,7 @@ describe("test InvestigationFlow", () => { | |
| { | ||
| pk: 10, | ||
| analyzed_object_name: "test1.com", | ||
| playbook: "Dns", | ||
| playbook: "DNS", | ||
| status: "reported_without_fails", | ||
| is_sample: false, | ||
| children: [], | ||
|
|
@@ -124,15 +124,15 @@ describe("test InvestigationFlow", () => { | |
| { | ||
| pk: 10, | ||
| analyzed_object_name: "test1.com", | ||
| playbook: "Dns", | ||
| playbook: "DNS", | ||
| status: "reported_without_fails", | ||
| is_sample: false, | ||
| children: [], | ||
| }, | ||
| { | ||
| pk: 20, | ||
| analyzed_object_name: "test2.com", | ||
| playbook: "Dns", | ||
| playbook: "DNS", | ||
| status: "reported_without_fails", | ||
| is_sample: false, | ||
| children: [], | ||
|
|
@@ -172,14 +172,14 @@ describe("test InvestigationFlow", () => { | |
| { | ||
| pk: 10, | ||
| analyzed_object_name: "test1.com", | ||
| playbook: "Dns", | ||
| playbook: "DNS", | ||
| status: "reported_without_fails", | ||
| is_sample: false, | ||
| children: [ | ||
| { | ||
| pk: 11, | ||
| analyzed_object_name: "test11.com", | ||
| playbook: "Dns", | ||
| playbook: "DNS", | ||
| status: "reported_without_fails", | ||
| is_sample: false, | ||
| children: [], | ||
|
|
@@ -257,7 +257,7 @@ describe("test InvestigationFlow", () => { | |
| { | ||
| pk: 10, | ||
| analyzed_object_name: "test1.com", | ||
| playbook: "Dns", | ||
| playbook: "DNS", | ||
| status: "reported_without_fails", | ||
| received_request_time: "2024-04-03T13:08:45.417245Z", | ||
| is_sample: false, | ||
|
|
@@ -267,7 +267,7 @@ describe("test InvestigationFlow", () => { | |
| { | ||
| pk: 11, | ||
| analyzed_object_name: "test11.com", | ||
| playbook: "Dns", | ||
| playbook: "DNS", | ||
| status: "reported_without_fails", | ||
| children: [], | ||
| received_request_time: "2024-04-03T13:09:45.417245Z", | ||
|
|
@@ -340,7 +340,7 @@ describe("test InvestigationFlow", () => { | |
| expect(jobInfo).toBeInTheDocument(); | ||
| expect(jobInfo.textContent).toContain("Job:#10"); | ||
| expect(jobInfo.textContent).toContain("Name:test1.com"); | ||
| expect(jobInfo.textContent).toContain("Playbook:Dns"); | ||
| expect(jobInfo.textContent).toContain("Playbook:DNS"); | ||
| expect(jobInfo.textContent).toContain("Created:"); | ||
|
|
||
| // observable child node | ||
|
|
@@ -381,7 +381,7 @@ describe("test InvestigationFlow", () => { | |
| expect(secondJobInfo).toBeInTheDocument(); | ||
| expect(secondJobInfo.textContent).toContain("Job:#11"); | ||
| expect(secondJobInfo.textContent).toContain("Name:test11.com"); | ||
| expect(secondJobInfo.textContent).toContain("Playbook:Dns"); | ||
| expect(secondJobInfo.textContent).toContain("Playbook:DNS"); | ||
| expect(jobInfo.textContent).toContain("Created:"); | ||
|
|
||
| const fileJobNode = container.querySelector("#job-12"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration does a bulk
update(name="DNS")whileAbstractConfig.nameis globally unique. If a user/org already created a PlaybookConfig named "DNS" (Postgres uniqueness is case-sensitive so it can coexist with "Dns" today), this will raise an IntegrityError and block deployments. Consider making the migration resilient (e.g., detect both records and either merge/delete the duplicate, or skip/rename with a clear strategy) before attempting the rename.