Skip to content
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

Ask user to confirm info before creating Install #609

Open
wants to merge 58 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
fb5d197
fix 500 on bldg
WillNilges Sep 23, 2024
33fb419
Store changed info and print something
WillNilges Sep 23, 2024
4715fce
fancy
WillNilges Sep 23, 2024
e35f2ff
Now I gotta update all these tests :(
WillNilges Sep 24, 2024
f6e3b5f
This feels very brittle
WillNilges Sep 25, 2024
dfaa79c
That's maybe a little better.
WillNilges Sep 25, 2024
bbde722
Test cases
WillNilges Sep 25, 2024
07fa3d0
update tests
WillNilges Sep 25, 2024
8367cb6
Add trust_me_bro
WillNilges Sep 25, 2024
2592a49
Add trust_me_bro to test data
WillNilges Sep 26, 2024
bdc372e
format
WillNilges Sep 26, 2024
af407a4
set trust_me_bro
WillNilges Sep 26, 2024
11515d6
checkpoint
WillNilges Sep 26, 2024
9e873d3
computers
WillNilges Sep 26, 2024
ae222c6
Formatting?
WillNilges Sep 30, 2024
afbfcd0
Parsed City
WillNilges Sep 30, 2024
8ea2a0b
Remove State + Zip warning
WillNilges Sep 30, 2024
33fcb21
Fix import crash (#598)
Andrew-Dickinson Sep 23, 2024
07377b1
Make name dedupe logic case-insensitive & prefer longer names (#556)
Andrew-Dickinson Sep 23, 2024
a3a91b4
Add django-simple-history (#599)
Andrew-Dickinson Sep 23, 2024
c89b2fb
Change ticket number to charfield (#562)
Andrew-Dickinson Sep 24, 2024
0ee526c
rename all instances of prod1 -> prod + docs cleanup (#618)
james-otten Sep 29, 2024
f125f03
rolling restart stateful sets (#620)
james-otten Sep 29, 2024
c4ada29
only backup 'default' (#621)
james-otten Sep 29, 2024
31583aa
Add new encrypted volume (#615)
james-otten Oct 2, 2024
7771b94
use the new one (#623)
james-otten Oct 2, 2024
0014070
Complete volume swap (#616)
james-otten Oct 2, 2024
d158dcc
Fix 500 on panorama building save (for real this time) (#622)
WillNilges Oct 2, 2024
c050532
Fix: NYC addresses are sent to random New England towns (#604)
Andrew-Dickinson Oct 6, 2024
0ed6ff0
Import fixes (#607)
Andrew-Dickinson Oct 6, 2024
a4790c2
Fix: nodes without active installs are hidden on the map (#606)
Andrew-Dickinson Oct 6, 2024
8c32592
Fix: nodes is required to edit building object (#600)
Andrew-Dickinson Oct 6, 2024
fa84ad0
Fix: exports get captured by captive nav and don't download (#601)
Andrew-Dickinson Oct 6, 2024
776525d
Add missing assert_ to called_once_with (#619)
Andrew-Dickinson Oct 6, 2024
47d22f6
Fix: crash due to link sheet format change (#626)
Andrew-Dickinson Oct 6, 2024
603772b
Fix: zip code validation only applies to non-NYC addresses (#629)
Andrew-Dickinson Oct 6, 2024
072c27f
got it
WillNilges Oct 10, 2024
17c292d
Update submission format
WillNilges Oct 11, 2024
554590e
get tests working
WillNilges Oct 12, 2024
f76fba4
computers
WillNilges Oct 12, 2024
98969e3
lint
WillNilges Oct 12, 2024
fd80064
zip
WillNilges Oct 12, 2024
1ec1c46
black
WillNilges Oct 12, 2024
9412847
Check that we say no to NJ properly:
WillNilges Oct 13, 2024
76d3743
move check
WillNilges Oct 13, 2024
2a6bc8f
fix thingie
WillNilges Oct 13, 2024
3db27d4
Add another test
WillNilges Oct 13, 2024
56e5009
Default to str when dumping json object
WillNilges Oct 13, 2024
77177e5
lint
WillNilges Oct 13, 2024
3b5ee9f
Merge branch 'main' into wdn/202
WillNilges Oct 13, 2024
da8ad9d
lint
WillNilges Oct 13, 2024
610553e
email
WillNilges Oct 13, 2024
0a58c5e
lint
WillNilges Oct 13, 2024
1e9c1e3
insanity
WillNilges Oct 13, 2024
6e35cb7
email
WillNilges Oct 13, 2024
f800b3b
Wild fucking guess, but this test should now create 3 members instead…
WillNilges Oct 13, 2024
adcb98a
fix git fuckery
WillNilges Oct 13, 2024
af4203f
Test nyc join form but nj zip
WillNilges Oct 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deploy-to-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ jobs:

# Rolling restart
kubectl --kubeconfig ./config --server https://${{ secrets.SSH_TARGET_IP }}:6443 -n ${{ vars.APP_NAMESPACE }} rollout restart deploy
kubectl --kubeconfig ./config --server https://${{ secrets.SSH_TARGET_IP }}:6443 -n ${{ vars.APP_NAMESPACE }} rollout restart statefulset
4 changes: 2 additions & 2 deletions .github/workflows/publish-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ jobs:
needs: push_to_registry
if: github.ref == 'refs/heads/main'

deploy_to_prod1:
name: Deploy to prod 1
deploy_to_prod:
name: Deploy to prod
uses: ./.github/workflows/deploy-to-k8s.yaml
with:
environment: prod
Expand Down
6 changes: 3 additions & 3 deletions infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ These instructions will set up a 4 node k3s cluster on proxmox.
| `WIREGUARD_PEER_PUBLIC_KEY` | Public key of the wireguard server for deployment |
| `WIREGUARD_PRIVATE_KEY` | Private key for connecting to wireguard for deployment |

3. Create a new environment specific deployment workflow similar to `.github/workflows/deploy_prod1.yaml`
3. Create a new environment in `.github/workflows/publish-and-deploy.yaml`

4. Run the deployment.

5. If you need a superuser, ssh into the mgr node and: `kubectl exec -it -n meshdbdev3 service/meshdb-meshweb bash` and then `python manage.py createsuperuser`
5. If you need a superuser, ssh into the mgr node and: `kubectl exec -it -n meshdb service/meshdb-meshweb python manage.py createsuperuser`

6. If you need to import data: `cat meshdb_export.sql | kubectl exec -it --tty -n meshdbprod1 pod/meshdb-postgres-.... -- psql -U meshdb -d meshdb`
6. If you need to import data: `cat meshdb_export.sql | kubectl exec -it --tty -n meshdb pod/meshdb-postgres-.... -- psql -U meshdb -d meshdb`
2 changes: 1 addition & 1 deletion infra/helm/meshdb/templates/postgres_pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
storageClassName: longhorn-encrypted
resources:
requests:
storage: {{ .Values.pg.pvc_size }}
2 changes: 1 addition & 1 deletion infra/helm/meshdb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pg:
user: meshdb
user_ro: meshdb_ro
port: "5432"
pvc_name: "meshdb-postgres-pvc"
pvc_name: "meshdb-postgres-encyrpted-pvc"
pvc_size: "20Gi"
liveness_probe: "true"
podSecurityContext: {}
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies = [
"six==1.16.0",
"django-flags==5.0.*",
"django-sql-explorer==5.2.*",
"django-simple-history==3.7.*",
]

[project.optional-dependencies]
Expand Down
24 changes: 22 additions & 2 deletions scripts/import_spreadsheet_dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,28 @@

DOCKER_PG_COMMAND="docker exec -i meshdb-postgres-1 psql -U meshdb"
DATA_DIR="./spreadsheet_data/"
tables=("meshapi_link" "meshapi_accesspoint" "meshapi_sector" "meshapi_device" "meshapi_building_nodes" "meshapi_node" "meshapi_install" "meshapi_building" "meshapi_member")
#tables=("meshapi_link" "meshapi_building_nodes" "meshapi_sector" "meshapi_device" "meshapi_install" "meshapi_member" "meshapi_building" "meshapi_node")
tables=(
"meshapi_los"
"meshapi_link"
"meshapi_accesspoint"
"meshapi_sector"
"meshapi_device"
"meshapi_building_nodes"
"meshapi_node"
"meshapi_install"
"meshapi_building"
"meshapi_member"
"meshapi_historicallos"
"meshapi_historicallink"
"meshapi_historicalaccesspoint"
"meshapi_historicalsector"
"meshapi_historicaldevice"
"meshapi_historicalbuilding_nodes"
"meshapi_historicalnode"
"meshapi_historicalinstall"
"meshapi_historicalbuilding"
"meshapi_historicalmember"
)
set -ex

# Make sure our files exist.
Expand Down
5 changes: 3 additions & 2 deletions src/meshapi/admin/models/access_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from django.contrib.postgres.search import SearchVector
from django.forms import Field, ModelForm
from django.http import HttpRequest
from import_export.admin import ExportActionMixin, ImportExportModelAdmin
from import_export.admin import ExportActionMixin, ImportExportMixin
from simple_history.admin import SimpleHistoryAdmin

from meshapi.models import AccessPoint
from meshapi.widgets import AutoPopulateLocationWidget, DeviceIPAddressWidget, ExternalHyperlinkWidget
Expand Down Expand Up @@ -32,7 +33,7 @@ class Meta:


@admin.register(AccessPoint)
class AccessPointAdmin(RankedSearchMixin, ImportExportModelAdmin, ExportActionMixin):
class AccessPointAdmin(RankedSearchMixin, ImportExportMixin, ExportActionMixin, SimpleHistoryAdmin):
form = AccessPointAdminForm
search_fields = ["name__icontains", "@notes"]
search_vector = SearchVector("name", weight="A") + SearchVector("notes", weight="D")
Expand Down
5 changes: 3 additions & 2 deletions src/meshapi/admin/models/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from django.db.models import QuerySet
from django.forms import ModelForm
from django.http import HttpRequest
from import_export.admin import ExportActionMixin, ImportExportModelAdmin
from import_export.admin import ExportActionMixin, ImportExportMixin
from simple_history.admin import SimpleHistoryAdmin

from meshapi.models import Building
from meshapi.widgets import AutoPopulateLocationWidget, PanoramaViewer
Expand Down Expand Up @@ -60,7 +61,7 @@ class Meta:


@admin.register(Building)
class BuildingAdmin(RankedSearchMixin, ImportExportModelAdmin, ExportActionMixin):
class BuildingAdmin(RankedSearchMixin, ImportExportMixin, ExportActionMixin, SimpleHistoryAdmin):
form = BuildingAdminForm
list_display = ["__str__", "street_address", "primary_node"]
search_fields = [
Expand Down
5 changes: 3 additions & 2 deletions src/meshapi/admin/models/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from django.contrib.postgres.search import SearchVector
from django.db.models import QuerySet
from django.http import HttpRequest
from import_export.admin import ExportActionMixin, ImportExportModelAdmin
from import_export.admin import ExportActionMixin, ImportExportMixin
from simple_history.admin import SimpleHistoryAdmin

from meshapi.models import Device
from meshapi.widgets import ExternalHyperlinkWidget
Expand All @@ -30,7 +31,7 @@ class Meta:


@admin.register(Device)
class DeviceAdmin(RankedSearchMixin, ImportExportModelAdmin, ExportActionMixin):
class DeviceAdmin(RankedSearchMixin, ImportExportMixin, ExportActionMixin, SimpleHistoryAdmin):
form = DeviceAdminForm
search_fields = ["name__icontains", "@notes"]
search_vector = SearchVector("name", weight="A") + SearchVector("notes", weight="D")
Expand Down
5 changes: 3 additions & 2 deletions src/meshapi/admin/models/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from django.db.models import QuerySet
from django.http import HttpRequest
from import_export import resources
from import_export.admin import ExportActionMixin, ImportExportModelAdmin
from import_export.admin import ExportActionMixin, ImportExportMixin
from simple_history.admin import SimpleHistoryAdmin

from meshapi.models import Install
from meshapi.widgets import ExternalHyperlinkWidget
Expand Down Expand Up @@ -43,7 +44,7 @@ class Meta:


@admin.register(Install)
class InstallAdmin(RankedSearchMixin, ImportExportModelAdmin, ExportActionMixin):
class InstallAdmin(RankedSearchMixin, ImportExportMixin, ExportActionMixin, SimpleHistoryAdmin):
form = InstallAdminForm
resource_classes = [InstallImportExportResource]
list_filter = [
Expand Down
5 changes: 3 additions & 2 deletions src/meshapi/admin/models/link.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django import forms
from django.contrib import admin
from django.contrib.postgres.search import SearchVector
from import_export.admin import ExportActionMixin, ImportExportModelAdmin
from import_export.admin import ExportActionMixin, ImportExportMixin
from simple_history.admin import SimpleHistoryAdmin

from meshapi.models import Link

Expand All @@ -18,7 +19,7 @@ class Meta:


@admin.register(Link)
class LinkAdmin(RankedSearchMixin, ImportExportModelAdmin, ExportActionMixin):
class LinkAdmin(RankedSearchMixin, ImportExportMixin, ExportActionMixin, SimpleHistoryAdmin):
form = LinkAdminForm
search_fields = [
"from_device__node__name__icontains",
Expand Down
5 changes: 3 additions & 2 deletions src/meshapi/admin/models/los.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from django.contrib.postgres.search import SearchVector
from django.forms import ModelForm
from django.http import HttpRequest
from import_export.admin import ExportActionMixin, ImportExportModelAdmin
from import_export.admin import ExportActionMixin, ImportExportMixin
from simple_history.admin import SimpleHistoryAdmin

from meshapi.models import LOS

Expand All @@ -20,7 +21,7 @@ class Meta:


@admin.register(LOS)
class LOSAdmin(RankedSearchMixin, ImportExportModelAdmin, ExportActionMixin):
class LOSAdmin(RankedSearchMixin, ImportExportMixin, ExportActionMixin, SimpleHistoryAdmin):
form = LOSAdminForm
search_fields = [
"from_building__nodes__network_number__iexact",
Expand Down
5 changes: 3 additions & 2 deletions src/meshapi/admin/models/member.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django import forms
from django.contrib import admin
from django.contrib.postgres.search import SearchVector
from import_export.admin import ExportActionMixin, ImportExportModelAdmin
from import_export.admin import ExportActionMixin, ImportExportMixin
from simple_history.admin import SimpleHistoryAdmin

from meshapi.models import Member

Expand All @@ -22,7 +23,7 @@ class Meta:


@admin.register(Member)
class MemberAdmin(RankedSearchMixin, ImportExportModelAdmin, ExportActionMixin):
class MemberAdmin(RankedSearchMixin, ImportExportMixin, ExportActionMixin, SimpleHistoryAdmin):
form = MemberAdminForm
search_fields = [
# Search by name
Expand Down
3 changes: 2 additions & 1 deletion src/meshapi/admin/models/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.http import HttpRequest
from import_export import resources
from import_export.admin import ExportActionMixin, ImportExportModelAdmin
from simple_history.admin import SimpleHistoryAdmin

from meshapi.models import Building, Node
from meshapi.widgets import AutoPopulateLocationWidget
Expand Down Expand Up @@ -49,7 +50,7 @@ class Meta:


@admin.register(Node)
class NodeAdmin(RankedSearchMixin, ImportExportModelAdmin, ExportActionMixin):
class NodeAdmin(RankedSearchMixin, ExportActionMixin, ImportExportModelAdmin, SimpleHistoryAdmin):
form = NodeAdminForm
resource_classes = [NodeImportExportResource]
search_fields = [
Expand Down
5 changes: 3 additions & 2 deletions src/meshapi/admin/models/sector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.contrib import admin
from django.contrib.postgres.search import SearchVector
from import_export.admin import ExportActionMixin, ImportExportModelAdmin
from import_export.admin import ExportActionMixin, ImportExportMixin
from simple_history.admin import SimpleHistoryAdmin

from meshapi.models import Sector
from meshapi.widgets import ExternalHyperlinkWidget
Expand All @@ -22,7 +23,7 @@ class Meta:


@admin.register(Sector)
class SectorAdmin(RankedSearchMixin, ImportExportModelAdmin, ExportActionMixin):
class SectorAdmin(RankedSearchMixin, ImportExportMixin, ExportActionMixin, SimpleHistoryAdmin):
form = SectorAdminForm
search_fields = ["name__icontains", "@notes"]
search_vector = SearchVector("name", weight="A") + SearchVector("notes", weight="D")
Expand Down
3 changes: 2 additions & 1 deletion src/meshapi/management/commands/create_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def create_base_groups(self) -> None:

for p in all_permissions:
code = p.codename
act, obj = code.split("_")

act, obj = code.split("_", maxsplit=1)

# read_only
if act == "view" and obj in models:
Expand Down
21 changes: 21 additions & 0 deletions src/meshapi/migrations/0031_alter_install_ticket_number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 4.2.13 on 2024-09-19 03:05

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("meshapi", "0030_merge_20240916_1938"),
]

operations = [
migrations.AlterField(
model_name="install",
name="ticket_number",
field=models.CharField(
blank=True,
help_text="The ticket number of the OSTicket used to track communications with the member about this install. Note that although this appears to be an integer, it is not. Leading zeros are important, so this should be stored as a string at all times",
null=True,
),
),
]
Loading
Loading