Skip to content

Commit

Permalink
Merge pull request #248 from jathanism/mihai-fixes
Browse files Browse the repository at this point in the history
Bugfix in Commando "config device" plugin and a couple UX changes.
  • Loading branch information
johnfzc committed Feb 18, 2016
2 parents 0b4d90c + af3ca1c commit 3978b8b
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 16 deletions.
35 changes: 27 additions & 8 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,29 @@
Changelog
=========

.. _v1.5.7:

1.5.7 (2016-02-18)
==================

Enhancements
------------

+ Added a new prompt pattern to ``settings.CONTINUE_PROMPTS``.
+ New continue prompts no longer need to be lower-cased.
+ Clarified the error text when an enable password is required but not provided
when connecting to a device to make it a little more clear on how to proceed.

Bug Fixes
---------

+ Bugfix in `~trigger.contrib.commando.plugins.config_device` causing an
unhandled ``NameError``.

.. _v1.5.6:

1.5.6
=====
1.5.6 (2016-02-16)
==================

Bug Fixes
---------
Expand All @@ -21,8 +40,8 @@ Bug Fixes

.. _v1.5.5:

1.5.5
=====
1.5.5 (2016-02-04)
==================

Bug Fixes
---------
Expand All @@ -33,8 +52,8 @@ Bug Fixes

.. _v1.5.4:

1.5.4
=====
1.5.4 (2016-01-29)
==================

Bug Fixes
---------
Expand All @@ -49,8 +68,8 @@ Bug Fixes

.. _v1.5.3:

1.5.3
=====
1.5.3 (2016-01-19)
==================

New Features
------------
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, 6)
__version__ = (1, 5, 7)

full_version = '.'.join(str(x) for x in __version__[0:3]) + \
''.join(__version__[3:])
Expand Down
3 changes: 2 additions & 1 deletion trigger/conf/global_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@
'[y/n]:',
'[confirm]',
'[yes/no]: ',
'overwrite file [startup-config] ?[yes/press any key for no]....'
'overwrite file [startup-config] ?[yes/press any key for no]....',
'Destination filename [running-config]? ',
]

# The file path where .gorc is expected to be found.
Expand Down
6 changes: 3 additions & 3 deletions trigger/contrib/commando/plugins/config_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def to_cisco(self, dev, commands=None, extra=None):
cmds = []
files = self.files
for fn in files:
copytftpcmd = "copy tftp://%s/%s running-config" % (tftp_ip, fn)
copytftpcmd = "copy tftp://%s/%s running-config" % (self.tftp_ip, fn)
cmds.append(copytftpcmd)
cmds.append('copy running-config startup-config')
return cmds
Expand All @@ -69,7 +69,7 @@ def to_brocade(self, dev, commands=None, extra=None):
log.msg('Device Type (%s %s) not supported' % (dev.vendor, dev.make))
return []
for fn in files:
copytftpcmd = "copy tftp running-config %s %s" % (tftp_ip, fn)
copytftpcmd = "copy tftp running-config %s %s" % (self.tftp_ip, fn)
if action == 'overwrite':
copytftpcmd += ' overwrite'
cmds.append(copytftpcmd)
Expand All @@ -83,7 +83,7 @@ def to_dell(self, dev, commands=None, extra=None):
log.msg('Device Type (%s %s) not supported' % (dev.vendor, dev.make))
return cmds
for fn in files:
copytftpcmd = "copy tftp://%s/%s running-config" % (tftp_ip, fn)
copytftpcmd = "copy tftp://%s/%s running-config" % (self.tftp_ip, fn)
cmds.append(copytftpcmd)
cmds.append('copy running-config startup-config')
return cmds
Expand Down
16 changes: 13 additions & 3 deletions trigger/twister.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
from trigger import tacacsrc, exceptions
from trigger.utils import network, cli


__author__ = 'Jathan McCollum, Eileen Tschetter, Mark Thomas, Michael Shields'
__maintainer__ = 'Jathan McCollum'
__email__ = 'jathan@gmail.com'
__copyright__ = 'Copyright 2006-2013, AOL Inc.; 2013 Salesforce.com'
__version__ = '1.5.7'
__version__ = '1.5.8'


# Exports
# TODO (jathan): Setting this prevents everything from showing up in the Sphinx
Expand Down Expand Up @@ -90,12 +92,18 @@ def is_awaiting_confirmation(prompt):
"""
Checks if a prompt is asking for us for confirmation and returns a Boolean.
New patterns may be added by customizing ``settings.CONTINUE_PROMPTS``.
>>> from trigger.twister import is_awaiting_confirmation
>>> is_awaiting_confirmation('Destination filename [running-config]? ')
True
:param prompt:
The prompt string to check
"""
prompt = prompt.lower()
matchlist = settings.CONTINUE_PROMPTS
return any(prompt.endswith(match) for match in matchlist)
return any(prompt.endswith(match.lower()) for match in matchlist)


def requires_enable(proto_obj, data):
Expand Down Expand Up @@ -152,7 +160,9 @@ def send_enable(proto_obj, disconnect_on_fail=True):
log.msg('[%s] Enable password not found, not enabling.' %
proto_obj.device)
proto_obj.factory.err = exceptions.EnablePasswordFailure(
'Enable password not set.')
'Enable password not set. See documentation on '
'settings.TRIGGER_ENABLEPW for help.'
)
if disconnect_on_fail:
proto_obj.loseConnection()

Expand Down

0 comments on commit 3978b8b

Please sign in to comment.