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
#!/usr/bin/env bash | |
echo "Printing VM snapshots..." | |
nodes=$(pvesh get /cluster/resources --type vm --output-format json |jq -r '.[] | [.vmid, .name, .node, .type] | @json') | |
echo "Processing data ..." | |
for i in $nodes; do | |
vmtype=$(jq -r '.[3]' <<< "$i"); | |
if [[ "$vmtype" == "qemu" ]]; then | |
#printf "\n i= $i" # -- shows all iterations for troubleshooting | |
vmid=$(jq -r '.[0]' <<< "$i"); |
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
from django.db.models import Q | |
from extras.reports import Report | |
from collections import defaultdict | |
from dcim.models import Device | |
from ipam.models import IPAddress | |
from ipam.choices import IPAddressRoleChoices | |
class UniqueIPReport(Report): |
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
import calendar | |
def compare_calendar(curr_year, min_year, max_year): | |
if (curr_year >= min_year) and (curr_year <= max_year): | |
c = calendar.TextCalendar(calendar.MONDAY) | |
c_curr_year = c.formatyear(curr_year) | |
c_curr_year = c_curr_year[42:] | |
print('Current year is {}'.format(curr_year)) | |
for y in range(min_year, max_year+1): | |
c_y = c.formatyear(y) |