示例#1
0
文件: host.py 项目: KrisSaxton/spoke
def uuid_reserve(qty=1, get_mac=False):
    try:
        conf = _spoke_config(_salt_config('config'))
        uuid = SpokeHostUUID()
        result = uuid.modify(qty, get_mac)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
示例#2
0
文件: host.py 项目: KrisSaxton/spoke
def uuid_reserve(qty=1, get_mac=False):
    try:
        conf = _spoke_config(_salt_config('config'))
        uuid = SpokeHostUUID()
        result = uuid.modify(qty, get_mac)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
示例#3
0
文件: host.py 项目: mattmb/spoke
def uuid_reserve(qty=1, get_mac=False):
    try:
        from spoke.lib.host import SpokeHostUUID
        uuid = SpokeHostUUID()
        result = uuid.modify(qty, get_mac)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
示例#4
0
 def test_increment_and_get_multiple_next_free_uuid_and_mac(self):
     """Get next 4 free uuids and macs; return uuids as list of integers."""
     next_uuid = SpokeHostUUID()
     result = next_uuid.modify(4, get_mac=True)
     expected_data = ([1, 2, 3, 4], [
         '02:00:00:01:00:00', '02:00:00:02:00:00', '02:00:00:03:00:00',
         '02:00:00:04:00:00'
     ])
     self.assertEquals(result['data'], expected_data)
示例#5
0
文件: host.py 项目: mattmb/spoke
def uuid_reserve(qty=1, get_mac=False):
    try:
        from spoke.lib.host import SpokeHostUUID

        uuid = SpokeHostUUID()
        result = uuid.modify(qty, get_mac)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
示例#6
0
文件: test_host.py 项目: mattmb/spoke
 def test_increment_and_get_multiple_next_free_uuid_and_mac(self):
     """Get next 4 free uuids and macs; return uuids as list of integers."""
     next_uuid = SpokeHostUUID()
     result = next_uuid.modify(4, get_mac=True)
     expected_data = ([1, 2, 3, 4], ['02:00:00:01:00:00', '02:00:00:02:00:00', '02:00:00:03:00:00', '02:00:00:04:00:00'])
     self.assertEquals(result['data'], expected_data)
示例#7
0
文件: test_host.py 项目: mattmb/spoke
 def test_increment_and_get_multiple_next_free_uuid(self):
     """Get next 4 free uuids; return uuids as list of integers."""
     next_uuid = SpokeHostUUID()
     result = next_uuid.modify(4)
     expected_data = [1, 2, 3, 4]
     self.assertEquals(result['data'], expected_data)
示例#8
0
文件: test_host.py 项目: mattmb/spoke
 def test_update_and_get_next_free_uuid_mac(self):
     """Get next free uuid and mac; return as tuple."""
     next_uuid = SpokeHostUUID()
     result = next_uuid.modify(get_mac=True)
     expected_data = ([1], ['02:00:00:01:00:00'])
     self.assertEquals(result['data'], expected_data)
示例#9
0
文件: test_host.py 项目: mattmb/spoke
 def test_update_and_get_next_free_uuid(self):
     """Get next free uuid; return uuid as list."""
     next_uuid = SpokeHostUUID()
     result = next_uuid.modify()
     expected_data = [1]
     self.assertEquals(result['data'], expected_data)