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

Running script in a branch creates objects in main #160

Open
llamafilm opened this issue Oct 26, 2024 · 0 comments
Open

Running script in a branch creates objects in main #160

llamafilm opened this issue Oct 26, 2024 · 0 comments
Labels
app: branching type: bug A confirmed report of unexpected behavior in the application

Comments

@llamafilm
Copy link

Plugin Version

0.5.1

NetBox Version

4.1.4

Python Version

3.12.7

Steps to Reproduce

  1. Create this custom script
  2. Create a new branch and activate it
  3. Run this script
from dcim.models import Site
from extras.scripts import Script

class BranchDebug(Script):
    class Meta:
        name = "branch debugging"

    def run(self, data, commit):
        dummies = Site.objects.filter(name__startswith='dummy').count()
        newsite = f'dummy{dummies+1}'
        site = Site(name=newsite, slug=newsite)
        site.full_clean()
        site.save()
        self.log_success("Created new site!", obj=site)

Expected Behavior

A new site should be created in the branch

Observed Behavior

A new site is created in the main branch. So the new branch shows it as "changes behind".

image

@llamafilm llamafilm added the type: bug A confirmed report of unexpected behavior in the application label Oct 26, 2024
@cvitan cvitan added the netbox-branching label Oct 31, 2024 — with Linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app: branching type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

3 participants