-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_simple_sync.sh
More file actions
executable file
·99 lines (82 loc) · 2.68 KB
/
debug_simple_sync.sh
File metadata and controls
executable file
·99 lines (82 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
# Debug the simple sync to see what's failing
# Load configuration
if [ -f "config.env" ]; then
source config.env
else
echo "Error: config.env file not found. Please copy config.env.example to config.env and update with your values."
exit 1
fi
echo "=== Debugging Simple Sync Issues ==="
echo ""
echo "1. Testing basic SSH connectivity..."
echo "Host -> VM1:"
if ssh $SSH_OPTS $VM_USER@$VM1_IP "echo 'SSH to VM1 works'"; then
echo "✅ SSH to VM1 successful"
else
echo "❌ SSH to VM1 failed"
fi
echo ""
echo "Host -> VM2:"
if ssh $SSH_OPTS $VM_USER@$VM2_IP "echo 'SSH to VM2 works'"; then
echo "✅ SSH to VM2 successful"
else
echo "❌ SSH to VM2 failed"
fi
echo ""
echo "2. Testing Python3 availability..."
echo "VM1 Python3:"
ssh $SSH_OPTS $VM_USER@$VM1_IP "python3 --version"
echo ""
echo "VM2 Python3:"
ssh $SSH_OPTS $VM_USER@$VM2_IP "python3 --version"
echo ""
echo "3. Testing package listing commands..."
echo "VM1 package count:"
ssh $SSH_OPTS $VM_USER@$VM1_IP "rpm -qa | wc -l"
echo ""
echo "VM2 package count:"
ssh $SSH_OPTS $VM_USER@$VM2_IP "rpm -qa | wc -l"
echo ""
echo "4. Testing the remote package command directly..."
echo "Getting VM2 packages from VM1:"
ssh $SSH_OPTS $VM_USER@$VM1_IP << 'EOF'
echo "Running remote command to get VM2 packages..."
ssh $SSH_OPTS $VM_USER@$VM2_IP "rpm -qa --qf '%{NAME}\n' | head -5"
EOF
echo ""
echo "5. Testing file creation and permissions..."
echo "VM1 home directory:"
ssh $SSH_OPTS $VM_USER@$VM1_IP "ls -la ~/ | head -5"
echo ""
echo "VM2 home directory:"
ssh $SSH_OPTS $VM_USER@$VM2_IP "ls -la ~/ | head -5"
echo ""
echo "6. Running a simple test of the sync script..."
echo "Copying and testing RPM_sync_simple.py on VM1:"
scp $SSH_OPTS RPM_sync_simple.py $VM_USER@$VM1_IP:~/
ssh $SSH_OPTS $VM_USER@$VM1_IP << 'EOF'
cd ~
echo "Testing RPM_sync_simple.py with verbose output..."
python3 -c "
import subprocess
import sys
print('Testing basic package listing...')
try:
result = subprocess.run(['rpm', '-qa', '--qf', '%{NAME}\n'], capture_output=True, text=True, check=True)
packages = result.stdout.strip().split('\n')
print(f'Found {len(packages)} packages locally')
print('First 5 packages:', packages[:5])
except Exception as e:
print(f'Error: {e}')
print('\nTesting remote SSH command...')
try:
result = subprocess.run(['ssh', '$SSH_OPTS', '$VM_USER@$VM2_IP', 'rpm -qa --qf \"%{NAME}\\n\" | head -5'], capture_output=True, text=True, check=True)
print('Remote command output:', result.stdout.strip())
except Exception as e:
print(f'Remote SSH error: {e}')
print('stderr:', e.stderr if hasattr(e, 'stderr') else 'No stderr')
"
EOF
echo ""
echo "=== Debug complete ==="