Example #1
0
    def start_box(self):
        """
        Spin up a new vagrant box
        """

        # Support for Vagrant 1.1 providers
        if ':' in self.current_box:
            box_name, provider = self.current_box.split(':', 1)
        else:
            box_name = self.current_box
            provider = None

        with lcd(os.path.dirname(__file__)):

            if not os.path.exists('Vagrantfile') \
               or not os.environ.get('FABTOOLS_TEST_NODESTROY'):

                # Create a fresh vagrant config file
                local('rm -f Vagrantfile')
                local('vagrant init %s' % box_name)

                # Clean up
                if status() != 'not created':
                    halt_and_destroy()

            if provider:
                options = ' --provider %s' % provider
            else:
                options = ''

            # Spin up the box
            # (retry as it sometimes fails for no good reason)
            cmd = 'vagrant up%s' % options
            local('%s || %s' % (cmd, cmd))
    def start_box(self):
        """
        Spin up a new vagrant box
        """

        # Support for Vagrant 1.1 providers
        if ':' in self.current_box:
            box_name, provider = self.current_box.split(':', 1)
        else:
            box_name = self.current_box
            provider = None

        with lcd(os.path.dirname(__file__)):

            if not os.path.exists('Vagrantfile') \
               or not os.environ.get('FABTOOLS_TEST_NODESTROY'):

                # Create a fresh vagrant config file
                local('rm -f Vagrantfile')
                local('vagrant init %s' % box_name)

                # Clean up
                if status() != 'not created':
                    halt_and_destroy()

            if provider:
                options = ' --provider %s' % provider
            else:
                options = ''

            # Spin up the box
            # (retry as it sometimes fails for no good reason)
            cmd = 'vagrant up%s' % options
            local('%s || %s' % (cmd, cmd))
Example #3
0
 def test_status(self):
     with patch('fabtools.vagrant._status') as mock_status:
         mock_status.return_value = [('default', 'running')]
         from fabtools.vagrant import status
         self.assertEqual(status(), 'running')
Example #4
0
 def test_status(self):
     with patch('fabtools.vagrant._status') as mock_status:
         mock_status.return_value = [('default', 'running')]
         from fabtools.vagrant import status
         self.assertEqual(status(), 'running')