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 for major versions >= 3 #21

Open
moonrail opened this issue Sep 20, 2021 · 8 comments · May be fixed by #22
Open

Support for major versions >= 3 #21

moonrail opened this issue Sep 20, 2021 · 8 comments · May be fixed by #22

Comments

@moonrail
Copy link

moonrail commented Sep 20, 2021

Environment

  • Python version: 3.9.5
  • NetBox version: 3.0.2
  • ntc-netbox-plugin-metrics-ext version: 1.0.0

Steps to Reproduce

  1. Use plugin with default settings on NetBox 3.0.2
  2. Navigate to API endpoint /api/plugins/metrics-ext/app-metrics

Expected Behavior

Regular output just as designed.

Observed Behavior

<class 'ImportError'>

cannot import name 'ReportResult' from 'extras.models' (/opt/netbox/netbox/extras/models/__init__.py)

Python version: 3.9.5
NetBox version: 3.0.2

The cause is the version check in:

if netbox_version.major >= 2 and netbox_version.minor >= 9:

The minor version check rules out anything other than 9 or above.
So e.g. 3.9.0 would be allowed, while 3.0.2 is not.

Suggestion:

if netbox_version >= version.parse("2.9.0"):
@dgarros
Copy link
Contributor

dgarros commented Sep 29, 2021

Thanks for the suggestion, would you mind creating a PR for it ?

@moonrail moonrail linked a pull request Sep 29, 2021 that will close this issue
@moonrail
Copy link
Author

@dgarros Of course - see #22

@Toothwitch
Copy link

Hi, i'd like to ask if this PR/Issue might have been forgotten or lost due to maintainer changes?
As i'd also like to use this project with newer (>3.0.0) Netbox versions, with this official repo, instead of a local fork, i would kindly ask to revisit this issue. Many Thanks!

@z-8-d
Copy link

z-8-d commented Sep 13, 2022

@moonrail @dgarros - Has this been solved please? Seems the PR is still ongoing.

@moonrail
Copy link
Author

@z-8-d Maintainers are not responding. Would guess they've moved on from NetBox to their NetBox-Derivate Nautobot and are not keen to help NetBox any further.

@chrisho95
Copy link

Hi,

I just installed netbox in version 3.5.4 and I have this error. I did update the metrics.py file (line 54 - if netbox_version >= version.parse("2.9.0"):).

In netbox version 3.4.5, this correction made it possible to no longer have an error.

Do we need to change anything more ?

image

BR,

Chris.

@chrisho95
Copy link

Hi,

In Netbox version 3.5.0, the file "/opt/netbox/netbox/extras/models/init.py" has changed.

in version 3.4.x:

**from .change_logging import ObjectChange
from .configcontexts import ConfigContext, ConfigContextModel
from .customfields import CustomField
from .models import *
from .search import *
from .staging import *
from .tags import Tag, TaggedItem

all = (
'Branch',
'CachedValue',
'ConfigContext',
'ConfigContextModel',
'ConfigRevision',
'CustomField',
'CustomLink',
'ExportTemplate',
'ImageAttachment',
'JobResult',
'JournalEntry',
'ObjectChange',
'Report',
'SavedFilter',
'Script',
'StagedChange',
'Tag',
'TaggedItem',
'Webhook',
)**

In version 3.5.x, file content:

**from .change_logging import *
from .configs import *
from .customfields import CustomField
from .dashboard import *
from .models import *
from .reports import *
from .scripts import *
from .search import *
from .staging import *
from .tags import ***

And in version 3.5.x, the class JobResult has been deleted in file "/opt/netbox/netbox/extras/models/models.py".

BR,

Chris.

@llamafilm
Copy link

ReportResult was removed in Netbox 2.9.0. netbox-community/netbox#4799
So this would require more work than simply removing the version check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants