Permalink
Browse files

Revert 'Revert "remove framework/runtime"'

This reverts commit f5a7698.
  • Loading branch information...
1 parent f5a7698 commit ba8a4626ed37e4af3a3f2a4f7782400be27b47c3 Alex Suraci & Bleicke committed Mar 25, 2013
Showing with 63 additions and 955 deletions.
  1. +0 −2 bin/document_api
  2. +0 −10 config/frameworks/myframework.yml
  3. +0 −9 config/frameworks/node.yml
  4. +0 −18 config/frameworks/sinatra.yml
  5. +0 −9 config/frameworks/spring.yml
  6. +0 −23 config/frameworks/standalone.yml
  7. +0 −41 config/runtimes.yml
  8. +13 −0 db/migrations/20130323005501_remove_framework_and_runtime.rb
  9. +1 −3 lib/cloud_controller/api/app.rb
  10. +0 −2 lib/cloud_controller/api/app_summary.rb
  11. +0 −28 lib/cloud_controller/api/framework.rb
  12. +0 −31 lib/cloud_controller/api/runtime.rb
  13. +0 −2 lib/cloud_controller/api/space_summary.rb
  14. +0 −7 lib/cloud_controller/app_stager.rb
  15. +0 −2 lib/cloud_controller/config.rb
  16. +1 −6 lib/cloud_controller/dea/dea_client.rb
  17. +4 −9 lib/cloud_controller/dea/dea_pool.rb
  18. +0 −29 lib/cloud_controller/legacy_api/legacy_apps.rb
  19. +0 −4 lib/cloud_controller/legacy_api/legacy_bulk.rb
  20. +1 −50 lib/cloud_controller/legacy_api/legacy_info.rb
  21. +0 −2 lib/cloud_controller/models.rb
  22. +6 −21 lib/cloud_controller/models/app.rb
  23. +0 −43 lib/cloud_controller/models/framework.rb
  24. +0 −43 lib/cloud_controller/models/runtime.rb
  25. +1 −23 lib/cloud_controller/runner.rb
  26. +0 −18 manifest.yml
  27. +8 −50 spec/api/app_spec.rb
  28. +0 −10 spec/api/app_summary_spec.rb
  29. +0 −54 spec/api/framework_spec.rb
  30. +4 −158 spec/api/legacy_apps_spec.rb
  31. +2 −3 spec/api/legacy_bulk_spec.rb
  32. +0 −28 spec/api/legacy_info_spec.rb
  33. +0 −34 spec/api/runtime_spec.rb
  34. +1 −3 spec/api/space_summary_spec.rb
  35. +0 −3 spec/app_stager_spec.rb
  36. +0 −10 spec/config_spec.rb
  37. +0 −2 spec/dea/dea_client_spec.rb
  38. +13 −63 spec/dea/dea_pool_spec.rb
  39. +1 −9 spec/models/app_spec.rb
  40. +0 −36 spec/models/framework_spec.rb
  41. +0 −36 spec/models/runtime_spec.rb
  42. +7 −7 spec/stager_pool_spec.rb
  43. +0 −14 spec/support/fakes/blueprints.rb
View
@@ -20,8 +20,6 @@ module Docs
VCAP::CloudController::User,
VCAP::CloudController::Space,
VCAP::CloudController::App,
- VCAP::CloudController::Runtime,
- VCAP::CloudController::Framework,
VCAP::CloudController::Service,
VCAP::CloudController::ServicePlan,
VCAP::CloudController::ServiceInstance,
@@ -1,10 +0,0 @@
----
-name: "myframework"
-runtimes:
- - node:
- default: true
- - node06:
- default: false
-detection:
- - "*.js": '.'
-disabled: true
@@ -1,9 +0,0 @@
----
-name: "node"
-runtimes:
- - node:
- default: true
- - node06:
- default: false
-detection:
- - "*.js": '.'
@@ -1,18 +0,0 @@
----
-name: "sinatra"
-runtimes:
- - ruby18:
- default: true
- environment:
- bundle_gemfile:
- - ruby19:
- environment:
- bundle_gemfile:
- - myruntime:
- default: false
-detection:
- - "*.rb": "require\\s+'sinatra'|require\\s+\"sinatra\"" # .rb files in the root dir containing a require?
- - "config.ru": false # use rack if it detects a config.ru
- - "config/environment.rb": false # and config/environment.rb must not exist
-
-# vim: filetype=yaml
@@ -1,9 +0,0 @@
----
-name: "spring"
-runtimes:
- - "java":
- default: true
-detection:
- - "*.war": true # TODO - this thinks everything with an XML file is Spring
-
-# vim: filetype=yaml
@@ -1,23 +0,0 @@
----
-name: "standalone"
-runtimes:
- - python2:
- default: false
- - java:
- default: false
- - node:
- default: false
- - node06:
- default: false
- - erlangR14B02:
- default: false
- - php:
- default: false
- - ruby18:
- environment:
- bundle_gemfile:
- - ruby19:
- environment:
- bundle_gemfile:
-
-# vim: filetype=yaml
View
@@ -1,41 +0,0 @@
----
-python2:
- version: "2.6.5"
- description: "Python 2.6.5"
- executable: python
-java:
- description: "Java 6"
- version: "1.6"
- executable: "java"
-node:
- version: "0.4.12"
- description: "Node.js"
- executable: node
-node06:
- version: "0.6.8"
- description: "Node.js"
- executable: node
-erlangR14B02:
- version: "R14B02"
- description: "Erlang R14B02"
- executable: /var/vcap/runtimes/erlang-R14B02/bin/erl
-php:
- description: "PHP 5"
- version: "5.3"
- executable: "php"
-ruby18:
- version: "1.8.7"
- description: "Ruby 1.8.7"
- executable: "/usr/bin/ruby"
- bundler: "bundle"
- environment:
- bundle_gemfile:
-ruby19:
- version: "1.9.2"
- description: "Ruby 1.9.2"
- executable: "ruby"
- bundler: "bundle"
-myruntime:
- version: "1.0"
- description: "My Runtime"
- disabled: true
@@ -0,0 +1,13 @@
+# Copyright (c) 2009-2012 VMware, Inc.
+
+Sequel.migration do
+ change do
+ alter_table :apps do
+ drop_column :framework_id
+ drop_column :runtime_id
+ end
+
+ drop_table :frameworks
+ drop_table :runtimes
+ end
+end
@@ -15,8 +15,6 @@ module VCAP::CloudController
attribute :production, Message::Boolean, :default => false
to_one :space
- to_one :runtime, :optional_in => :create
- to_one :framework, :optional_in => :create
to_one :stack, :optional_in => :create
attribute :environment_json, Hash, :default => {}
@@ -37,7 +35,7 @@ module VCAP::CloudController
to_many :routes
end
- query_parameters :name, :space_guid, :organization_guid, :framework_guid, :runtime_guid
+ query_parameters :name, :space_guid, :organization_guid
def self.translate_validation_exception(e, attributes)
space_and_name_errors = e.errors.on([:space_id, :name])
@@ -20,8 +20,6 @@ def summary(id)
:guid => app.guid,
:name => app.name,
:routes => app.routes.map(&:as_summary_json),
- :framework => app.framework.to_hash.merge(:guid => app.framework.guid),
- :runtime => app.runtime.to_hash.merge(:guid => app.runtime.guid),
:running_instances => app.running_instances,
:services => app.service_instances.map(&:as_summary_json),
:available_domains => app.space.domains.map(&:as_summary_json)
@@ -1,28 +0,0 @@
-# Copyright (c) 2009-2012 VMware, Inc.
-
-module VCAP::CloudController
- rest_controller :Framework do
- permissions_required do
- full Permissions::CFAdmin
- read Permissions::Authenticated
- end
-
- define_attributes do
- attribute :name, String
- attribute :description, String
- attribute :internal_info, Hash
- to_many :apps
- end
-
- query_parameters :name, :app_guid
-
- def self.translate_validation_exception(e, attributes)
- name_errors = e.errors.on(:name)
- if name_errors && name_errors.include?(:unique)
- Errors::FrameworkNameTaken.new(attributes["name"])
- else
- Errors::FrameworkInvalid.new(e.errors.full_messages)
- end
- end
- end
-end
@@ -1,31 +0,0 @@
-# Copyright (c) 2009-2012 VMware, Inc.
-
-module VCAP::CloudController
- rest_controller :Runtime do
- permissions_required do
- full Permissions::CFAdmin
- read Permissions::Authenticated
- end
-
- define_attributes do
- attribute :name, String
- attribute :description, String
- attribute :internal_info, Hash
-
- # version was really a v1 concept, but the yeti tests expect it
- attribute :version, String, :exclude_in => [:create, :update]
- to_many :apps, :default => []
- end
-
- query_parameters :name, :app_guid
-
- def self.translate_validation_exception(e, attributes)
- name_errors = e.errors.on(:name)
- if name_errors && name_errors.include?(:unique)
- Errors::RuntimeNameTaken.new(attributes["name"])
- else
- Errors::RuntimeInvalid.new(e.errors.full_messages)
- end
- end
- end
-end
@@ -49,8 +49,6 @@ def app_summary(app)
:urls => app.routes.map(&:fqdn),
:routes => app.routes.map(&:as_summary_json),
:service_count => app.service_bindings_dataset.count,
- :framework => { :name => app.framework.name },
- :runtime => { :name => app.runtime.name },
:running_instances => 0,
}.merge(app.to_hash)
end
@@ -195,13 +195,6 @@ def destroy_upload_handle
def staging_task_properties(app)
{
:services => app.service_bindings.map { |sb| service_binding_to_staging_request(sb) },
- :framework => app.framework.name,
- :framework_info => app.framework.internal_info,
-
- :runtime => app.runtime.name,
- :runtime_info => app.runtime.internal_info.merge(
- :name => app.runtime.name
- ),
:buildpack => app.buildpack,
@@ -46,7 +46,6 @@ class VCAP::CloudController::Config < VCAP::Config
optional(:staging_manifests) => String,
},
- optional(:runtimes_file) => String,
optional(:stacks_file) => String,
:db => {
@@ -168,7 +167,6 @@ def self.config_dir
private
def self.merge_defaults(config)
- config[:runtimes_file] ||= File.join(config_dir, "runtimes.yml")
config[:stacks_file] ||= File.join(config_dir, "stacks.yml")
config[:directories] ||= {}
@@ -225,7 +225,7 @@ def start_instances_with_message(app, indices, message_override)
indices.each do |idx|
msg[:index] = idx
- dea_id = dea_pool.find_dea(app.memory, app.runtime.name, app.stack.name)
+ dea_id = dea_pool.find_dea(app.memory, app.stack.name)
if dea_id
dea_publish("#{dea_id}.start", msg.merge(message_override))
else
@@ -313,11 +313,6 @@ def start_app_message(app)
:droplet => app.guid,
:name => app.name,
:uris => app.uris,
- :runtime => app.runtime.name,
- :runtime_info => app.runtime.internal_info.merge(
- :name => app.runtime.name
- ),
- :framework => app.framework.name,
:prod => app.production,
:sha1 => app.droplet_hash,
:executableFile => "deprecated",
@@ -29,13 +29,13 @@ def process_advertise_message(msg)
end
end
- def find_dea(mem, runtime, stack)
+ def find_dea(mem, stack)
mutex.synchronize do
@deas.keys.shuffle.each do |id|
dea = @deas[id]
if dea_expired?(dea)
@deas.delete(id)
- elsif dea_meets_needs?(dea, mem, runtime, stack)
+ elsif dea_meets_needs?(dea, mem, stack)
return id
end
end
@@ -49,17 +49,12 @@ def dea_expired?(dea)
(Time.now.to_i - dea[:last_update].to_i) > ADVERTISEMENT_EXPIRATION
end
- def dea_meets_needs?(dea, mem, runtime, stack)
+ def dea_meets_needs?(dea, mem, stack)
stats = dea[:advertisement]
- has_runtime = stats[:runtimes].nil? || stats[:runtimes].include?(runtime)
has_stack = stats[:stacks].include?(stack)
- if stats[:available_memory] >= mem
- has_runtime && has_stack
- else
- false
- end
+ (stats[:available_memory] >= mem) && has_stack
end
def mutex
@@ -129,10 +129,6 @@ def instances(name)
def legacy_app_encoding(app)
{
:name => app.name,
- :staging => {
- :model => app.framework.name,
- :stack => app.runtime.name,
- },
:uris => app.uris,
:instances => app.instances,
:runningInstances => app.running_instances,
@@ -215,21 +211,6 @@ def translate_legacy_create_json(hash)
end
if staging = hash["staging"]
- framework = nil
- if framework_name = staging["framework"] || staging["model"]
- framework = Models::Framework.find(:name => framework_name)
- raise FrameworkInvalid.new(framework_name) unless framework
- req[:framework_guid] = framework.guid
- end
-
- runtime_name = staging["runtime"] || staging["stack"]
- runtime_name ||= default_runtime_for_framework(framework)
- if runtime_name
- runtime = Models::Runtime.find(:name => runtime_name)
- raise RuntimeInvalid.new(runtime_name) unless runtime
- req[:runtime_guid] = runtime.guid
- end
-
req[:command] = staging["command"] if staging["command"]
end
@@ -292,16 +273,6 @@ def around_translate(old_json, &translate)
Yajl::Encoder.encode(translated)
end
- def default_runtime_for_framework(framework)
- return unless framework
- framework.internal_info["runtimes"].each do |runtime|
- runtime.each do |runtime_name, runtime_info|
- return runtime_name if runtime_info["default"] == true
- end
- end
- nil
- end
-
def self.setup_routes
get "/apps", :enumerate
post "/apps", :create
@@ -10,8 +10,6 @@ class BulkResponse < JsonMessage
{
"id" => String,
"instances" => Integer,
- "framework" => String,
- "runtime" => String,
# FIXME: find the enum for this
"state" => String,
"memory" => Integer,
@@ -96,8 +94,6 @@ def bulk_apps
end
hash["id"] = app.guid
hash["updated_at"] = app.updated_at || app.created_at
- hash["runtime"] = app.runtime.name
- hash["framework"] = app.framework.name
apps[app.guid] = hash
id_for_next_token = app.id
end
Oops, something went wrong.

0 comments on commit ba8a462

Please sign in to comment.