Sha256: e7bb037b7a60234ca1550253d0ae1a70ac3b973a83827db26f4ee322ce592a24

Contents?: true

Size: 1018 Bytes

Versions: 3

Compression:

Stored size: 1018 Bytes

Contents

module VagrantPlugins
  module Ventriloquist
    module Cap
      module Debian
        module VentriloquistContainersUpstart
          def self.ventriloquist_containers_upstart(machine)
            machine.communicate.tap do |comm|
              if ! comm.test('test -f /etc/init/ventriloquist.conf')
                machine.env.ui.info('Configuring Ventriloquist services upstart')
                machine.communicate.sudo '
cat<<EOF > /etc/init/ventriloquist.conf
description "Restart configured Ventriloquist services after reboot"

start on started docker

task

script
  if [ -d /var/lib/ventriloquist/cids ]; then
    sleep 1 # Give Docker some time
    for cidfile in \$(ls /var/lib/ventriloquist/cids/*); do
      cid=\$(cat \$cidfile)
      if ! \$(docker ps | grep -q \$cid); then
        docker start \$(cat \$cidfile)
      else
        echo "Container \${cid} already started"
      fi
    done
  fi
end script
EOF'
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ventriloquist-0.4.1 lib/ventriloquist/cap/services/debian/ventriloquist_containers_upstart.rb
ventriloquist-0.4.0 lib/ventriloquist/cap/services/debian/ventriloquist_containers_upstart.rb
ventriloquist-0.3.2 lib/ventriloquist/cap/debian/ventriloquist_containers_upstart.rb