Skip to content

Commit

Permalink
Updated all Commando plugins in prep for Trigger 1.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
jathanism committed Apr 11, 2015
1 parent 5019f8f commit 5880fd2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions trigger/contrib/commando/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

__author__ = 'Jathan McCollum, Mike Biancaniello'
__maintainer__ = 'Jathan McCollum'
__email__ = 'jathan.mccollum@teamaol.com'
__email__ = 'jathan@gmail.com'
__copyright__ = 'Copyright 2012-2013, AOL Inc.'
__version__ = '0.2'
__version__ = '0.2.1'


# Imports
Expand Down Expand Up @@ -79,16 +79,16 @@ def __init__(self, *args, **kwargs):

self.deferred = defer.Deferred()

def from_base(self, results, device):
def from_base(self, results, device, commands=None):
"""Call store_results directly"""
log.msg('Received %r from %s' % (results, device))
self.store_results(device, results)

def from_juniper(self, results, device):
def from_juniper(self, results, device, commands=None):
"""(Maybe) convert Juniper XML results into a strings"""
# If we've set force_cli, use to_base() instead
if self.force_cli:
return self.from_base(results, device)
return self.from_base(results, device, commands)

from xml.etree.cElementTree import tostring
log.msg('Got XML from %s' % device)
Expand Down
2 changes: 1 addition & 1 deletion trigger/contrib/commando/plugins/config_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def to_juniper(self, dev, commands=None, extra=None):
cmds.append(Element('commit-configuration'))
return cmds

def from_juniper(self, data, device):
def from_juniper(self, data, device, commands=None):
"""Do all the magic to parse Junos interfaces"""
#print 'device:', device
#print 'data len:', len(data)
Expand Down
2 changes: 1 addition & 1 deletion trigger/contrib/commando/plugins/gather_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def to_cisco(self, device, commands=None, extra=None):
'show switch detail',
'show run | i ip domain-name']

def from_cisco(self, results, device):
def from_cisco(self, results, device, commands=None):
"""Parses output of certain commands and add to ``self.results``
A lot of good information can be retrieved from show version. Method
Expand Down
6 changes: 3 additions & 3 deletions trigger/contrib/commando/plugins/show_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def to_juniper(self, dev, commands=None, extra=None):
self.commands = [cmd]
return self.commands

def from_cisco(self, data, device):
def from_cisco(self, data, device, commands=None):
"""Parse Cisco time"""
# => '16:18:21.763 GMT Thu Jun 28 2012\n'
fmt = '%H:%M:%S.%f %Z %a %b %d %Y\n'
Expand All @@ -42,7 +42,7 @@ def from_cisco(self, data, device):
results.append(jdata)
self.store_results(device, results)

def from_brocade(self, data, device):
def from_brocade(self, data, device, commands=None):
"""
Parse Brocade time. Brocade switches and routers behave
differently...
Expand All @@ -63,7 +63,7 @@ def from_brocade(self, data, device):
results.append(jdata)
self.store_results(device, results)

def from_juniper(self, data, device):
def from_juniper(self, data, device, commands=None):
"""Do all the magic to parse Junos interfaces"""
self.raw = data
results=[]
Expand Down
8 changes: 4 additions & 4 deletions trigger/contrib/docommand/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
__maintainer__ = 'Jathan McCollum'
__email__ = 'jathan@gmail.com'
__copyright__ = 'Copyright 2012-2013, AOL Inc.; 2013 Salesforce.com'
__version__ = '3.0'
__version__ = '3.1'


# Imports
Expand Down Expand Up @@ -41,7 +41,7 @@ class DoCommandBase(Commando):
"""
description = 'Insert description here.'

def from_base(self, results, device):
def from_base(self, results, device, commands=None):
"""Call store_results without calling map_results"""
log.msg('Received %r from %s' % (results, device))
self.store_results(device, results)
Expand Down Expand Up @@ -139,7 +139,7 @@ def store_results(self, device, results):
def __children_with_namespace(self, ns):
return lambda elt, tag: elt.findall('./' + ns + tag)

def from_juniper(self, data, device):
def from_juniper(self, data, device, commands=None):
devname = device.nodeName
ns = '{http://xml.juniper.net/xnm/1.1/xnm}'
if self.verbose:
Expand Down Expand Up @@ -282,7 +282,7 @@ def store_results(self, device, results):
def __children_with_namespace(self, ns):
return lambda elt, tag: elt.findall('./' + ns + tag)

def from_juniper(self, data, device):
def from_juniper(self, data, device, commands=None):
"""Parse results from a Juniper device."""
devname = device.nodeName
if self.verbose:
Expand Down

0 comments on commit 5880fd2

Please sign in to comment.