Beispiel #1
0
    def test_thin_path(self):
        '''
        Test thin.thin_path returns the expected path.

        :return:
        '''
        assert thin.thin_path('/path/to') == '/path/to/thin/thin.tgz'
Beispiel #2
0
    def test_thin_path(self):
        """
        Test thin.thin_path returns the expected path.

        :return:
        """
        path = os.sep + os.path.join("path", "to")
        expected = os.path.join(path, "thin", "thin.tgz")
        self.assertEqual(thin.thin_path(path), expected)
Beispiel #3
0
    def test_thin_path(self):
        '''
        Test thin.thin_path returns the expected path.

        :return:
        '''
        path = os.sep + os.path.join('path', 'to')
        expected = os.path.join(path, 'thin', 'thin.tgz')
        self.assertEqual(thin.thin_path(path), expected)
Beispiel #4
0
    def test_single_opts(self):
        ''' Sanity check for ssh.Single options
        '''
        argv = [
            'ssh.set_auth_key', 'root',
            'hobn+amNAXSBTiOXEqlBjGB...rsa root@master'
        ]
        opts = {
            'argv': argv,
            '__role': 'master',
            'cachedir': self.tmp_cachedir,
            'extension_modules': os.path.join(self.tmp_cachedir, 'extmods'),
        }
        target = {
            'passwd': 'abc123',
            'ssh_options': None,
            'sudo': False,
            'identities_only': False,
            'host': 'login1',
            'user': '******',
            'timeout': 65,
            'remote_port_forwards': None,
            'sudo_user': '',
            'port': '22',
            'priv': '/etc/salt/pki/master/ssh/salt-ssh.rsa'
        }

        single = ssh.Single(opts,
                            opts['argv'],
                            'localhost',
                            mods={},
                            fsclient=None,
                            thin=thin.thin_path(opts['cachedir']),
                            mine=False,
                            **target)

        self.assertEqual(single.shell._ssh_opts(), '')
        self.assertEqual(
            single.shell._cmd_str('date +%s'), 'ssh login1 '
            '-o KbdInteractiveAuthentication=no -o '
            'PasswordAuthentication=yes -o ConnectTimeout=65 -o Port=22 '
            '-o IdentityFile=/etc/salt/pki/master/ssh/salt-ssh.rsa '
            '-o User=root  date +%s')