# -*- sh -*-
## vim:ft=zsh:foldmethod=marker

if ! [ -d ~/finn/puppetroot ]; then
    echo "No puppetroot checkout, can't proceed"
    return
fi
(
    cd ~/finn/puppetroot
    printf "FINNHOSTS=( "
    ( source venv/bin/activate ; source set-puppetroot-env ; puppetroot inventory --monochrome | awk '{print $1}' | tr '\n' ' ')
    printf ")\n"
    printf 'hosts=( $FINNHOSTS $hosts )\n'
    printf "zstyle ':completion:*:hosts' hosts \$hosts\n"
) > ~/.zshrc.d/60_finnhosts

. ~/.zshrc.d/60_finnhosts
