зеркало из https://github.com/Azure/ipam.git
Fixed minor bugs with externals refreshing after updates and validating proper CIDRs
This commit is contained in:
Родитель
76b55575ee
Коммит
84b65c6795
|
@ -1456,6 +1456,9 @@ async def create_external_network(
|
|||
if external.name in [x['name'] for x in target_block['externals']]:
|
||||
raise HTTPException(status_code=400, detail="External network name already exists in block.")
|
||||
|
||||
if str(IPNetwork(external.cidr).cidr) != external.cidr:
|
||||
raise HTTPException(status_code=400, detail="External network cidr invalid, should be {}".format(IPNetwork(external.cidr).cidr))
|
||||
|
||||
net_list = await get_network(authorization, True)
|
||||
|
||||
ext_cidr_in_block = IPNetwork(external.cidr) in IPNetwork(target_block['cidr'])
|
||||
|
@ -1685,6 +1688,9 @@ async def create_external_subnet(
|
|||
if req.name in [x['name'] for x in target_external['subnets']]:
|
||||
raise HTTPException(status_code=400, detail="Subnet name already exists in external network.")
|
||||
|
||||
if str(IPNetwork(req.cidr).cidr) != req.cidr:
|
||||
raise HTTPException(status_code=400, detail="External subnet cidr invalid, should be {}".format(IPNetwork(req.cidr).cidr))
|
||||
|
||||
subnet_cidrs = []
|
||||
|
||||
for s in (s for s in target_external['subnets']):
|
||||
|
|
|
@ -149,12 +149,11 @@ export default function Externals() {
|
|||
|
||||
React.useEffect(() => {
|
||||
if (externals && selectedExternal) {
|
||||
const externalIndex = externals.findIndex((x) => x.id === selectedExternal.id);
|
||||
const externalIndex = externals.findIndex((x) => x.name === selectedExternal.name);
|
||||
|
||||
if (externalIndex > -1) {
|
||||
if (!isEqual(externals[externalIndex], selectedExternal)) {
|
||||
setSelectedExternal(externals[externalIndex]);
|
||||
setSubnets(externals[externalIndex].subnets);
|
||||
}
|
||||
} else {
|
||||
setSelectedExternal(null);
|
||||
|
@ -164,7 +163,7 @@ export default function Externals() {
|
|||
|
||||
React.useEffect(() => {
|
||||
if (subnets && selectedSubnet) {
|
||||
const subnetIndex = subnets.findIndex((x) => x.id === selectedSubnet.id);
|
||||
const subnetIndex = subnets.findIndex((x) => x.name === selectedSubnet.name);
|
||||
|
||||
if (subnetIndex > -1) {
|
||||
if (!isEqual(subnets[subnetIndex], selectedSubnet)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче