mirror of
				https://github.com/netbox-community/netbox.git
				synced 2024-05-10 07:54:54 +00:00 
			
		
		
		
	Enabled export templates for secrets
This commit is contained in:
		@@ -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">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user