Skip to content

attribute "last_updated" not updated when primary IP gets removed from device/virtual machine #5419

@bb-Ricardo

Description

@bb-Ricardo

Environment

  • Python version: 3.6.8
  • NetBox version: 3.9.10

Steps to Reproduce (assuming we have a VM with a assigned primary ip)

  1. query API data of said virtual machine
  2. delete assigned primary IP
  3. query API data of said virtual machine again

Expected Behavior

The last_updated attribute is set to a current time/date value

Observed Behavior

The last_updated attribute is still the same as from before the deletion of the primary IP

Note

Adding an Primary IP updates the last_updated attribute correctly

Example

curl -X GET https://example.com/api/virtualization/virtual-machines/128/?exclude=config_context
{
    "id": 128,
    "url": "https://example.com/api/virtualization/virtual-machines/128/",
    "name": "git",
    "status": {
        "value": "active",
        "label": "Active"
    },
    "site": {
        "id": 1,
        "url": "https://example.com/api/dcim/sites/1/",
        "name": "New York",
        "slug": "new-york"
    },
    "cluster": {
        "id": 4,
        "url": "https://example.com/api/virtualization/clusters/4/",
        "name": "East"
    },
    "role": {
        "id": 8,
        "url": "https://example.com/api/dcim/device-roles/8/",
        "name": "Server",
        "slug": "server"
    },
    "tenant": null,
    "platform": {
        "id": 13,
        "url": "https://example.com/api/dcim/platforms/13/",
        "name": "CentOS 8 (64-bit)",
        "slug": "centos-8-64-bit"
    },
    "primary_ip": {
        "id": 871,
        "url": "https://example.com/api/ipam/ip-addresses/871/",
        "family": 4,
        "address": "10.1.2.3/24"
    },
    "primary_ip4": {
        "id": 871,
        "url": "https://example.com/api/ipam/ip-addresses/871/",
        "family": 4,
        "address": "10.1.2.3/24"
    },
    "primary_ip6": null,
    "vcpus": 4,
    "memory": 8192,
    "disk": 74,
    "comments": "",
    "local_context_data": null,
    "tags": [],
    "custom_fields": {
        "tos_uuid": null
    },
    "created": "2020-11-30",
    "last_updated": "2020-11-30T15:06:11.441024Z"
}

curl -X DELETE "https://example.com/api/ipam/ip-addresses/871/"

curl -X GET https://example.com/api/virtualization/virtual-machines/128/?exclude=config_context
{
    "id": 128,
    "url": "https://example.com/api/virtualization/virtual-machines/128/",
    "name": "git",
    "status": {
        "value": "active",
        "label": "Active"
    },
    "site": {
        "id": 1,
        "url": "https://example.com/api/dcim/sites/1/",
        "name": "New York",
        "slug": "new-york"
    },
    "cluster": {
        "id": 4,
        "url": "https://example.com/api/virtualization/clusters/4/",
        "name": "East"
    },
    "role": {
        "id": 8,
        "url": "https://example.com/api/dcim/device-roles/8/",
        "name": "Server",
        "slug": "server"
    },
    "tenant": null,
    "platform": {
        "id": 13,
        "url": "https://example.com/api/dcim/platforms/13/",
        "name": "CentOS 8 (64-bit)",
        "slug": "centos-8-64-bit"
    },
    "primary_ip": null,
    "primary_ip4": null,
    "primary_ip6": null,
    "vcpus": 4,
    "memory": 8192,
    "disk": 74,
    "comments": "",
    "local_context_data": null,
    "tags": [],
    "custom_fields": {
        "tos_uuid": null
    },
    "created": "2020-11-30",
    "last_updated": "2020-11-30T15:06:11.441024Z"
}

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: 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