fix: 修复 Ubuntu Netplan static/dhcp 模式缺少 ethernets 层导致 netplan apply 报错
接口名直接挂在 network: 下导致 'unknown key' 错误, 现在正确放在 ethernets: 下面。
This commit is contained in:
@@ -250,15 +250,17 @@ export function generateNetworkUbuntuNetplan(config) {
|
||||
const body = [] // 每个元素是一行,已包含完整缩进
|
||||
|
||||
if (config.configType === 'static') {
|
||||
body.push(` ${config.interface}:`)
|
||||
body.push(...genIp(4))
|
||||
body.push(` ethernets:`)
|
||||
body.push(` ${config.interface}:`)
|
||||
body.push(...genIp(6))
|
||||
} else if (config.configType === 'dhcp') {
|
||||
body.push(` ${config.interface}:`)
|
||||
body.push(` dhcp4: true`)
|
||||
body.push(` ethernets:`)
|
||||
body.push(` ${config.interface}:`)
|
||||
body.push(` dhcp4: true`)
|
||||
if (dnsList.length > 0) {
|
||||
body.push(` nameservers:`)
|
||||
body.push(` addresses:`)
|
||||
for (const d of dnsList) body.push(` - ${d}`)
|
||||
body.push(` nameservers:`)
|
||||
body.push(` addresses:`)
|
||||
for (const d of dnsList) body.push(` - ${d}`)
|
||||
}
|
||||
} else if (config.configType === 'bond') {
|
||||
const slaves = String(config.bondSlaves || '').split(',').map((s) => s.trim()).filter(Boolean)
|
||||
|
||||
Reference in New Issue
Block a user