Просмотр исходного кода

Merge branch 'develop' into feature

Jeremy Stretch 1 год назад
Родитель
Сommit
489e956d83

+ 1 - 1
.github/ISSUE_TEMPLATE/bug_report.yaml

@@ -1,7 +1,7 @@
 ---
 name: 🐛 Bug Report
 description: Report a reproducible bug in the current release of NetBox
-labels: ["type: bug"]
+labels: ["type: bug", "needs triage"]
 body:
   - type: markdown
     attributes:

+ 1 - 1
.github/ISSUE_TEMPLATE/documentation_change.yaml

@@ -1,7 +1,7 @@
 ---
 name: 📖 Documentation Change
 description: Suggest an addition or modification to the NetBox documentation
-labels: ["type: documentation"]
+labels: ["type: documentation", "needs triage"]
 body:
   - type: dropdown
     attributes:

+ 1 - 1
.github/ISSUE_TEMPLATE/feature_request.yaml

@@ -1,7 +1,7 @@
 ---
 name: ✨ Feature Request
 description: Propose a new NetBox feature or enhancement
-labels: ["type: feature"]
+labels: ["type: feature", "needs triage"]
 body:
   - type: markdown
     attributes:

+ 20 - 0
.github/workflows/auto-assign-issue.yml

@@ -0,0 +1,20 @@
+# auto-assign-issue (https://github.com/marketplace/actions/auto-assign-issue)
+name: Issue assignment
+
+on:
+  issues:
+    types: [opened]
+
+permissions:
+  issues: write
+
+jobs:
+  auto-assign:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: pozil/auto-assign-issue@v1
+        if: "contains(github.event.issue.labels.*.name, 'type: bug') || contains(github.event.issue.labels.*.name, 'type: feature')"
+        with:
+          assignees: abhi1693,arthanson,DanSheps,jeffgdotorg,jeremystretch
+          numOfAssignee: 1
+          abortIfPreviousAssignees: true

+ 2 - 3
.github/workflows/stale.yml → .github/workflows/close-stale-issues.yml

@@ -1,5 +1,5 @@
 # close-stale-issues (https://github.com/marketplace/actions/close-stale-issues)
-name: 'Close stale issues/PRs'
+name: Close stale issues/PRs
 
 on:
   schedule:
@@ -12,10 +12,9 @@ permissions:
 
 jobs:
   stale:
-
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/stale@v8
+      - uses: actions/stale@v9
         with:
           close-issue-message: >
             This issue has been automatically closed due to lack of activity. In an

+ 1 - 1
.github/workflows/lock.yml → .github/workflows/lock-threads.yml

@@ -1,5 +1,5 @@
 # lock-threads (https://github.com/marketplace/actions/lock-threads)
-name: 'Lock threads'
+name: Lock threads
 
 on:
   schedule:

+ 1 - 1
README.md

@@ -84,7 +84,7 @@ NetBox automatically logs the creation, modification, and deletion of all manage
 
 <p align="center">
   <a href="https://netboxlabs.com/netbox-cloud/"><img src="docs/media/misc/netbox_cloud.png" alt="NetBox Cloud" /></a><br />
-  Looking for an enterprise solution? Check out <strong><a href="https://netboxlabs.com/netbox-cloud/">NetBox Cloud</a></strong>!
+  Looking for a managed solution? Check out <strong><a href="https://netboxlabs.com/netbox-cloud/">NetBox Cloud</a></strong> or <strong><a href="https://netboxlabs.com/netbox-enterprise/">NetBox Enterprise</a></strong>!
 </p>
 
 ## Get Involved

+ 2 - 0
contrib/generated_schema.json

@@ -1,5 +1,7 @@
 {
     "type": "object",
+    "$id": "urn:devicetype-library:generated-schema",
+    "$schema": "https://json-schema.org/draft/2020-12/schema",
     "additionalProperties": false,
     "definitions": {
         "airflow": {

+ 5 - 3
docs/integrations/rest-api.md

@@ -647,18 +647,20 @@ Note that we are _not_ passing an existing REST API token with this request. If
 {
     "id": 6,
     "url": "https://netbox/api/users/tokens/6/",
-    "display": "3c9cb9 (hankhill)",
+    "display": "**********************************3c9cb9",
     "user": {
         "id": 2,
         "url": "https://netbox/api/users/users/2/",
         "display": "hankhill",
         "username": "hankhill"
     },
-    "created": "2021-06-11T20:09:13.339367Z",
+    "created": "2024-03-11T20:09:13.339367Z",
     "expires": null,
+    "last_used": null,
     "key": "9fc9b897abec9ada2da6aec9dbc34596293c9cb9",
     "write_enabled": true,
-    "description": ""
+    "description": "",
+    "allowed_ips": []
 }
 ```
 

+ 2 - 2
docs/plugins/index.md

@@ -82,10 +82,10 @@ Plugins may package static files to be served directly by the HTTP front end. En
 
 ### Restart WSGI Service
 
-Restart the WSGI service to load the new plugin:
+Restart the WSGI service and RQ workers to load the new plugin:
 
 ```no-highlight
-# sudo systemctl restart netbox
+# sudo systemctl restart netbox netbox-rq
 ```
 
 ## Removing Plugins

+ 156 - 255
docs/reference/markdown.md

@@ -1,353 +1,254 @@
----
-hide:
-  - toc
----
-
 # Markdown
 
-NetBox supports markdown rendering for certain text fields.
-
-## Syntax
-
-##### Table of Contents  
-[Headers](#headers)  
-[Emphasis](#emphasis)  
-[Lists](#lists)  
-[Links](#links)  
-[Images](#images)  
-[Code Blocks](#code)  
-[Tables](#tables)  
-[Blockquotes](#blockquotes)  
-[Inline HTML](#html)  
-[Horizontal Rule](#hr)  
-[Line Breaks](#lines)  
-
-<a name="headers"></a>
+NetBox supports Markdown rendering for certain text fields. Some common examples are provided below. For a complete Markdown reference, please see [Markdownguide.org](https://www.markdownguide.org/basic-syntax/).
 
-## Headers
+## Headings
 
 ```no-highlight
-# H1
-## H2
-### H3
-#### H4
-##### H5
-###### H6
-
-Alternatively, for H1 and H2, an underline-ish style:
-
-Alt-H1
-======
-
-Alt-H2
-------
+# Heading 1
+## Heading 2
+### Heading 3
+#### Heading 4
+##### Heading 5
+###### Heading 6
 ```
 
-# H1
-## H2
-### H3
-#### H4
-##### H5
-###### H6
-
-<a name="emphasis"></a>
+<h1>Heading 1</h1>
+<h2>Heading 2</h2>
+<h3>Heading 3</h3>
+<h4>Heading 4</h4>
+<h5>Heading 5</h5>
+<h6>Heading 6</h6>
 
-## Emphasis
+Alternatively, for H1 and H2, an underline-ish style:
 
 ```no-highlight
-Emphasis, aka italics, with *asterisks* or _underscores_.
-
-Strong emphasis, aka bold, with **asterisks** or __underscores__.
-
-Combined emphasis with **asterisks and _underscores_**.
+Heading 1
+=========
 
-Strikethrough uses two tildes. ~~Scratch this.~~
+Heading 2
+---------
 ```
 
-Emphasis, aka italics, with *asterisks* or _underscores_.
-
-Strong emphasis, aka bold, with **asterisks** or __underscores__.
-
-Combined emphasis with **asterisks and _underscores_**.
+<h1>Heading 1</h1>
+<h2>Heading 2</h2>
 
-Strikethrough uses two tildes. ~~Scratch this.~~
+## Text
 
+```no-highlight
+Italicize text with *asterisks* or _underscores_.
+```
 
-<a name="lists"></a>
+Italicize text with *asterisks* or _underscores_.
 
-## Lists
+```no-highlight
+Bold text with two **asterisks** or __underscores__.
+```
 
-(In this example, leading and trailing spaces are shown with with dots: ⋅)
+Bold text with two **asterisks** or __underscores__.
 
 ```no-highlight
-1. First ordered list item
-2. Another item
-⋅⋅* Unordered sub-list. 
-1. Actual numbers don't matter, just that it's a number
-⋅⋅1. Ordered sub-list
-4. And another item.
-
-⋅⋅⋅You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
-
-⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅
-⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅
-⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
-
-* Unordered list can use asterisks
-- Or minuses
-+ Or pluses
+Strike text with two tildes. ~~Deleted text.~~
 ```
 
-1. First ordered list item
-2. Another item
-  * Unordered sub-list. 
-1. Actual numbers don't matter, just that it's a number
-  1. Ordered sub-list
-4. And another item.
+Strike text with two tildes. ~~Deleted text.~~
 
-   You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
-
-   To have a line break without a paragraph, you will need to use two trailing spaces.  
-   Note that this line is separate, but within the same paragraph.  
-   (This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
+## Line Breaks
 
-* Unordered list can use asterisks
-- Or minuses
-+ Or pluses
+By default, Markdown will remove line breaks between successive lines of text. For example:
 
-<a name="links"></a>
+```no-highlight
+This is one line.
+And this is another line.
+One more line here.
+```
 
-## Links
+This is one line.
+And this is another line.
+One more line here.
 
-There are two ways to create links.
+To preserve line breaks, append two spaces to each line (represented below with the `⋅` character).
 
 ```no-highlight
-[I'm an inline-style link](https://www.google.com)
+This is one line.⋅⋅
+And this is another line.⋅⋅
+One more line here.
+```
 
-[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
+This is one line.  
+And this is another line.  
+One more line here.
 
-[I'm a reference-style link][Arbitrary case-insensitive reference text]
+## Lists
 
-[You can use numbers for reference-style link definitions][1]
+Use asterisks or hyphens for unordered lists. Indent items by four spaces to start a child list.
 
-Or leave it empty and use the [link text itself].
+```no-highlight
+* Alpha
+* Bravo
+* Charlie
+  * Child item 1
+  * Child item 2
+* Delta
+```
 
-URLs and URLs in angle brackets will automatically get turned into links. 
-http://www.example.com or <http://www.example.com> and sometimes 
-example.com (but not on Github, for example).
+* Alpha
+* Bravo
+* Charlie
+    * Child item 1
+    * Child item 2
+* Delta
 
-Some text to show that the reference links can follow later.
+Use digits followed by periods for ordered (numbered) lists.
 
-[arbitrary case-insensitive reference text]: https://www.mozilla.org
-[1]: http://slashdot.org
-[link text itself]: http://www.reddit.com
+```no-highlight
+1. Red
+2. Green
+3. Blue
+    1. Light blue
+    2. Dark blue
+4. Orange
 ```
 
-[I'm an inline-style link](https://www.google.com)
-
-[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
+1. Red
+2. Green
+3. Blue
+    1. Light blue
+    2. Dark blue
+4. Orange
 
-[I'm a reference-style link][Arbitrary case-insensitive reference text]
-
-[You can use numbers for reference-style link definitions][1]
+## Links
 
-Or leave it empty and use the [link text itself].
+Text can be rendered as a hyperlink by encasing it in square brackets, followed by a URL in parentheses. A title (text displayed on hover) may optionally be included as well.
 
-URLs and URLs in angle brackets will automatically get turned into links. 
-http://www.example.com or <http://www.example.com> and sometimes 
-example.com (but not on Github, for example).
+```no-highlight
+Here's an [example](https://www.example.com) of a link.
 
-Some text to show that the reference links can follow later.
+And here's [another link](https://www.example.com "Click me!"), this time with a title.
+```
 
-[arbitrary case-insensitive reference text]: https://www.mozilla.org
-[1]: http://slashdot.org
-[link text itself]: http://www.reddit.com
+Here's an [example](https://www.example.com) of a link.
 
-<a name="images"></a>
+And here's [another link](https://www.example.com "Click me!"), with a title.
 
 ## Images
 
-```
-Here's the NetBox logo (hover to see the title text):
-
-Inline-style: 
-![alt text](/media/misc/netbox_logo.png "Logo Title Text 1")
-
-Reference-style: 
-![alt text][logo]
+The syntax for embedding an image is very similar to that used for a hyperlink. Alternate text should always be provided; this will be displayed if the image fails to load. As with hyperlinks, title text is optional.
 
-[logo]: /media/misc/netbox_logo.png "Logo Title Text 2"
+```no-highlight
+![Alternate text](/path/to/image.png "Image title text")
 ```
 
-Here's the NetBox logo (hover to see the title text):
-
-Inline-style: 
-![alt text](../media/misc/netbox_logo.png "Logo Title Text 1")
-
-Reference-style: 
-![alt text][logo]
+## Code Blocks
 
-[logo]: ../media/misc/netbox_logo.png "Logo Title Text 2"
+Single backticks can be used to annotate code inline. Text enclosed by lines of three backticks will be displayed as a code block.
 
-<a name="code"></a>
-
-## Code blocks
-
-```
-Inline `code` has `back-ticks around` it.
+```no-highlight
+Paragraphs are rendered in HTML using `<p>` and `</p>` tags.
 ```
 
-Inline `code` has `back-ticks around` it.
-
-Blocks of code are fenced by lines with three back-ticks <code>```</code>
+Paragraphs are rendered in HTML using `<p>` and `</p>` tags.
 
 ````
 ```
-var s = "Code block";
-alert(s);
+def my_func(foo, bar):
+    # Do something
+    return foo * bar
 ```
 ````
 
+```no-highlight
+def my_func(foo, bar):
+    # Do something
+    return foo * bar
 ```
-var s = "Code block";
-alert(s);
-```
-
-<a name="tables"></a>
 
 ## Tables
 
+Simple tables can be constructed using the pipe character (`|`) to denote columns, and hyphens (`-`) to denote the heading. Inline Markdown can be used to style text within columns.
+
 ```no-highlight
-Colons can be used to align columns.
-
-| Tables        | Are           | Cool  |
-| ------------- |:-------------:| -----:|
-| col 3 is      | right-aligned | $1600 |
-| col 2 is      | centered      |   $12 |
-| zebra stripes | are neat      |    $1 |
-
-There must be at least 3 dashes separating each header cell.
-The outer pipes (|) are optional, and you don't need to make the 
-raw Markdown line up prettily. You can also use inline Markdown.
-
-Markdown | Less | Pretty
---- | --- | ---
-*Still* | `renders` | **nicely**
-1 | 2 | 3
+| Heading 1 | Heading 2 | Heading 3 |
+|-----------|-----------|-----------|
+| Row 1     | Alpha     | Red       |
+| Row 2     | **Bravo** | Green     |
+| Row 3     | Charlie   | ~~Blue~~  |
 ```
 
-Colons can be used to align columns.
-
-| Tables        | Are           | Cool |
-| ------------- |:-------------:| -----:|
-| col 3 is      | right-aligned | $1600 |
-| col 2 is      | centered      |   $12 |
-| zebra stripes | are neat      |    $1 |
-
-There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
+| Heading 1 | Heading 2 | Heading 3 |
+|-----------|-----------|-----------|
+| _Row 1_   | Alpha     | Red       |
+| Row 2     | **Bravo** | Green     |
+| Row 3     | Charlie   | ~~Blue~~  |
 
-Markdown | Less | Pretty
---- | --- | ---
-*Still* | `renders` | **nicely**
-1 | 2 | 3
-
-<a name="blockquotes"></a>
-
-## Blockquotes
+Colons can be used to align text to the left or right side of a column.
 
 ```no-highlight
-> Blockquotes are very handy in email to emulate reply text.
-> This line is part of the same quote.
-
-Quote break.
-
-> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote. 
+| Left-aligned | Centered | Right-aligned |
+|:-------------|:--------:|--------------:|
+| Text         | Text     | Text          |
+| Text         | Text     | Text          |
+| Text         | Text     | Text          |
 ```
 
-> Blockquotes are very handy in email to emulate reply text.
-> This line is part of the same quote.
+| Left-aligned | Centered | Right-aligned |
+|:-------------|:--------:|--------------:|
+| Text         | Text     | Text          |
+| Text         | Text     | Text          |
+| Text         | Text     | Text          |
 
-Quote break.
+## Blockquotes
 
-> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote. 
+Text can be wrapped in a blockquote by prepending a right angle bracket (`>`) before each line.
 
-<a name="html"></a>
+```no-highlight
+> I think that I shall never see
+> a graph more lovely than a tree.
+> A tree whose crucial property
+> is loop-free connectivity.
+```
 
-## Inline HTML
+> I think that I shall never see
+> a graph more lovely than a tree.
+> A tree whose crucial property
+> is loop-free connectivity.
 
-You can also use raw HTML in your Markdown, and it'll mostly work pretty well. 
+Markdown removes line breaks by default. To preserve line breaks, append two spaces to each line (represented below with the `⋅` character).
 
 ```no-highlight
-<dl>
-  <dt>Definition list</dt>
-  <dd>Is something people use sometimes.</dd>
-
-  <dt>Markdown in HTML</dt>
-  <dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
-</dl>
+> I think that I shall never see⋅⋅
+> a graph more lovely than a tree.⋅⋅
+> A tree whose crucial property⋅⋅
+> is loop-free connectivity.
 ```
 
-<dl>
-  <dt>Definition list</dt>
-  <dd>Is something people use sometimes.</dd>
-
-  <dt>Markdown in HTML</dt>
-  <dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
-</dl>
-
-<a name="hr"></a>
+> I think that I shall never see  
+> a graph more lovely than a tree.  
+> A tree whose crucial property  
+> is loop-free connectivity.
 
 ## Horizontal Rule
 
-```
-Three or more...
+A horizontal rule is a single line rendered across the width of the page using a series of three or more hyphens or asterisks. It can be useful for separating sections of content.
+
+```no-highlight
+Content
 
 ---
 
-Hyphens
+More content
 
 ***
 
-Asterisks
-
-___
-
-Underscores
+Final content
 ```
 
-Three or more...
+Content
 
 ---
 
-Hyphens
+More content
 
 ***
 
-Asterisks
-
-___
-
-Underscores
-
-<a name="lines"></a>
-
-## Line Breaks
-
-
-```
-Here's a line for us to start with.
-
-This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
-
-This line is also a separate paragraph, but...
-This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
-```
-
-Here's a line for us to start with.
-
-This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
-
-This line is also begins a separate paragraph, but...  
-This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
-
-Based on [Markdown-Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) by [adam-p](https://github.com/adam-p) licensed under [CC-BY](https://creativecommons.org/licenses/by/3.0/)
+Final content

+ 5 - 0
docs/release-notes/version-3.7.md

@@ -2,6 +2,11 @@
 
 ## v3.7.5 (FUTURE)
 
+### Bug Fixes
+
+* [#14799](https://github.com/netbox-community/netbox/issues/14799) - Avoid caching modified reports & scripts
+* [#15502](https://github.com/netbox-community/netbox/issues/15502) - Fix KeyError exception when modifying an IP address assigned to a virtual machine
+
 ---
 
 ## v3.7.4 (2024-03-13)

+ 1 - 1
netbox/extras/models/tags.py

@@ -37,7 +37,7 @@ class Tag(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel, TagBase):
         to='core.ObjectType',
         related_name='+',
         blank=True,
-        help_text=_("The object type(s) to which this this tag can be applied.")
+        help_text=_("The object type(s) to which this tag can be applied.")
     )
 
     clone_fields = (

+ 1 - 1
netbox/ipam/forms/bulk_import.py

@@ -378,7 +378,7 @@ class IPAddressImportForm(NetBoxModelImportForm):
 
         # Set as primary for device/VM
         if self.cleaned_data.get('is_primary'):
-            parent = self.cleaned_data['device'] or self.cleaned_data['virtual_machine']
+            parent = self.cleaned_data.get('device') or self.cleaned_data.get('virtual_machine')
             if self.instance.address.version == 4:
                 parent.primary_ip4 = ipaddress
             elif self.instance.address.version == 6:

+ 2 - 0
netbox/templates/extras/schema/devicetype_schema.jinja2

@@ -1,5 +1,7 @@
 {
   "type": "object",
+  "$id": "urn:devicetype-library:generated-schema",
+  "$schema": "https://json-schema.org/draft/2020-12/schema",
   "additionalProperties": false,
   "definitions": {
     "airflow": {