Skip to content

Commit

Permalink
Added command_interval to Commando, to wait between sending commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
jathanism committed Apr 13, 2015
1 parent cf6225c commit e8e4385
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
15 changes: 15 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
Changelog
=========

.. _v1.5.1:

1.5.1
=====

New Features
------------

+ The SSH authentication order is now a configurable setting. Public key is now
the last method by default, but this is now easily configured in
``settings.py`` using the new :setting:`SSH_AUTHENTICATION_ORDER` setting.
+ The ``command_interval`` argument may now be passed to
`~trigger.cmds.Commando` and its subclasses. This allows you to specify a
delay time in seconds to wait between sending commands to devices.

.. _v.1.5:

1.5
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, 5, 1, 'b1')
__version__ = (1, 5, 1, 'b2')

full_version = '.'.join(str(x) for x in __version__[0:3]) + \
''.join(__version__[3:])
Expand Down
11 changes: 8 additions & 3 deletions trigger/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
__maintainer__ = 'Jathan McCollum'
__email__ = 'jathan@gmail.com'
__copyright__ = 'Copyright 2009-2013, AOL Inc.; 2014 Salesforce.com'
__version__ = '2.6'
__version__ = '2.7'


# Imports
Expand Down Expand Up @@ -111,6 +111,9 @@ class Commando(object):
:param with_acls:
Whether to load ACL associations (requires Redis). Defaults to whatever
is specified in settings.WITH_ACLS
:param command_interval:
(Optional) Amount of time in seconds to wait between sending commands.
"""
# Defaults to all supported vendors
vendors = settings.SUPPORTED_VENDORS
Expand All @@ -137,7 +140,7 @@ def __init__(self, devices=None, commands=None, creds=None,
incremental=None, max_conns=10, verbose=False,
timeout=DEFAULT_TIMEOUT, production_only=True,
allow_fallback=True, with_errors=True, force_cli=False,
with_acls=False):
with_acls=False, command_interval=0):
if devices is None:
raise exceptions.ImproperlyConfigured('You must specify some `devices` to interact with!')

Expand All @@ -152,6 +155,7 @@ def __init__(self, devices=None, commands=None, creds=None,
self.allow_fallback = allow_fallback
self.with_errors = with_errors
self.force_cli = force_cli
self.command_interval = command_interval
self.curr_conns = 0
self.jobs = []

Expand Down Expand Up @@ -271,7 +275,8 @@ def _add_worker(self):
incremental=self.incremental,
timeout=self.timeout,
with_errors=self.with_errors,
force_cli=self.force_cli)
force_cli=self.force_cli,
command_interval=self.command_interval)

# Add the parser callback for great justice!
async.addCallback(self.parse, device, commands)
Expand Down

0 comments on commit e8e4385

Please sign in to comment.