Skip to content

Instantly share code, notes, and snippets.

View coxley's full-sized avatar

Codey Oxley coxley

View GitHub Profile
@coxley
coxley / pre-commit
Created December 9, 2015 08:20 — forked from anl/pre-commit
Git pre-commit hook for DNS zone data - see http://andyleonard.com/2012/01/21/git-pre-commit-hook-for-dns-zone-data/
#!/bin/bash
# Adapted from a puppet pre-commit hook at:
# http://blog.snijders-it.nl/2011/12/example-puppet-27-git-pre-commit-script.html
#
# install this as .git/hooks/pre-commit to check DNS zone files
# for errors before committing changes.
rc=0
import copy
from pynsot.client import get_api_client()
api = get_api_client()
site = api.sites(api.default_site)
objects = site.networks.get(network_address='192.168.0.0')['data']['networks']
to_update = copy.deepcopy(objects)
[t['attributes'] = {} for t in to_update] # Strip the attributes
from __future__ import unicode_literals
"""
Loader for Trigger NetDevices using NSoT API.
Right now this loads ALL devices ALL the time, which scales very poorly with
the number of devices and attributes in NSoT.
To use this: