gofmt whitespace tweaks

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Generate config per job in the scheduler

We were getting intermittent errors in the scheduler tests:

FAIL: scheduler_test.go:173: S.TestWatchFormations

scheduler_test.go:242:
    c.Assert(jobCount, Equals, u.jobCount()+1)
    ... obtained int = 3
    ... expected int = 2

The issue was that when multiple jobs of a given type were started as
part of a single formation update, they all got stored in the
FakeCluster as the same struct because they all used the same config,
so modifying config.ID when starting each job was affecting jobs already
added to the Fake Cluster.

This then meant that removing jobs would either not remove any jobs
because the given ID did not match the ID which all the jobs had (i.e.
the last ID which config.ID was set to), or it would remove all the jobs
because they all had the given ID.

Generating the config per job fixes this.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Update the scheduler to reconnect to the controller

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Set updated_at when removing a formation

This is so that it will appear as an update when Subscribing to
formation events since a particular time

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Drop comment from scheduler

Since we track the last update seen from the controller and request all
updates after that when reconnecting, there is no need to sync with the
cluster when reconnecting.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Simplify artifact uniqueness

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Close client after scheduler disconnect

Signed-off-by: Lewis Marshall <lewis@lmars.net>
Add client for Sampi's host event stream.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Watch for new hosts.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Add an "omnipresent" flag to Formation's ProcessType

This will specify that a job should be ran on all hosts.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Omnipresence via f.rectify()

f.start, f.restart and f.stop have been updated to take a third
parameter representing the hostID, targetting a specific host.
If empty, it works like previously.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Bootstrap new nodes with omnipresent processes.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Add mock methods for SendHostEvents.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Update to use the new method signatures.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Add test for Omni mode.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Run Rectify in a goroutine.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Simplify hostCounts code.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Fix the hostCounts calculation.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Add an omniMtx.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
Bump Godeps.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>