Esempio n. 1
0
def halt_and_destroy():
    """
    Halt and destoy virtual machine
    """
    with lcd(os.path.dirname(__file__)):
        if os.path.exists(os.path.join(env['lcwd'], 'Vagrantfile')):
            local('vagrant halt')
            if version() >= (0, 9, 99):
                local('vagrant destroy -f')
            else:
                local('vagrant destroy')
def halt_and_destroy():
    """
    Halt and destoy virtual machine
    """
    with lcd(os.path.dirname(__file__)):
        if os.path.exists(os.path.join(env['lcwd'], 'Vagrantfile')):
            local('vagrant halt')
            if version() >= (0, 9, 99):
                local('vagrant destroy -f')
            else:
                local('vagrant destroy')
Esempio n. 3
0
    def ssh_config(self):
        """
        Get SSH connection parameters for the current box
        """
        with lcd(os.path.dirname(__file__)):
            if version() >= (0, 9, 0):
                command = 'ssh-config'
            else:
                command = 'ssh_config'
            with settings(hide('running')):
                output = local('vagrant %s' % command, capture=True)

        config = {}
        for line in output.splitlines()[1:]:
            key, value = line.strip().split(' ', 2)
            config[key] = value
        return config
    def ssh_config(self):
        """
        Get SSH connection parameters for the current box
        """
        with lcd(os.path.dirname(__file__)):
            if version() >= (0, 9, 0):
                command = 'ssh-config'
            else:
                command = 'ssh_config'
            with settings(hide('running')):
                output = local('vagrant %s' % command, capture=True)

        config = {}
        for line in output.splitlines()[1:]:
            key, value = line.strip().split(' ', 2)
            config[key] = value
        return config
 def test_vagrant_version_1_3_0(self):
     with patch('fabtools.vagrant.local') as mock_local:
         mock_local.return_value = "Vagrant version 1.3.0\n"
         from fabtools.vagrant import version
         self.assertEqual(version(), (1, 3, 0))
 def test_vagrant_version_1_5_0_dev(self):
     with patch('fabtools.vagrant.local') as mock_local:
         mock_local.return_value = "Vagrant 1.5.0.dev\n"
         from fabtools.vagrant import version
         self.assertEqual(version(), (1, 5, 0, 'dev'))
 def test_vagrant_version_1_4_3(self):
     with patch('fabtools.vagrant.local') as mock_local:
         mock_local.return_value = "Vagrant 1.4.3\n"
         from fabtools.vagrant import version
         self.assertEqual(version(), (1, 4, 3))
Esempio n. 8
0
 def test_vagrant_version_1_3_1(self):
     with patch('fabtools.vagrant.local') as mock_local:
         mock_local.return_value = _Success("Vagrant v1.3.1\n")
         from fabtools.vagrant import version
         self.assertEqual(version(), (1, 3, 1))
 def test_vagrant_version_1_3_0(self):
     with patch('fabtools.vagrant.local') as mock_local:
         mock_local.return_value = "Vagrant version 1.3.0\n"
         from fabtools.vagrant import version
         self.assertEqual(version(), (1, 3, 0))
 def test_vagrant_version_1_5_0_dev(self):
     with patch('fabtools.vagrant.local') as mock_local:
         mock_local.return_value = "Vagrant 1.5.0.dev\n"
         from fabtools.vagrant import version
         self.assertEqual(version(), (1, 5, 0, 'dev'))
 def test_vagrant_version_1_4_3(self):
     with patch('fabtools.vagrant.local') as mock_local:
         mock_local.return_value = "Vagrant 1.4.3\n"
         from fabtools.vagrant import version
         self.assertEqual(version(), (1, 4, 3))
Esempio n. 12
0
 def test_vagrant_version_1_3_1(self):
     with patch('fabtools.vagrant.local') as mock_local:
         mock_local.return_value = _Success("Vagrant v1.3.1\n")
         from fabtools.vagrant import version
         self.assertEqual(version(), (1, 3, 1))