lint fixes

This commit is contained in:
ryanmerolle 2023-01-21 22:36:40 -05:00
parent 0c53a2bb06
commit fd449a12d9
55 changed files with 132 additions and 85 deletions

View File

@ -25,11 +25,12 @@
// "source.organizeImports": true
// }
//},
"python.sortImports.args": [
"isort.args": [
"--profile=black"
],
"python.sortImports.path": "/opt/netbox/venv/bin/isort",
"isort.path": "/opt/netbox/venv/bin/isort",
"python.analysis.typeCheckingMode": "strict",
python.Jedi
"python.analysis.extraPaths": [
"/opt/netbox/netbox"
],

View File

@ -1,3 +1,4 @@
---
version: '3.4'
services:
netbox:

View File

@ -1,3 +1,4 @@
---
version: '3.4'
services:
netbox: &netbox
@ -35,15 +36,15 @@ services:
image: postgres:14-alpine
env_file: env/postgres.env
volumes:
- netbox-postgres-data:/var/lib/postgresql/data
- netbox-postgres-data:/var/lib/postgresql/data
# redis
redis:
image: redis:6-alpine
command:
- sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env
- redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
- sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env
- redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
env_file: env/redis.env
#volumes:
# - netbox-redis-data:/data

View File

@ -1,3 +1,4 @@
---
- prefix: 10.0.0.0/16
rir: RFC1918
tenant: tenant1

View File

@ -1,3 +1,4 @@
---
- asn: 1
rir: RFC1918
tenant: tenant1

View File

@ -1,3 +1,4 @@
---
# Required parameters for termination X ('a' or 'b'):
#
# ```

View File

@ -1,3 +1,4 @@
---
- name: VPLS
slug: vpls
- name: MPLS

View File

@ -1,3 +1,4 @@
---
- cid: Circuit_ID-1
provider: Provider1
type: Internet

View File

@ -1,3 +1,4 @@
---
- name: Group 1
slug: group-1
- name: Group 2

View File

@ -1,2 +1,3 @@
---
- name: Hyper-V
slug: hyper-v

View File

@ -1,3 +1,4 @@
---
- name: cluster1
type: Hyper-V
group: Group 1

View File

@ -1,3 +1,4 @@
---
- name: Network-Team
slug: network-team
description: This is a new contact group for the Network-Team

View File

@ -1,3 +1,4 @@
---
- name: New Contact Role
slug: new-contact-role
description: This is a new contact role description

View File

@ -1,3 +1,4 @@
---
- name: Lee Widget
title: CEO of Widget Corp
phone: 221-555-1212

View File

@ -1,3 +1,4 @@
---
## Possible Choices:
## type:
## - text
@ -23,14 +24,14 @@ text_field:
required: false
weight: 0
on_objects:
- dcim.models.Device
- dcim.models.Rack
- dcim.models.Site
- dcim.models.DeviceType
- ipam.models.IPAddress
- ipam.models.Prefix
- tenancy.models.Tenant
- virtualization.models.VirtualMachine
- dcim.models.Device
- dcim.models.Rack
- dcim.models.Site
- dcim.models.DeviceType
- ipam.models.IPAddress
- ipam.models.Prefix
- tenancy.models.Tenant
- virtualization.models.VirtualMachine
integer_field:
type: integer
label: Custom Number
@ -41,7 +42,7 @@ integer_field:
validation_maximum: 255
weight: 10
on_objects:
- tenancy.models.Tenant
- tenancy.models.Tenant
select_field:
type: select
label: Choose between items
@ -50,13 +51,13 @@ select_field:
weight: 30
default: First Item
on_objects:
- dcim.models.Device
- dcim.models.Device
choices:
- First Item
- Second Item
- Third Item
- Fifth Item
- Fourth Item
- First Item
- Second Item
- Third Item
- Fifth Item
- Fourth Item
select_field_legacy_format:
type: select
label: Choose between items
@ -64,14 +65,14 @@ select_field_legacy_format:
filter_logic: loose
weight: 30
on_objects:
- dcim.models.Device
- dcim.models.Device
choices:
- value: A # this is the deprecated format.
- value: B # we only use it for the tests.
- value: C # please see above for the new format.
- value: "D like deprecated"
weight: 999
- value: E
- value: A # this is the deprecated format.
- value: B # we only use it for the tests.
- value: C # please see above for the new format.
- value: "D like deprecated"
weight: 999
- value: E
boolean_field:
type: boolean
label: Yes Or No?
@ -80,7 +81,7 @@ boolean_field:
default: "false" # important: put "false" in quotes!
weight: 90
on_objects:
- dcim.models.Device
- dcim.models.Device
url_field:
type: url
label: Hyperlink
@ -89,14 +90,14 @@ url_field:
filter_logic: disabled
validation_regex: ^https://
on_objects:
- tenancy.models.Tenant
- tenancy.models.Tenant
date_field:
type: date
label: Important Date
required: false
filter_logic: disabled
on_objects:
- dcim.models.Device
- dcim.models.Device
multiobject_field:
type: multiobject
label: Related Objects
@ -104,7 +105,7 @@ multiobject_field:
required: true
filter_logic: loose
on_objects:
- dcim.models.Location
- dcim.models.Location
object_type: ipam.models.IPAddress
object_field:
type: object
@ -113,5 +114,5 @@ object_field:
required: false
filter_logic: loose
on_objects:
- dcim.models.Device
- dcim.models.Device
object_type: ipam.models.ASN

View File

@ -1,3 +1,4 @@
---
## Possible Choices:
## new_window:
## - True

View File

@ -1,3 +1,4 @@
---
- name: switch
slug: switch
color: Grey

View File

@ -1,3 +1,4 @@
---
- model: Model 1
manufacturer: Manufacturer 1
slug: model-1

View File

@ -1,3 +1,4 @@
---
## Possible Choices:
## face:
## - front

View File

@ -1,3 +1,4 @@
---
applications:
users:
- technical_user

View File

@ -1,3 +1,4 @@
---
## Possible Choices:
## type:
## - virtual

View File

@ -1,3 +1,4 @@
---
## Possible Choices:
## status:
## - active

View File

@ -1,3 +1,4 @@
---
- name: cage 101
slug: cage-101
site: SING 1

View File

@ -1,3 +1,4 @@
---
- name: Manufacturer 1
slug: manufacturer-1
- name: Manufacturer 2

View File

@ -1,3 +1,4 @@
---
all.ro:
actions:
- view

View File

@ -1,3 +1,4 @@
---
- name: Platform 1
slug: platform-1
manufacturer: Manufacturer 1

View File

@ -1,3 +1,4 @@
---
- name: power feed 1
power_panel: power panel AMS 1
voltage: 208

View File

@ -1,3 +1,4 @@
---
- name: power panel AMS 1
site: AMS 1
- name: power panel SING 1

View File

@ -1,2 +1,3 @@
---
- name: Main Management
slug: main-management

View File

@ -1,3 +1,4 @@
---
## Possible Choices:
## status:
## - container

View File

@ -1,3 +1,4 @@
---
- name: Provider1
slug: provider1
asn: 121

View File

@ -1,3 +1,4 @@
---
- name: Role 1
slug: role-1
color: Pink

View File

@ -1,3 +1,4 @@
---
## Possible Choices:
## width:
## - 19

View File

@ -1,3 +1,4 @@
---
- name: Singapore
slug: singapore
- name: Amsterdam

View File

@ -1,3 +1,4 @@
---
- is_private: true
name: RFC1918
slug: rfc1918

View File

@ -1,3 +1,4 @@
---
- name: 65000:1001
tenant: tenant1
- name: 65000:1002

View File

@ -1,3 +1,4 @@
---
- name: DNS
protocol: TCP
ports:

View File

@ -1,3 +1,4 @@
---
- name: AMS 1
slug: ams1
region: Downtown

View File

@ -1,3 +1,4 @@
---
- name: Tag 1
slug: tag-1
color: Pink

View File

@ -1,3 +1,4 @@
---
- name: Tenant Group 1
slug: tenant-group-1
- name: Tenant Group 2

View File

@ -1,3 +1,4 @@
---
- name: tenant1
slug: tenant1
- name: tenant2

View File

@ -1,3 +1,4 @@
---
technical_user:
api_token: "" # a token is generated automatically unless the value is explicity set to empty
reader:

View File

@ -1,3 +1,4 @@
---
## Possible Choices:
## status:
## - active

View File

@ -1,3 +1,4 @@
---
- description: Network Interface 1
enabled: true
mac_address: 00:77:77:77:77:77

View File

@ -1,3 +1,4 @@
---
- name: VLAN group 1
scope_type: dcim.region
scope: Amsterdam

View File

@ -1,3 +1,4 @@
---
## Possible Choices:
## status:
## - active

View File

@ -1,3 +1,4 @@
---
- enforce_unique: true
name: vrf1
tenant: tenant1

View File

@ -1,3 +1,4 @@
---
## Possible Choices:
## object_types:
## - device

View File

@ -1,3 +1,3 @@
{
"threshold": 10
}
}

View File

@ -14,10 +14,10 @@ name: "CodeQL"
on:
push:
branches: [ "dev" ]
branches: ["dev"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "dev" ]
branches: ["dev"]
schedule:
- cron: '24 4 * * 5'
@ -33,41 +33,41 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
language: ['python']
# CodeQL supports ['cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby']
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@ -10,8 +10,8 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Thanks for opening this Issue! We really appreciate the feedback & testing from users like you!"
pr-message: "🎉 Thanks for opening this pull request! We really appreciate contributors like you! 🙌"
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Thanks for opening this Issue! We really appreciate the feedback & testing from users like you!"
pr-message: "🎉 Thanks for opening this pull request! We really appreciate contributors like you! 🙌"

View File

@ -9,9 +9,9 @@ name: Lint Code Base
on:
push:
branches: [ "dev" ]
branches: ["dev"]
pull_request:
branches: [ "dev" ]
branches: ["dev"]
jobs:
run-lint:
runs-on: ubuntu-latest

View File

@ -37,15 +37,11 @@ repos:
hooks:
- id: pyupgrade
args:
- "--py37-plus"
#- repo: https://github.com/adrienverge/yamllint
# rev: v1.26.3
# hooks:
# - id: yamllint
- repo: https://github.com/psf/black
rev: 22.12.0
- "--py39-plus"
- repo: https://github.com/adrienverge/yamllint
rev: v1.29.0
hooks:
- id: black
- id: yamllint
#- repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs
# rev: v1.1.2
# hooks:

View File

@ -27,8 +27,8 @@ This project just looks to build on top of this framework and model presented.
This project is currently maintained jointly by:
* [Abhimanyu Saharan](https://github.com/abhi1693)
* [Ryan Merolle](https://github.com/ryanmerolle)
- [Abhimanyu Saharan](https://github.com/abhi1693)
- [Ryan Merolle](https://github.com/ryanmerolle)
See the [CONTRIBUTING](CONTRIBUTING.md) for more information.

View File

@ -64,10 +64,11 @@ class Migration(migrations.Migration):
models.Q(("app_label", "dcim"), ("model", "device")),
models.Q(("app_label", "dcim"), ("model", "virtualchassis")),
models.Q(
("app_label", "virtualization"), ("model", "virtualmachine")
("app_label", "virtualization"),
("model", "virtualmachine"),
),
_connector="OR",
)
),
),
on_delete=django.db.models.deletion.PROTECT,
to="contenttypes.contenttype",
@ -82,7 +83,7 @@ class Migration(migrations.Migration):
django.core.validators.RegexValidator(
"^[0-9a-zA-Z,-,_]*$",
"Only alphanumeric, hyphens, and underscores characters are allowed.",
)
),
],
),
),
@ -111,7 +112,8 @@ class Migration(migrations.Migration):
model_name="aclinterfaceassignment",
name="access_list",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="netbox_acls.accesslist"
on_delete=django.db.models.deletion.CASCADE,
to="netbox_acls.accesslist",
),
),
migrations.AlterField(
@ -127,10 +129,11 @@ class Migration(migrations.Migration):
models.Q(
models.Q(("app_label", "dcim"), ("model", "interface")),
models.Q(
("app_label", "virtualization"), ("model", "vminterface")
("app_label", "virtualization"),
("model", "vminterface"),
),
_connector="OR",
)
),
),
on_delete=django.db.models.deletion.PROTECT,
to="contenttypes.contenttype",