feat(stagging): rename hypervisor sheet and add VM specifications
This commit is contained in:
@@ -27,7 +27,7 @@ function Read-KisWorkbook([string]$Path) {
|
||||
}) }
|
||||
$sheets = @{}
|
||||
foreach ($sheet in $book.SelectNodes('//*[local-name()="sheet"]')) {
|
||||
if ($sheet.GetAttribute('name') -notin @('Staging','Server')) { continue }
|
||||
if ($sheet.GetAttribute('name') -notin @('Staging','Server','Virtualisierer')) { continue }
|
||||
$rid = $sheet.GetAttribute('id','http://schemas.openxmlformats.org/officeDocument/2006/relationships')
|
||||
$rel = @($rels.SelectNodes('//*[local-name()="Relationship"]') | Where-Object { $_.GetAttribute('Id') -eq $rid })
|
||||
if ($rel.Count -ne 1) { throw 'Ungueltige XLSX-Beziehung' }
|
||||
@@ -47,9 +47,12 @@ function Read-KisWorkbook([string]$Path) {
|
||||
$cells[$address] = [string]$value
|
||||
if ($cell.SelectSingleNode('./*[local-name()="f"]')) { $formulas[$address] = $true }
|
||||
}
|
||||
$sheets[$sheet.GetAttribute('name')] = @{ Cells=$cells; Formulas=$formulas }
|
||||
$sheetKey=$sheet.GetAttribute('name')
|
||||
if ($sheetKey -eq 'Virtualisierer') { $sheetKey='Server' }
|
||||
if ($sheets.ContainsKey($sheetKey)) { throw 'Workbook darf nicht gleichzeitig Server und Virtualisierer enthalten.' }
|
||||
$sheets[$sheetKey] = @{ Cells=$cells; Formulas=$formulas }
|
||||
}
|
||||
if (-not $sheets.ContainsKey('Staging') -or -not $sheets.ContainsKey('Server')) { throw 'KIS-Workbook mit Staging und Server erforderlich.' }
|
||||
if (-not $sheets.ContainsKey('Staging') -or -not $sheets.ContainsKey('Server')) { throw 'KIS-Workbook mit Staging und Virtualisierer erforderlich (altes Blatt Server wird ebenfalls gelesen).' }
|
||||
$settings = @{}
|
||||
foreach ($key in $sheets.Staging.Cells.Keys) {
|
||||
if ($key -notmatch '^A(\d+)$') { continue }
|
||||
@@ -65,7 +68,7 @@ function Read-KisWorkbook([string]$Path) {
|
||||
$expected = @('Installieren','Servername','PXE-MAC-Adresse','System','Version','Installationsdatenträger','Ziel-IP','Präfix','Gateway','DNS-Server','Benutzername','Hinweis')
|
||||
for ($i=0; $i -lt $expected.Count; $i++) {
|
||||
$col = [string][char](65+$i)
|
||||
if ($sheets.Server.Cells["${col}6"] -cne $expected[$i]) { throw "Server!${col}6: Erwartet '$($expected[$i])'. KIS Schema 0.2 erforderlich." }
|
||||
if ($sheets.Server.Cells["${col}6"] -cne $expected[$i]) { throw "Virtualisierer!${col}6: Erwartet '$($expected[$i])'. KIS-Spaltenstruktur erforderlich." }
|
||||
}
|
||||
foreach ($key in $sheets.Server.Cells.Keys) {
|
||||
if ($key -match '^A(\d+)$' -and [int]$Matches[1] -gt 26 -and $sheets.Server.Cells[$key] -eq 'JA') { throw 'Server ausserhalb der 20 vorbereiteten Zeilen. Bereich zuerst erweitern.' }
|
||||
@@ -75,11 +78,11 @@ function Read-KisWorkbook([string]$Path) {
|
||||
$values = @{}
|
||||
for ($i=0; $i -lt $expected.Count; $i++) {
|
||||
$cell = "$([char](65+$i))$r"
|
||||
if ($sheets.Server.Formulas.ContainsKey($cell)) { throw "Server!${cell}: Eingabeformeln sind nicht erlaubt." }
|
||||
if ($sheets.Server.Formulas.ContainsKey($cell)) { throw "Virtualisierer!${cell}: Eingabeformeln sind nicht erlaubt." }
|
||||
$values[$expected[$i]] = ([string]$sheets.Server.Cells[$cell]).Trim()
|
||||
}
|
||||
if ($sheets.Server.Cells['N6'] -eq 'PXE-IP') {
|
||||
if ($sheets.Server.Formulas.ContainsKey("N$r")) { throw "Server!N${r}: Eingabeformeln sind nicht erlaubt." }
|
||||
if ($sheets.Server.Formulas.ContainsKey("N$r")) { throw "Virtualisierer!N${r}: Eingabeformeln sind nicht erlaubt." }
|
||||
$values['PXE-IP']=([string]$sheets.Server.Cells["N$r"]).Trim()
|
||||
}
|
||||
if ($values.Installieren -notin @('','JA','NEIN')) { throw "Server Zeile ${r}: Installieren muss JA oder NEIN sein." }
|
||||
|
||||
Reference in New Issue
Block a user