root/tags/v1.0/test_ssh.py

Revision 27, 1.2 KB (checked in by daedalus, 4 years ago)

* Added 'authoritarian' mode, which allows you permit/deny each and every command

that will be issued to a remote device. Designed for testing new change scripts.

* Added a 'command_timeout' parameter to Command Provisioners, so you can override

the default command timeout of 300 seconds by setting an attribute in the config
file

* Added proper handling of the 'onfail: continue' idea. You can now specify that

if a change fails, and it is a pre-requisite for some other change, processing
will continue despite the failure.

* Added the onfail: retry feature. If a change fails, you can specify that it should

be retried. You can also set a max number of retries. The default is 3.

Line 
1##
2##
3##
4## Test ssh provisioning
5
6from twisted.trial import unittest
7from twisted.internet import error
8
9from provisioner import SSHProvisioner, SSHConnectingProvisioner
10from change import CommandChange
11
12import logging
13log = logging.getLogger('modipy')
14log.setLevel(logging.DEBUG)
15
16class TestSSHProvision(unittest.TestCase):
17
18    def setUp(self):
19        """
20        Create the basic provisioning setup
21        """
22        self.prov = SSHConnectingProvisioner()
23        #self.prov = SSHProvisioner()
24        impl_commands = [
25            ( None, 'echo hello' ),
26            ( None, 'sleep 5; echo $?' ),
27            ( None, 'fred' ),
28            ( 'hell', 'echo found hello! hurray!'),
29            ( 'hurr', None ),
30            ]
31
32        backout_commands = [
33            ( None, 'echo "I am backing out"' ),
34            ( None, 'sleep 5; echo $?' ),
35            ( None, 'echo "backout successful!"' ),
36            ]
37
38
39        self.change = CommandChange(devices=['localhost',],
40                                    impl_commands=impl_commands,
41                                    backout_commands=backout_commands)
42
43    def tearDown(self):
44        pass
45
46    def test_list_users(self):
47        return self.prov.perform_change(self.change)
48        pass
Note: See TracBrowser for help on using the browser.