-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from DanSheps/develop-3.6
Update for NB3.7
- Loading branch information
Showing
7 changed files
with
75 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import uuid | ||
|
||
from django.core.management.base import BaseCommand | ||
from django.db import transaction | ||
from django.utils import timezone | ||
|
||
from netbox_config_backup.models import BackupJob | ||
from netbox_config_backup.tasks import backup_job | ||
from netbox_config_backup.utils import remove_queued | ||
from netbox_config_backup.utils.rq import can_backup | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
def handle(self, *args, **options): | ||
from netbox_config_backup.models import Backup | ||
print(f'Backup Name\t\tDevice Name\t\tIP') | ||
for backup in Backup.objects.filter(device__isnull=False): | ||
if backup.ip: | ||
ip = backup.ip | ||
else: | ||
ip = backup.device.primary_ip | ||
|
||
name = f'{backup.name}' | ||
if len(backup.name) > 15: | ||
name = f'{name}\t' | ||
elif len(backup.name) > 7: | ||
name = f'{name}\t\t' | ||
else: | ||
name = f'{name}\t\t\t' | ||
|
||
device_name = f'{backup.device.name}' | ||
if len(backup.device.name) > 15: | ||
device_name = f'{device_name}\t' | ||
elif len(backup.device.name) > 7: | ||
device_name = f'{device_name}\t\t' | ||
else: | ||
device_name = f'{device_name}\t\t\t' | ||
|
||
print(f'{name}{device_name}{ip}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
setup( | ||
name='netbox_config_backup', | ||
version='1.5.0', | ||
version='1.5.1', | ||
description='NetBox Configuration Backup', | ||
long_description='Plugin to backup device configuration', | ||
url='https://github.com/dansheps/netbox-config-backup/', | ||
|
@@ -12,6 +12,7 @@ | |
maintainer='Daniel Sheppard', | ||
maintainer_email='[email protected]', | ||
install_requires=[ | ||
'netmiko>=4.0.0' | ||
'napalm', | ||
'uuid', | ||
'dulwich', | ||
|
@@ -28,4 +29,4 @@ | |
'Framework :: Django', | ||
'Programming Language :: Python :: 3', | ||
] | ||
) | ||
) |