示例#1
0
 def test_render_validate_normal(self):
     cloud_init = CloudInit()
     error = self.assertRaises(CloudInitError, cloud_init.render)
     self.assertEquals(
         str(error),
         "Incomplete cloud-init: you need to call add_ssh_key, "
         "set_machine_id, set_provider_type, set_zookeeper_machines")
示例#2
0
 def test_render_validate_bootstrap(self):
     cloud_init = CloudInit()
     cloud_init.enable_bootstrap()
     error = self.assertRaises(CloudInitError, cloud_init.render)
     self.assertEquals(
         str(error),
         "Incomplete cloud-init: you need to call add_ssh_key, "
         "set_machine_id, set_provider_type, set_instance_id_accessor, "
         "set_zookeeper_secret")
示例#3
0
 def construct_normal(self):
     cloud_init = CloudInit()
     cloud_init.add_ssh_key("chubb")
     cloud_init.set_machine_id("passport")
     cloud_init.set_provider_type("dummy")
     cloud_init.set_zookeeper_machines([
         DummyMachine("blah", "blah", "cotswold"),
         DummyMachine("blah", "blah", "longleat")])
     return cloud_init
示例#4
0
 def test_source_validate(self):
     bad_choices = (
         (None,      False, False),
         (None,      True,  True),
         ("lp:blah", True,  True),
         ("lp:blah", False, True),
         ("lp:blah", True,  False))
     cloud_init = CloudInit()
     for choice in bad_choices:
         error = self.assertRaises(
             CloudInitError, cloud_init.set_juju_source, *choice)
         self.assertEquals(str(error), "Please specify one source")
示例#5
0
 def construct_bootstrap(self, with_zookeepers=False):
     cloud_init = CloudInit()
     cloud_init.enable_bootstrap()
     cloud_init.add_ssh_key("chubb")
     cloud_init.set_machine_id("passport")
     cloud_init.set_provider_type("dummy")
     cloud_init.set_instance_id_accessor("token")
     cloud_init.set_zookeeper_secret("seekrit")
     cloud_init.set_juju_source(distro=True)
     if with_zookeepers:
         cloud_init.set_zookeeper_machines([
             DummyMachine("blah", "blah", "cotswold"),
             DummyMachine("blah", "blah", "longleat")])
     return cloud_init