mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-21 19:47:20 -06:00
Enabled export templates for secrets
This commit is contained in:
parent
6cc9ceb198
commit
5cf38b5ce9
@ -53,6 +53,7 @@ EXPORTTEMPLATE_MODELS = [
|
||||
'site', 'region', 'rack', 'rackgroup', 'manufacturer', 'devicetype', 'device', # DCIM
|
||||
'consoleport', 'powerport', 'interfaceconnection', 'virtualchassis', # DCIM
|
||||
'aggregate', 'prefix', 'ipaddress', 'vlan', 'vrf', 'service', # IPAM
|
||||
'secret', # Secrets
|
||||
'tenant', # Tenancy
|
||||
'cluster', 'virtualmachine', # Virtualization
|
||||
]
|
||||
|
@ -376,6 +376,14 @@ class Secret(ChangeLoggedModel, CustomFieldModel):
|
||||
def get_absolute_url(self):
|
||||
return reverse('secrets:secret', args=[self.pk])
|
||||
|
||||
def to_csv(self):
|
||||
return (
|
||||
self.device,
|
||||
self.role,
|
||||
self.name,
|
||||
self.plaintext or '',
|
||||
)
|
||||
|
||||
def _pad(self, s):
|
||||
"""
|
||||
Prepend the length of the plaintext (2B) and pad with garbage to a multiple of 16B (minimum of 64B).
|
||||
|
@ -6,6 +6,7 @@
|
||||
{% if perms.secrets.add_secret %}
|
||||
{% import_button 'secrets:secret_import' %}
|
||||
{% endif %}
|
||||
{% export_button content_type %}
|
||||
</div>
|
||||
<h1>{% block title %}Secrets{% endblock %}</h1>
|
||||
<div class="row">
|
||||
|
Loading…
Reference in New Issue
Block a user