Skip to content

Commit

Permalink
Bugfix causing CSVLoader for netdevices to always succeed
Browse files Browse the repository at this point in the history
- Updated docs/conf.py to use the new RTD theme (next-gen!)
- Updated docs for CSV support to match reality
- Bump version to 1.4.2b9
  • Loading branch information
jathanism committed Nov 12, 2013
1 parent dd367b2 commit 25bc2a6
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 12 deletions.
8 changes: 4 additions & 4 deletions conf/netdevices.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test1-abc.net.aol.com,juniper,router
test2-abc.net.aol.com,juniper,router
fw1-xyz.net.aol.com,netscreen,firewall
lab1-switch.net.aol.com,foundry,switch
test1-abc.net.aol.com,juniper,up,router
test2-abc.net.aol.com,juniper,up,router
fw1-xyz.net.aol.com,netscreen,up,firewall
lab1-switch.net.aol.com,foundry,up,switch
1 change: 1 addition & 0 deletions conf/trigger_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
'JUNIPER': 'juniper',
'MRV': 'mrv',
'NETSCREEN TECHNOLOGIES': 'netscreen',
'PALO ALTO NETWORKS': 'paloalto',
}

# A dictionary keyed by manufacturer name containing a list of the device types
Expand Down
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

# Use the new RTD theme
RTD_NEW_THEME = True

import os
import re
import sys
Expand Down Expand Up @@ -161,7 +164,7 @@ def release_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'default'
html_style = 'rtd.css'
#html_style = 'rtd.css'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
8 changes: 4 additions & 4 deletions docs/usage/netdevices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ The most fields you may populate are the same as with the RANCID support.
Please see the explanation of the fields populated by the :ref:`RANCID format
<rancid-format>`. A "fully-populated" CSV file would look more like this::

test1-abc.net.aol.com,juniper,router
test2-abc.net.aol.com,juniper,router
fw1-xyz.net.aol.com,netscreen,firewall
lab1-switch.net.aol.com,foundry,switch
test1-abc.net.aol.com,juniper,up,router
test2-abc.net.aol.com,juniper,up,router
fw1-xyz.net.aol.com,netscreen,up,firewall
lab1-switch.net.aol.com,foundry,up,switch

.. _xml-format:

Expand Down
2 changes: 1 addition & 1 deletion trigger/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = (1, 4, 2, 'b8')
__version__ = (1, 4, 2, 'b9')

full_version = '.'.join(map(str, __version__[0:3])) + ''.join(__version__[3:])
release = full_version
Expand Down
3 changes: 3 additions & 0 deletions trigger/netdevices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ def _cleanup_attributes(self):
if self.nodeName is not None:
self.nodeName = self.nodeName.lower()

if self.deviceType is not None:
self.deviceType = self.deviceType.upper()

# Cleanup whitespace from owning team
if self.owningTeam is not None:
self.owningTeam = self.owningTeam.strip()
Expand Down
6 changes: 4 additions & 2 deletions trigger/rancid.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
__author__ = 'Jathan McCollum'
__maintainer__ = 'Jathan McCollum'
__email__ = '[email protected]'
__copyright__ = 'Copyright 2012-2012, AOL Inc.'
__version__ = '0.1'
__copyright__ = 'Copyright 2012-2012, AOL Inc.; 2013 Salesforce.com'
__version__ = '0.1.1'

import collections
import copy
Expand Down Expand Up @@ -94,6 +94,8 @@ def parse_rancid_file(rancid_root, filename=RANCID_DB_FILE, fields=None,
(Optional) Field delimiter
"""
device_data = _parse_delimited_file(rancid_root, filename, delimiter)
if not device_data:
return None # Always return None if there are no results

# Make sure fields is not null and is some kind of iterable
if not fields:
Expand Down

0 comments on commit 25bc2a6

Please sign in to comment.