mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-19 14:57:04 +00:00
chasquid-util: Use server for aliases-resolve and domaininfo-remove
This patch makes chasquid-util's aliases-resolve and domaininfo-remove commands talk to the chasquid server (via the new localrpc server). For aliases-resolve, currently has fairly hacky logic which reimplements a bunch of the servers', and is also incomplete because it does not support hooks. In this patch we fix that by having it talk to the server, where we get authoritative responses and have no issues with aliases hooks. This resolves https://github.com/albertito/chasquid/issues/18. For domaininfo-remove, currently its implementation is also very hacky since it manipulates files behind the servers' back and without even using the internal library. In this patch we fix that by doing the operation through the server, avoiding the need for those hacks, and also remove the need to manually reload the server afterwards.
This commit is contained in:
@@ -71,24 +71,6 @@ if r authenticate user@domain --password=passwd > /dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
touch '.data/domaininfo/s:dom%C3%A1in'
|
||||
if ! r domaininfo-remove domáin; then
|
||||
echo domaininfo-remove failed
|
||||
exit 1
|
||||
fi
|
||||
if [ -f '.data/domaininfo/s:dom%C3%A1in' ]; then
|
||||
echo domaininfo-remove did not remove file
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "alias: user@somewhere" > .config/domains/domain/aliases
|
||||
A=$(r aliases-resolve alias@domain | grep somewhere)
|
||||
if [ "$A" != "(email) user@somewhere" ]; then
|
||||
echo aliases-resolve failed
|
||||
echo output: "$A"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
C=$(r print-config | grep hostname)
|
||||
if ! ( echo "$C" | grep -E -q "hostname:.*\"$HOSTNAME\"" ); then
|
||||
echo print-config failed
|
||||
@@ -120,4 +102,13 @@ if r aliases-add alias4@domain > /dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run all the chamuyero tests.
|
||||
for i in *.cmy; do
|
||||
if ! chamuyero "$i" > "$i.log" 2>&1 ; then
|
||||
echo "# Test $i failed, log follows"
|
||||
cat "$i.log"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
success
|
||||
|
||||
Reference in New Issue
Block a user