Avoid overloading app.droplet_hash=

To make it easier to set package_state to STAGED in different places for the DEA and Diego

[#74641650]

Signed-off-by: Max Brunsfeld <mbrunsfeld@pivotallabs.com>
Simplify AppFactory

Signed-off-by: Max Brunsfeld <mbrunsfeld@pivotallabs.com>
Mark app as staged after receiving staging completion message

Previously, we would mark the app as staged as soon as the droplet upload
completed. This created two problems:

1. The bulk apps controller would return apps that had droplets but had no
   staging metadata. We had solved this by adding more complex filtering to
   that controller, but this introduced an N+1 query. This commit simplifies
   that query and makes it performant again.

2. The instances API returns a NotStaged error unless the app is marked
   staged, which is important because it lets the CLI know when staging is
   complete. Before, the CLI would treat staging as complete as soon as the
   droplet had been uploaded, so any staging logs that were emitted after that
   would be interspersed with other output from the CLI.

Signed-off-by: Abhijit Hiremagalur <abhi@pivotallabs.com>
Revert "Use larger quotas when staging apps with Diego"

The hard-coded resource limits for staging have been moved
to diego's stager. The cloud controller will now tell the
stager about the app's resource limits, and the stager will
take the maximum of the app's resource limits and its-own
fixed resource limits.

This reverts commit 9f0b016a1850e0fcb61c57c5f25da16b76f38676.
Improve app state error message.

[#72816350]
Add index for actee on the events table.

* Truncate the events table to prevent deploy failures.
  Adding an index in a production like environment most
  likely will exceed the 10 minute limit. Also adding an index
  in mysql will lock the table, making adding an index on a large
  table extremely dangerous.

[#69878326]
Only space devs and managers can create routes

 (And admins too...)

[#70133368]

Signed-off-by: James Myers <jmyers@pivotallabs.com>
Add logging for BuildpackInstaller errors.

[#69100160]
Create buildpack db entries only if the blobs are available.

- if putting a blob into the blobstore failed, we would previously create a db
  entry that is essentially useless.
- now not having a buildpack listed in `cf buildpacks` makes it more obvious
  when there is an issue with the  buildpack upload

[#69100160]