예제 #1
0
class MultiInstallTestCase(unittest.TestCase):
    def setUp(self):
        with NamedTemporaryFile(mode='w+', encoding='utf-8') as tempf:
            # Override config file to save to
            self.conf = Config({}, tempf.name)

        dc = MagicMock(name="display_controller")
        loop = MagicMock(name="loop")
        self.installer = MultiInstall(loop, dc, self.conf)

    @patch('cloudinstall.utils.get_command_output')
    def test_add_bootstrap_to_no_proxy(self, mock_gco):
        minyaml = "machines: {\"0\": {\"dns-name\": \"100.100.100.100\"}}"
        current_env = "maas-server.ip"
        mock_gco.side_effect = [
            dict(status=0, output=minyaml),
            dict(status=0, output=current_env),
            dict(status=0, output='ignore')
        ]
        with patch.object(self.conf, 'juju_home') as mock_jh:
            mock_jh.return_value = 'JH'
            self.installer.add_bootstrap_to_no_proxy()

        set_call_arg = ('JH juju set-env no-proxy='
                        '{},100.100.100.100'.format(current_env))
        expected = [
            call('JH juju status', timeout=None, user_sudo=True),
            call('JH juju get-env no-proxy', timeout=None, user_sudo=True),
            call(set_call_arg, timeout=None, user_sudo=True)
        ]
        self.assertEqual(mock_gco.mock_calls, expected)
class MultiInstallTestCase(unittest.TestCase):

    def setUp(self):
        with NamedTemporaryFile(mode='w+', encoding='utf-8') as tempf:
            # Override config file to save to
            self.conf = Config({}, tempf.name)

        dc = MagicMock(name="display_controller")
        loop = MagicMock(name="loop")
        self.installer = MultiInstall(loop, dc, self.conf)

    @patch('cloudinstall.utils.get_command_output')
    def test_add_bootstrap_to_no_proxy(self, mock_gco):
        minyaml = "machines: {\"0\": {\"dns-name\": \"100.100.100.100\"}}"
        current_env = "maas-server.ip"
        mock_gco.side_effect = [dict(status=0, output=minyaml),
                                dict(status=0, output=current_env),
                                dict(status=0, output='ignore')]
        with patch.object(self.conf, 'juju_home') as mock_jh:
            mock_jh.return_value = 'JH'
            self.installer.add_bootstrap_to_no_proxy()

        set_call_arg = ('JH juju set-env no-proxy='
                        '{},100.100.100.100'.format(current_env))
        expected = [call('JH juju status', timeout=None, user_sudo=True),
                    call('JH juju get-env no-proxy', timeout=None,
                         user_sudo=True),
                    call(set_call_arg,
                         timeout=None, user_sudo=True)]
        self.assertEqual(mock_gco.mock_calls, expected)
예제 #3
0
    def setUp(self):
        with NamedTemporaryFile(mode='w+', encoding='utf-8') as tempf:
            # Override config file to save to
            self.conf = Config({}, tempf.name)

        dc = MagicMock(name="display_controller")
        loop = MagicMock(name="loop")
        self.installer = MultiInstall(loop, dc, self.conf)
    def setUp(self):
        with NamedTemporaryFile(mode='w+', encoding='utf-8') as tempf:
            # Override config file to save to
            self.conf = Config({}, tempf.name)

        dc = MagicMock(name="display_controller")
        loop = MagicMock(name="loop")
        self.installer = MultiInstall(loop, dc, self.conf)
 def _do_install_existing_maas(self):
     """ Performs the landscape deployment with existing MAAS
     """
     if self.config.getopt('headless'):
         MultiInstall(self.loop, self.display_controller, self.config,
                      self.landscape_tasks).do_install()
     else:
         MultiInstallExistingMaas(self.loop,
                                  self.display_controller,
                                  self.config,
                                  post_tasks=self.landscape_tasks).run()