Files
michaelschiemer/.deployment-backup/x_ansible/check_yaml.sh
Michael Schiemer 9b74ade5b0 feat: Fix discovery system critical issues
Resolved multiple critical discovery system issues:

## Discovery System Fixes
- Fixed console commands not being discovered on first run
- Implemented fallback discovery for empty caches
- Added context-aware caching with separate cache keys
- Fixed object serialization preventing __PHP_Incomplete_Class

## Cache System Improvements
- Smart caching that only caches meaningful results
- Separate caches for different execution contexts (console, web, test)
- Proper array serialization/deserialization for cache compatibility
- Cache hit logging for debugging and monitoring

## Object Serialization Fixes
- Fixed DiscoveredAttribute serialization with proper string conversion
- Sanitized additional data to prevent object reference issues
- Added fallback for corrupted cache entries

## Performance & Reliability
- All 69 console commands properly discovered and cached
- 534 total discovery items successfully cached and restored
- No more __PHP_Incomplete_Class cache corruption
- Improved error handling and graceful fallbacks

## Testing & Quality
- Fixed code style issues across discovery components
- Enhanced logging for better debugging capabilities
- Improved cache validation and error recovery

Ready for production deployment with stable discovery system.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 12:04:17 +02:00

76 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# Skript zur Überprüfung der YAML-Syntax in Ansible-Dateien
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Farbdefinitionen
GREEN="\033[0;32m"
YELLOW="\033[1;33m"
RED="\033[0;31m"
NC="\033[0m" # No Color
echo -e "${GREEN}=== Überprüfe YAML-Syntax in Ansible-Dateien ===${NC}\n"
# Fehler-Zähler
errors=0
# Prüfe alle .yml-Dateien im Ansible-Verzeichnis
find "$SCRIPT_DIR" -name "*.yml" | sort | while read -r file; do
# Überspringe bestimmte Verzeichnisse
if [[ "$file" == *"/templates/"* ]]; then
continue
fi
echo -e "Prüfe: ${YELLOW}$(basename "$file")${NC} (${file})"
# Prüfe ob die Datei leer ist
if [ ! -s "$file" ]; then
echo -e " ${YELLOW}Warnung: Datei ist leer${NC}"
continue
fi
# Überprüfung mit ansible-playbook syntax-check
if grep -q "^---" "$file"; then
ansible-playbook --syntax-check "$file" &>/dev/null
if [ $? -ne 0 ]; then
echo -e " ${RED}Fehler: Syntax-Fehler in der Datei${NC}"
echo -e " Detaillierte Prüfung:"
ansible-playbook --syntax-check "$file"
errors=$((errors+1))
continue
fi
fi
# Überprüfung mit yamllint
if command -v yamllint &>/dev/null; then
yamllint -d relaxed "$file" &>/dev/null
if [ $? -ne 0 ]; then
echo -e " ${YELLOW}Warnung: yamllint hat Probleme gefunden${NC}"
yamllint -d relaxed "$file"
fi
fi
# Überprüfung auf mehrere YAML-Dokumente
doc_count=$(grep -c "^---" "$file")
if [ "$doc_count" -gt 1 ]; then
echo -e " ${RED}Fehler: Mehrere YAML-Dokumente in einer Datei (${doc_count} Dokumente)${NC}"
echo -e " Betroffene Zeilen:"
grep -n "^---" "$file"
errors=$((errors+1))
fi
# Wenn alles ok ist
if [ "$errors" -eq 0 ]; then
echo -e " ${GREEN}✓ OK${NC}"
fi
done
if [ "$errors" -gt 0 ]; then
echo -e "\n${RED}Fehler gefunden! $errors Dateien haben Probleme.${NC}"
echo -e "Bitte korrigieren Sie die YAML-Syntax-Fehler, bevor Sie fortfahren."
exit 1
else
echo -e "\n${GREEN}Alle YAML-Dateien haben die Syntax-Prüfung bestanden!${NC}"
exit 0
fi