示例#1
0
文件: test_host.py 项目: mattmb/spoke
 def test_get_missing_next_free_uuid(self):
     """Retrieve missing next free uuid; raise NotFound"""
     next_uuid = SpokeHostUUID()
     next_uuid.delete()
     next_uuid.__init__()
     self.assertRaises(error.NotFound, next_uuid.get)
     next_uuid.create(self.next_uuid_start)
示例#2
0
文件: test_host.py 项目: mattmb/spoke
 def test_create_next_free_uuid_non_integer(self):
     """Create next free uuid with non integer; raise InputError."""
     next_uuid = SpokeHostUUID()
     next_uuid.delete()
     # Re init so it detects the delete
     next_uuid.__init__()
     next_uuid_start = 'three'
     self.assertRaises(error.InputError, next_uuid.create, next_uuid_start)
     next_uuid.create(self.next_uuid_start)
示例#3
0
文件: test_host.py 项目: mattmb/spoke
 def setUp(self):
     """Create test organisation and host."""
     org = SpokeOrg()
     org.create(self.org_name, self.org_children)
     next_uuid = SpokeHostUUID()
     next_uuid.create(self.next_uuid_start)
     host = SpokeHost(self.org_name)
     host.create(self.host_name, self.host_uuid, self.host_mem, 
                 self.host_cpu,  self.host_family, self.host_type,
                 self.host_storage_layout,self.host_network_layout,  
                 self.host_extra_opts)
示例#4
0
文件: host.py 项目: KrisSaxton/spoke
def uuid_create(start_uuid=None, get_mac=False):
    try:
        conf = _spoke_config(_salt_config('config'))
        uuid = SpokeHostUUID()
        result = uuid.create(start_uuid, get_mac)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
示例#5
0
文件: host.py 项目: KrisSaxton/spoke
def uuid_create(start_uuid=None, get_mac=False):
    try:
        conf = _spoke_config(_salt_config('config'))
        uuid = SpokeHostUUID()
        result = uuid.create(start_uuid, get_mac)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
示例#6
0
文件: host.py 项目: mattmb/spoke
def uuid_create(start_uuid=None, get_mac=False):
    try:       
        from spoke.lib.host import SpokeHostUUID
        uuid = SpokeHostUUID()
        result = uuid.create(start_uuid, get_mac)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
示例#7
0
文件: test_host.py 项目: mattmb/spoke
 def test_create_next_free_uuid(self):
     """Create next free uuid; return uuid as list."""
     next_uuid = SpokeHostUUID()
     next_uuid.delete()
     # Re init so it detects the delete
     next_uuid.__init__()
     result = next_uuid.create(self.next_uuid_start)
     expected_data = [1]
     self.assertEqual(result['data'], expected_data)
示例#8
0
文件: test_host.py 项目: mattmb/spoke
 def test_create_next_free_uuid_mac(self):
     """Create next free uuid + mac; return as tuple."""
     next_uuid = SpokeHostUUID()
     next_uuid.delete()
     # Re init so it detects the delete
     next_uuid.__init__()
     result = next_uuid.create(self.next_uuid_start, get_mac=True)
     expected_data = (1, '02:00:00:01:00:00')
     self.assertEqual(result['data'], expected_data)
示例#9
0
文件: host.py 项目: mattmb/spoke
def uuid_create(start_uuid=None, get_mac=False):
    try:
        from spoke.lib.host import SpokeHostUUID

        uuid = SpokeHostUUID()
        result = uuid.create(start_uuid, get_mac)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result