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

Support custom scripts for automatically manipulating objects #3415

Closed
jeremystretch opened this issue Aug 9, 2019 · 4 comments · Fixed by #3423
Closed

Support custom scripts for automatically manipulating objects #3415

jeremystretch opened this issue Aug 9, 2019 · 4 comments · Fixed by #3423
Assignees
Labels
status: accepted This issue has been accepted for implementation

Comments

@jeremystretch
Copy link
Member

Environment

  • Python version: 3.5.2
  • NetBox version: 2.6.2

Proposed Functionality

Extend NetBox to allow users to run custom scripts natively within the UI, in a similar fashion to how reports are used today. This is essentially a mechanism for integrating standalone scripts into the NetBox UI and API.

For example, a developer might write a script to automatically populate the appropriate devices and prefixes for a new site being deployed. The script would prompt a user for several variables as a web form, and when submitted the script will run, using the provided data to automatically build objects in NetBox.

This idea was split from #1364 (deployment templates) and covers much of its scope. However, we opted to keep #1364 open as an FR for a more user-friendly feature in the future (one which does not require custom scripting).

Use Case

Custom scripts can be used for many things, such as:

  • Populating the necessary objects for a new site from a standard design
  • Migrating a set of objects through a series of complex bulk operations
  • Cleaning up or removing data which does not conform to validation rules

Database Changes

This remains to be determined, though it likely will not require any database changes.

External Dependencies

None

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: major feature labels Aug 9, 2019
@jeremystretch jeremystretch added this to the v2.7 milestone Aug 9, 2019
@jeremystretch jeremystretch self-assigned this Aug 9, 2019
@sdktr
Copy link
Contributor

sdktr commented Aug 12, 2019

Very cool idea! Is this functionality intended method of invocation GUI only? Or do you plan to add API endpoints for it as well?
Might be a slippery-slope regarding what the consumer should be able to handle itself or let Netbox handle for him. On the other hand keeping logic in one place (like a netbox-script) independent of the consumer sounds tempting as well..

@jeremystretch jeremystretch removed this from the v2.7 milestone Aug 12, 2019
@darcynz
Copy link

darcynz commented Aug 14, 2019

This looks fantastic and will greatly enable Netbox.

Wishful thinking, but it would add to its versatility if the scripts could be triggered by or linked to
the webhook functionality.

Imagine that might open / create other problems.

@jeremystretch
Copy link
Member Author

Or do you plan to add API endpoints for it as well?

I'd like to try a new approach for this feature. Whereas normally something like this would be introduced in a beta for testing, and then finalized in an official 2.x release, I'm going to introduce the tentative implementation in a 2.6.x patch release so people can preview the feature before it becomes "official." (We can do this only because the feature does not introduce any breaking changes.) My thought is that this will allow us to gather feedback and real-world use cases prior to establishing an API for it. The API endpoint will be introduced as part of the 2.7 release.

@sdktr
Copy link
Contributor

sdktr commented Aug 16, 2019

Or do you plan to add API endpoints for it as well?

I'd like to try a new approach for this feature. Whereas normally something like this would be introduced in a beta for testing, and then finalized in an official 2.x release, I'm going to introduce the tentative implementation in a 2.6.x patch release so people can preview the feature before it becomes "official." (We can do this only because the feature does not introduce any breaking changes.) My thought is that this will allow us to gather feedback and real-world use cases prior to establishing an API for it. The API endpoint will be introduced as part of the 2.7 release.

That sounds like a smooth plan to fuel feedback and adoption

@lock lock bot locked as resolved and limited conversation to collaborators Jan 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants