Git Product home page Git Product logo

netbox_slm's Issues

API Call to softwareproductinstallations show json invalid error

<class 'TypeError'>

Object of type SoftwareProductInstallation is not JSON serializable

Python version: 3.10.6
NetBox version: 3.4.5
SLM version: 1.2

Error Log

Internal Server Error: /api/plugins/slm/softwareproductinstallations/
Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 220, in _get_response
    response = response.render()
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/template/response.py", line 114, in render
    self.content = self.rendered_content
  File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/response.py", line 70, in rendered_content
    ret = renderer.render(self.data, accepted_media_type, context)
  File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/renderers.py", line 723, in render
    context = self.get_context(data, accepted_media_type, renderer_context)
  File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/renderers.py", line 679, in get_context
    'content': self.get_content(renderer, data, accepted_media_type, renderer_context),
  File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/renderers.py", line 412, in get_content
    content = renderer.render(data, accepted_media_type, renderer_context)
  File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/renderers.py", line 99, in render
    ret = json.dumps(
  File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/utils/json.py", line 25, in dumps
    return json.dumps(*args, **kwargs)
  File "/usr/lib/python3.10/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/lib/python3.10/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/usr/lib/python3.10/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/usr/lib/python3.10/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/usr/lib/python3.10/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/usr/lib/python3.10/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/usr/lib/python3.10/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/utils/encoders.py", line 67, in default
    return super().default(obj)
  File "/usr/lib/python3.10/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type SoftwareProductInstallation is not JSON serializable

Netbox 3.1 support

You doc says:

The Netbox SLM plugin currently only works with v3.0.9 of Netbox due to backwards incompatible changes in newer version of Netbox

What are these changes?
We are very interested in such a plugin and would like to help to update and test the plugin with Netbox 3.1 and upcoming 3.2 releases.

Make plugin compatible with Netbox release v3.5.x

Currently, the plugin has only been tested against release v3.4. I am currently running it successfully on 3.4.10.

When trying to run it on 3.5.7, it fails to start with the following error:
ImportError: cannot import name 'DynamicModelChoiceField' from 'utilities.forms' (/opt/netbox/netbox/utilities/forms/__init__.py)

Tweak plugin model

Possibly get rid of Software Products Model and associate SoftwareProductVersion directly to a platform since software actually links to a platform IE it runs on top of a platform or is the platform. You could create a list view bubbling up SoftwareVersion to Platform and show software summaries.

I also recommend some rework of the model to include the below fields.

Possible models.py example

class SoftwareVersion(NetBoxModel)
    platform = models.ForeignKey(to="dcim.Platform", on_delete=models.CASCADE, verbose_name="Platform")
    version = models.CharField(max_length=50)
    alias = models.CharField(max_length=50, blank=True, null=True)
    release_date = models.DateField(null=True, blank=True, verbose_name="Release Date")
    end_of_support = models.DateField(null=True, blank=True, verbose_name="End of Software Support")
    documentation_url = models.URLField(blank=True, verbose_name="Documentation URL")
    long_term_support = models.BooleanField(verbose_name="Long Term Support", blank=True, null=True)
    release_type = models.BooleanField(verbose_name="Release Type", default=False)  # Options (Pre-Release, Stable, Feature, etc)
    file_checksum= models.CharField(max_length=200, blank=True, null=True)
    filename = models.CharField(max_length=50, blank=True, null=True)
    file_link = models.URLField(blank=True, verbose_name="File Link")

This would allow for something more similar to:

Expand the plugin to track all life cycle

The plugin to compare this to would be Nautbot's Device Lifecycle Mgmt

It would be nice to eventually expand to hardware life cycle items. I am raising this feature request for debate. I think we should button up the software lifecycle before expanding to include hardware, but I wanted to get this idea out sooner rather than later. Something like this makes sense:

class HardwareLM:

    # Set model columns
    device_type = models.ForeignKey(
        to="dcim.DeviceType",
        on_delete=models.CASCADE,
        verbose_name="Device Type",
        blank=True,
        null=True,
    )
    module_type = models.ForeignKey(
        to="dcim.ModuleType",
        on_delete=models.CASCADE,
        verbose_name="Module Type",
        blank=True,
        null=True,
    )
   
    inventory_item = models.CharField(verbose_name="Inventory Item Part", max_length=255, blank=True, null=True)
    release_date = models.DateField(null=True, blank=True, verbose_name="Release Date")
    end_of_sale = models.DateField(null=True, blank=True, verbose_name="End of Sale")
    end_of_support = models.DateField(null=True, blank=True, verbose_name="End of Support")
    end_of_sw_releases = models.DateField(null=True, blank=True, verbose_name="End of Software Releases")
    end_of_security_patches = models.DateField(null=True, blank=True, verbose_name="End of Security Patches")
    documentation_url = models.URLField(blank=True, verbose_name="Documentation URL")
    comments = models.TextField(null=True, blank=True, verbose_name="Comments")

Add field 'Stored location URL' to Licenses model

I would also like to be able to specify a URL of the 'Storage Location'.

In the overview, the entered 'Storage Location' (default to "Link" if not given) should then be clickable with this URL.

Implement top_level_menu toggle

Hi,

would love (in comparison to other plugins) to have the ability to put the SLM on the top level menu instead below plugins.
Many other plugins already support this (as it is easier for navigation, IMHO). Should be a "standard" option for many.

Add software license to software installation

Please add the ability to register the software license used for a software installation.
Preferably, allow for the software license to be shared among installations.

License would include:

  • kind/type (e.g. GPL, CC, single payment, repeated payment)
  • expiration date that can be queried (including NULL iff not paid license)

NOTE Actual license keys should not be stored here. They should be kept in a separate secure place. A reference to that place could be included here.

Add Fields for user assigned/limited licenses

I'd like to store some more information about some licenses
for example a confluence Server License:
number of licensed Users
users currently assigned
as comment: users get there license via ldap group synchronization

or for example volumelicenses:
number of licenses
users currently holding these licenses
as comment: where to find the installer

Allow link installation to VM Cluster

Allow to link installations on "VM Cluster" objects, like "Kubernetes Cluster".

Deployments or StateFulSets are not VM, but reside in a "VM Cluster" (Kubernetes)

SLM Under Different Navigation Field

I have Just Started Using this plugin With Netbox 3.7.5 for managing Licenses in my organisation. Everything looks good and it's a perfect fit for my needs.
I just have 2 Queries regarding this:

  1. How I can Move it to a different Navigation Field? As of now, it's coming under Plugins. Is there any way that I can move it under some different or new field?
    image

  2. When In noebox we are not logged in it Shows the Plugin tab and SLM under this. Anyway to hide this
    image

Error to add a license

Hello,
When I try to add a new license for a software product. I have the following message :

Server Error
A database programming error was detected while processing this request. Common causes include the following:

Database migrations missing. When upgrading to a new NetBox release, the upgrade script must be run to apply any new database migrations.
You can run migrations manually by executing python3 manage.py migrate from the command line.

Unsupported PostgreSQL version. Ensure that PostgreSQL version 12 or later is in use.
You can check this by connecting to the database using NetBox's credentials and issuing a query for SELECT VERSION().

The complete exception is provided below:
<class 'django.db.utils.ProgrammingError'>

column "stored_location_url" of relation "netbox_slm_softwarelicense" does not exist
LINE 1: ..."name", "description", "type", "stored_location", "stored_lo...
                                                             ^

Python version: 3.11.4
NetBox version: 3.6.3
Plugins: 
  netbox_dns: 0.19.3
  netbox_slm: 1.5

However, I have the correct version of Postgres and of the plugin.
I've already seen in another issue that the problem was fixed but in my case, it doesn't work.
In advance, thank you for your answer.

Installation of netbox_slm plugin failed

Hello everyone,

I've tried to install the netbox_slm plugin. But it fails when I run bash docker-compose up -d.
I've followed the instructions on netbox_slm README.md. Moreover, I use the 1.4 version of the plugin. I have created the following files in the netbox's repository.

plugin_requirements.txt
netbox-slm

plugins.py

PLUGINS = ["netbox_slm"]

docker-compose.override.yml

version: '3.4' # This is NOT the version of NetBox! No need to adjust :)
services:
  netbox:
    image: netbox:latest-plugins
    ports:
      - 8000:8080
    build:
      context: .
      dockerfile: Dockerfile-Plugins
  netbox-worker:
    image: netbox:latest-plugins
    build:
      context: .
      dockerfile: Dockerfile-Plugins
  netbox-housekeeping:
    image: netbox:latest-plugins
    build:
      context: .
      dockerfile: Dockerfile-Plugins

Dockerfile-Plugins

FROM netboxcommunity/netbox:v3.6-2.7.0 //last version of netbox

COPY ./plugin_requirements.txt /opt/netbox/
RUN /opt/netbox/venv/bin/pip install  --no-warn-script-location -r /opt/netbox/plugin_requirements.txt

# These lines are only required if your plugin has its own static files.
COPY configuration/configuration.py /etc/netbox/config/configuration.py
COPY configuration/plugins.py /etc/netbox/config/plugins.py
RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input

The build works.
I have the following logs :

netbox-docker-netbox-1 | **ImportError: cannot import name 'DynamicModelChoiceField'** from 'utilities.forms' (/opt/netbox/netbox/utilities/forms/__init__.py)

How can I resolve this issue ?

Update the Software Product Version Model

Add the following:

    release_date = models.DateField(null=True, blank=True, verbose_name="Release Date")
    end_of_support = models.DateField(null=True, blank=True, verbose_name="End of Software Support")
    documentation_url = models.URLField(blank=True, verbose_name="Documentation URL")
    long_term_support = models.BooleanField(verbose_name="Long Term Support", blank=True, null=True)
    release_type = models.BooleanField(verbose_name="Release Type", default=False)  # Options (Pre-Release, Stable, Feature, etc)
    file_checksum= models.CharField(max_length=200, blank=True, null=True)
    filename = models.CharField(max_length=50, blank=True, null=True)
    file_link = models.URLField(blank=True, verbose_name="File Link")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.