Example #1
0
 def test_yields_nothing_when_machine_install_rackd_false(self):
     node = factory.make_Node(osystem="ubuntu", netboot=False)
     node.install_rackd = False
     configuration = generate_rack_controller_configuration(
         node, proxy="http://proxy.example.com/"
     )
     self.assertThat(dict(configuration), Equals({}))
Example #2
0
 def test_yields_nothing_when_node_is_not_ubuntu(self):
     tag = factory.make_Tag(name="switch")
     node = factory.make_Node(osystem="centos", netboot=False)
     node.tags.add(tag)
     configuration = generate_rack_controller_configuration(
         node, proxy="http://proxy.example.com/")
     self.assertThat(dict(configuration), Equals({}))
Example #3
0
    def test_yields_configuration_when_machine_install_rackd_true(self):
        node = factory.make_Node(osystem="ubuntu", netboot=False)
        node.install_rackd = True
        proxy = "http://proxy.example.com/"
        configuration = generate_rack_controller_configuration(
            node, proxy=proxy
        )
        secret = "1234"
        Config.objects.set_config("rpc_shared_secret", secret)
        channel = version.get_maas_version_track_channel()
        maas_url = "http://%s:5240/MAAS" % get_maas_facing_server_host(
            node.get_boot_rack_controller()
        )
        cmd = "/bin/snap/maas init --mode rack"

        self.assertThat(
            dict(configuration),
            KeysEqual(
                {
                    "runcmd": [
                        "snap set system proxy.http=%s proxy.https=%s"
                        % (proxy, proxy),
                        f"snap install maas --channel={channel}",
                        "%s --maas-url %s --secret %s"
                        % (cmd, maas_url, secret),
                    ]
                }
            ),
        )
Example #4
0
    def test_yields_configuration_with_ubuntu(self):
        tag = factory.make_Tag(name="wedge100")
        node = factory.make_Node(osystem="ubuntu", netboot=False)
        node.tags.add(tag)
        configuration = generate_rack_controller_configuration(
            node, proxy="http://proxy.example.com/"
        )
        secret = "1234"
        Config.objects.set_config("rpc_shared_secret", secret)
        channel = version.get_maas_version_track_channel()
        maas_url = "http://%s:5240/MAAS" % get_maas_facing_server_host(
            node.get_boot_rack_controller()
        )
        cmd = "/bin/snap/maas init --mode rack"

        self.assertThat(
            dict(configuration),
            KeysEqual(
                {
                    "runcmd": [
                        f"snap install maas --channel={channel}",
                        "%s --maas-url %s --secret %s"
                        % (cmd, maas_url, secret),
                    ]
                }
            ),
        )
Example #5
0
    def test_yields_configuration_when_machine_install_rackd_true(self):
        node = factory.make_Node(osystem='ubuntu', netboot=False)
        node.install_rackd = True
        configuration = generate_rack_controller_configuration(node)

        secret = '1234'
        Config.objects.set_config("rpc_shared_secret", secret)
        channel = version.get_maas_version_track_channel()
        maas_url = "http://%s:5240/MAAS" % get_maas_facing_server_host(
            node.get_boot_rack_controller())
        cmd = "/bin/snap/maas init --mode rack"

        self.assertThat(
            dict(configuration),
            KeysEqual({
                "runcmd": [
                    "snap install maas --devmode --channel=%s" % channel,
                    "%s --maas-url %s --secret %s" % (cmd, maas_url, secret),
                ]
            }))
Example #6
0
 def test_yields_configuration_when_machine_install_rackd_true(self):
     controller = factory.make_RackController()
     ControllerInfo.objects.set_version(controller, "3.0.0-123-g.abc")
     node = factory.make_Node(
         osystem="ubuntu", netboot=False, install_rackd=True
     )
     configuration = generate_rack_controller_configuration(node)
     secret = "1234"
     Config.objects.set_config("rpc_shared_secret", secret)
     maas_url = "http://%s:5240/MAAS" % get_maas_facing_server_host(
         node.get_boot_rack_controller()
     )
     self.assertEqual(
         list(configuration),
         [
             (
                 "runcmd",
                 [
                     "snap install maas --channel=3.0/stable",
                     f"/snap/bin/maas init rack --maas-url {maas_url} --secret {secret}",
                 ],
             ),
         ],
     )
Example #7
0
 def test_yields_nothing_when_node_is_not_netboot_disabled(self):
     configuration = generate_rack_controller_configuration(
         node=factory.make_Node(osystem="ubuntu"),
         proxy="http://proxy.example.com/",
     )
     self.assertThat(dict(configuration), Equals({}))
Example #8
0
 def test_yields_nothing_when_node_is_not_ubuntu(self):
     tag = factory.make_Tag(name='switch')
     node = factory.make_Node(osystem='centos', netboot=False)
     node.tags.add(tag)
     configuration = generate_rack_controller_configuration(node)
     self.assertThat(dict(configuration), Equals({}))
Example #9
0
 def test_yields_nothing_when_node_is_not_netboot_disabled(self):
     configuration = generate_rack_controller_configuration(
         node=factory.make_Node(osystem='ubuntu'))
     self.assertThat(dict(configuration), Equals({}))
Example #10
0
 def test_yields_nothing_when_machine_install_rackd_false(self):
     node = factory.make_Node(
         osystem="ubuntu", netboot=False, install_rackd=False
     )
     configuration = generate_rack_controller_configuration(node)
     self.assertEqual(list(configuration), [])
Example #11
0
 def test_yields_nothing_when_node_is_not_ubuntu(self):
     node = factory.make_Node(
         osystem="centos", netboot=False, install_rackd=True
     )
     configuration = generate_rack_controller_configuration(node)
     self.assertEqual(list(configuration), [])
Example #12
0
 def test_yields_nothing_when_node_is_not_netboot_disabled(self):
     node = factory.make_Node(osystem="ubuntu", install_rackd=True)
     configuration = generate_rack_controller_configuration(
         node=node,
     )
     self.assertEqual(list(configuration), [])
Example #13
0
 def test_yields_nothing_when_machine_install_rackd_false(self):
     node = factory.make_Node(osystem='ubuntu', netboot=False)
     node.install_rackd = False
     configuration = generate_rack_controller_configuration(node)
     self.assertThat(dict(configuration), Equals({}))