-
Notifications
You must be signed in to change notification settings - Fork 253
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
Add software models #5137
Add software models #5137
Conversation
…version, remove device and virtualmachine fk to softwareimage and replace with a fk to softwareversion
changes/1.added
Outdated
Added new models for software versions and software images. | ||
Added a many-to-many relationship from `DeviceType` to `SoftwareImage`. | ||
Added a many-to-many relationship from `InventoryItem` to `SoftwareImage`. | ||
Added a foreign key relationship from `Device` to `SoftwareVersion`. | ||
Added a foreign key relationship from `VirtualMachine` to `SoftwareVersion`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely deserves an entry in the 2.2 Release Overview as well. :-)
<div class="table-responsive"> | ||
{% render_table table table_inc_template|default:'inc/table.html' %} | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix for #5030, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In places where panel_table.html
is used. There are still some places where we're doing {% render_table table 'inc/table.html' %}
that are still broken with this change. We probably need to just standardize on one way to render tables and fix it across the board.
|
||
@factory.post_generation | ||
def software_images(self, create, extracted, **kwargs): | ||
if not create or not DeviceTypeFactory.has_software_images.evaluate(None, None, None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this do, especially the .evaluate(None, None, None)
part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's how factoryboy grabs the next value from a factory Declaration
. None, None, None
is required because evaluate needs 3 positional args but they're not doing anything in this context so I just used None.
nautobot/virtualization/templates/virtualization/virtualmachine.html
Outdated
Show resolved
Hide resolved
- Fix incorrect changelog - Validate that only one default image is set per device type - Add platform to default columns on SoftwareVersion list view
@@ -161,6 +167,8 @@ def _generate_factory_data(self, seed, db_name): | |||
DeviceRedundancyGroupFactory.create_batch(20, using=db_name) | |||
self.stdout.write("Creating Devices...") | |||
DeviceFactory.create_batch(20, using=db_name) | |||
self.stdout.write("Creating SoftwareImages without Devices or DeviceTypes...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this with or without Devices or DeviceTypes? Im a little confused because it is creating after some devices and devicetypes are already created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without. The Device and DeviceType factories automatically assign SoftwareImages and SoftwareVersions (this is a typo I'll fix)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…to SoftwareImage create/edit form, reorder nav menu
# Software images | ||
router.register("software-images", views.SoftwareImageViewSet) | ||
router.register("software-versions", views.SoftwareVersionViewSet) | ||
router.register("device-type-to-software-image", views.DeviceTypeToSoftwareImageViewSet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given our convention of pluralizing the URL path strings, should this be something like device-types-to-software-images
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In IPAM we have /api/ipam/ip-address-to-interface/
but then we have /api/dcim/interface-redundancy-group-associations/
. I think either the double plural or the associations
makes it more apparent that you're dealing with an m2m. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ip-address-to-interface
also feels "wrong" to me. I'd vote for the double plural.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I forgot to fix this before merging 😦
I opened #5190 to fix this
Closes #1
What's Changed
Screenshots
Nav menu
SoftwareVersion list
SoftwareVersion detail
SoftwareImage list
SoftwareImage detail
DeviceType create/edit
DeviceType detail
TODO