saltstack/salt — pull request #12283 by nielsek (2014-04-25 08:20:48+00:00)
Title: skip portsnap interactive check

This is the error i got running `ports.update`:

[INFO ] Executing command '/sbin/zfs help || :' in directory '/root'
[INFO ] Executing command '/sbin/zfs help || :' in directory '/root'
[INFO ] Executing command 'portsnap fetch' in directory '/root'
[ERROR ] Command 'portsnap fetch' failed with return code: 1
[ERROR ] stdout: portsnap fetch should not be run non-interactively.
Run portsnap cron instead
Error running 'ports.update': Unable to fetch ports snapshot:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell

Stdout from the command:

Stderr from the command:

[INFO ] Executing command '/sbin/zfs help || :' in directory '/root'
[INFO ] Executing command '/sbin/zfs help || :' in directory '/root'
[INFO ] Executing command 'portsnap fetch' in directory '/root'
[ERROR ] Command 'portsnap fetch' failed with return code: 1
[ERROR ] stdout: portsnap fetch should not be run non-interactively.
Run portsnap cron instead
Error running 'ports.update': Unable to fetch ports snapshot:

On FreeBSD 10 which im running, portsnap has a `--interactive` flag, that can be used in this case. This is what i have provided in the pull request.

In FreeBSD 9 portsnap has to be patched, but im not quite sure how to implement this.
Looking at this implementation - https://github.com/opscode-cookbooks/freebsd/blob/master/recipes/portsnap.rb#L25 - They are replacing `[ ! -t 0 ]` with `false` in the following section of portsnap:
cmd_fetch() {
if [ ! -t 0 ]; then
echo -n "`basename $0` fetch should not "
echo "be run non-interactively."
echo "Run `basename $0` cron instead."
exit 1
fi
fetch_check_params
fetch_run || exit 1
}