Skip to content

Branch cannot merge if using S3 storage and file not found #494

@arthanson

Description

@arthanson

Plugin Version

v0.8.3

NetBox Version

v4.4.5

Python Version

3.13

Steps to Reproduce

  1. setup to use S3 storage
  2. create and activate a branch 'b1'
  3. go to a site and add an image attachment and choose "Create and Add Another"
  4. add the same image again.
  5. go to merge the branch

Note this will create a duplicated image name in the ObjectChange due to NetBox issue: #21801.

The issue is at: https://github.com/netboxlabs/netbox-branching/blob/main/netbox_branching/models/changes.py#L58

        if self.action == ObjectChangeActionChoices.ACTION_CREATE:
            if hasattr(model, 'deserialize_object'):
                ...
            except (FileNotFoundError) as e:
                # If a file was deleted later in this branch it will fail here
                # so we need to ignore it. We can assume the NetBox state is valid.
                logger.warning(f'Ignoring missing file: {e}')
            instance.save(using=using)

However S3 storage gives a different error than FileNotFound. - specifically

        "Applying change 298402 using default (Extras | image attachment Install created by user(@site)",
        "An error occurred (403) when calling the HeadObject operation: Forbidden"

The except should catch both errors from local file storage and the S3 Storages specific one.

Expected Behavior

The branch should merge successfully.

Observed Behavior

The branch cannot be merged.

Metadata

Metadata

Assignees

Labels

app: branchingseverity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions