garethr / garethr-docker

Puppet module for managing docker
Apache License 2.0
397 stars 529 forks source link

unless in docker::exec not working for me #615

Open erikbotta opened 7 years ago

erikbotta commented 7 years ago
docker::exec { 'Start postfix':
  detach       => true,
  container    => 'zabbix-server',
  command      => 'postfix start',
  tty          => true,
  unless       => 'test -f /var/spool/postfix/pid/master.pid',
  }

But how to run it only once to run postfix ? I tried in unless : ls , test -e , test -f , ! test -f . It seems all of it is preventing to run docker::exec

gilesdring commented 7 years ago

I noticed this. The issue is that when running detached, the return code is always 0, even from the unless statement. Workaround: do not run detached.

Should probably unset detached for the unless test.