Skip to content

Commit 2db5a72

Browse files
authored
Merge pull request #152 from syhgorath/fix/onboard-srv-get-ve-boru
Sunucu ekleme: SSHModule.sh yüklenir, describe borusu BrokenPipe basmaz
2 parents eccd48a + 49a1878 commit 2db5a72

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Biçim [Keep a Changelog](https://keepachangelog.com/) esas alınmıştır.
44

55
## [Unreleased]
66

7+
### Düzeltildi
8+
- **Sunucu eklerken CIDR editörü:** `ModuleGenerator.sh` `SSHModule.sh`'yi yüklemediği için sunucu bilgileri (IP/port/kullanıcı/anahtar) okunamıyor ve "_ssh_env_get: command not found" yazıyordu; ayrıca değişken türü sorgusu Python'a BrokenPipe izi bastırabiliyordu. İkisi de giderildi (test eklendi).
9+
710
### Eklendi
811
- **Eylem düzeyi `requires_vars` (isteğe bağlı manifest alanı):** bir eylem, listedeki değişken değerler dosyasında boş/yoksa ssh'a gitmeden "⛔ çalıştırılmadı: değeri boş değişken: …" ile reddedilir; menüde eylem kartında ⛔ ve "Boş: …" ipucu görünür. Yalnızca o eylemleri kapatır (`audit`, `rollback_*` etkilenmez); alan yoksa davranış değişmez. Amaç: erişim kısıtını (örn. `hardening_ssh_allow_from`) boş bırakıp kendini dışarıda bırakmayı önlemek.
912
- **Manifest: `platform_choices` / `onboarding_vars` okunur ve doğrulanır** (sunucu eklerken platform seçimi için hazırlık; seçim ekranı ve `apply_vars` uygulaması sonraki PR'larda). Alan yoksa davranış değişmez; bozuksa paket kilide yazılmaz. Tasarım: `docs/sunucu-ekleme-platform-secimi.md`.

‎sistem/Helpers/ComponentsOnboard.sh‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ comp_onboard_ids() {
2626

2727
# _comp_onboard_var_type <manifest> <değişken> → tür (örn. list[cidr])
2828
_comp_onboard_var_type() {
29-
comp_vars_describe "$1" | awk -F'\t' -v n="$2" '$1 == n { print $2; exit }'
29+
# awk'ı erken bitirmek (exit) python'a BrokenPipe izi bastırırdı: çıktı tamamen okunur
30+
comp_vars_describe "$1" | awk -F'\t' -v n="$2" '$1 == n && !d { print $2; d=1 }'
3031
}
3132

3233
# _comp_onboard_ask_platform <bilgi> → seçilen platform kimliği (stdout); "" = şimdi değil (hiçbir şey yazılmaz). Menü stderr'e yazılır.
@@ -106,7 +107,7 @@ _comp_onboard_vars() {
106107
COMP_MENU_DIR="$dir"
107108
comp_menu_edit_cidr "$n" "$server" || true
108109
else
109-
echo "$n — $(comp_vars_describe "$mf" | awk -F'\t' -v n="$n" '$1 == n { print $NF; exit }')"
110+
echo "$n — $(comp_vars_describe "$mf" | awk -F'\t' -v n="$n" '$1 == n && !d { print $NF; d=1 }')"
110111
IFS= read -r -p "Değer (boş = atla): " v || return 1
111112
if [ -n "$v" ]; then
112113
if out=$(comp_vars_check "$mf" "$n" "$v" 2>&1); then comp_vars_set "$vf" "$n" "$v" && echo "✅ Kaydedildi: $n = $v"

‎sistem/ModuleGenerator.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ source "$SCRIPT_DIR/Helpers/ModuleFiles.sh"
1616
source "$SCRIPT_DIR/Helpers/Servers.sh"
1717
# shellcheck source=Helpers/SSHHelper.sh
1818
source "$SCRIPT_DIR/Helpers/SSHHelper.sh"
19+
# shellcheck source=Helpers/SSHModule.sh
20+
source "$SCRIPT_DIR/Helpers/SSHModule.sh"
1921
# Paket platformu / zorunlu ayar soruları (manifestinde platform_choices olan paket yoksa hiçbir şey sorulmaz)
2022
for _f in Components ComponentsInstall ComponentsManifest ComponentsRun ComponentsVars ComponentsMenu ComponentsOnboard; do
2123
# shellcheck source=/dev/null

‎test/components_onboard.bats‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ CHOICES=',"platform_choices":[{"id":"generic","label":"Debian / Ubuntu"},{"id":"
100100
bash "$ROOT/sistem/ModuleGenerator.sh" <<< $'web9\n192.0.2.9\ndeploy\n\nn\n2\n\ne\n10.1.10.0/24\nk\n\n\n'
101101
[ "$status" -eq 0 ]
102102
[[ "$output" == *"sunucu türü ve zorunlu ayarlar"* && "$output" == *"Sunucu oluşturuldu"* ]] || { echo "$output"; false; }
103+
[[ "$output" != *"command not found"* && "$output" != *Traceback* ]] || { echo "$output"; false; }
103104
[ "$(comp_vars_get "$T/srv2/web9/demo.vars" demo_platform)" = proxmox-host ]
104105
[ "$(comp_vars_get "$T/srv2/web9/demo.vars" allow_from)" = 10.1.10.0/24 ]
105106
# paket kurulu değil: soru çıkmaz, sunucu yine oluşur

0 commit comments

Comments
 (0)