From 3259999f1b4e951d9fb8d50af1c857039b1674b7 Mon Sep 17 00:00:00 2001
From: Jan Provaznik <jprovazn@redhat.com>
Date: Thu, 16 Jun 2011 12:14:56 +0200
Subject: [PATCH] Removed legacy models - migration

dropped tables and columns referencing legacy models
---
 aeolus-conductor.spec.in                           |   10 +-
 src/app/controllers/application_controller.rb      |    1 -
 src/app/controllers/builds_controller.rb           |  110 -------
 src/app/controllers/deployments_controller.rb      |   39 +---
 .../controllers/hardware_profiles_controller.rb    |    1 -
 src/app/controllers/image_imports_controller.rb    |   26 --
 src/app/controllers/instances_controller.rb        |   71 +-----
 .../controllers/legacy_assemblies_controller.rb    |    6 -
 .../controllers/legacy_deployables_controller.rb   |  149 ----------
 src/app/controllers/legacy_templates_controller.rb |  301 --------------------
 src/app/controllers/pool_families_controller.rb    |    1 -
 src/app/controllers/pools_controller.rb            |    1 -
 .../controllers/provider_accounts_controller.rb    |    1 -
 src/app/controllers/providers_controller.rb        |    1 -
 src/app/controllers/realm_mappings_controller.rb   |    1 -
 src/app/controllers/realms_controller.rb           |    1 -
 src/app/controllers/roles_controller.rb            |    1 -
 src/app/controllers/settings_controller.rb         |    1 -
 .../suggested_deployables_controller.rb            |    1 -
 src/app/controllers/users_controller.rb            |    1 -
 src/app/helpers/legacy_templates_helper.rb         |    8 -
 src/app/models/build_job.rb                        |   62 ----
 src/app/models/deployment.rb                       |   24 +-
 src/app/models/icicle.rb                           |   14 +-
 src/app/models/instance.rb                         |   15 +-
 src/app/models/legacy_assembly.rb                  |   87 ------
 src/app/models/legacy_deployable.rb                |   95 ------
 src/app/models/legacy_image.rb                     |  245 ----------------
 src/app/models/legacy_provider_image.rb            |   69 -----
 src/app/models/legacy_template.rb                  |  187 ------------
 src/app/models/permission.rb                       |    6 -
 src/app/models/privilege.rb                        |    1 -
 src/app/models/provider.rb                         |    1 -
 src/app/models/provider_type.rb                    |    1 -
 src/app/models/push_job.rb                         |   50 ----
 src/app/models/suggested_deployable.rb             |    3 +-
 src/app/util/image_descriptor_xml.rb               |  238 ----------------
 src/app/util/repository_manager.rb                 |  111 -------
 .../util/repository_manager/abstract_repository.rb |   17 --
 .../util/repository_manager/comps_repository.rb    |  158 ----------
 src/app/util/repository_manager/pulp_repository.rb |   83 ------
 src/app/views/deployments/_edit.haml               |    1 -
 src/app/views/deployments/_filter_view.haml        |    2 +-
 src/app/views/deployments/_legacy_launch_new.haml  |    8 -
 src/app/views/deployments/_legacy_new.haml         |   25 --
 src/app/views/deployments/_list.haml               |    2 +-
 src/app/views/deployments/legacy_launch_new.haml   |    1 -
 src/app/views/deployments/legacy_new.haml          |    1 -
 src/app/views/image_imports/new.haml               |    8 -
 src/app/views/instances/_list.haml                 |    2 -
 src/app/views/instances/_new.haml                  |   27 --
 src/app/views/instances/index.haml                 |    3 +-
 .../views/instances/select_legacy_template.haml    |   19 --
 src/app/views/instances/show.haml                  |    6 +-
 src/app/views/layouts/application.haml             |    2 -
 src/app/views/legacy_assemblies/index.haml         |    1 -
 src/app/views/legacy_deployables/_assemblies.haml  |   30 --
 src/app/views/legacy_deployables/_deployments.haml |   25 --
 src/app/views/legacy_deployables/_form.haml        |   10 -
 src/app/views/legacy_deployables/_list.haml        |   28 --
 .../views/legacy_deployables/_pick_assemblies.haml |   16 -
 src/app/views/legacy_deployables/_properties.haml  |    8 -
 src/app/views/legacy_deployables/edit.haml         |    4 -
 src/app/views/legacy_deployables/index.haml        |    2 -
 src/app/views/legacy_deployables/new.haml          |    3 -
 .../views/legacy_deployables/pick_assemblies.haml  |    5 -
 src/app/views/legacy_deployables/show.haml         |    5 -
 src/app/views/legacy_templates/_addbuttons.haml    |    4 -
 src/app/views/legacy_templates/_basics.haml        |   27 --
 src/app/views/legacy_templates/_builds.haml        |   41 ---
 src/app/views/legacy_templates/_collections.haml   |    8 -
 src/app/views/legacy_templates/_form.haml          |  120 --------
 src/app/views/legacy_templates/_hidden_fields.haml |    8 -
 src/app/views/legacy_templates/_list.haml          |   35 ---
 .../legacy_templates/_local_content_to_bundle.haml |   21 --
 .../views/legacy_templates/_managed_content.haml   |   21 --
 .../legacy_templates/_metagroup_packages.haml      |   19 --
 src/app/views/legacy_templates/_metagroups.haml    |   13 -
 .../legacy_templates/_preboot_configuration.haml   |   11 -
 src/app/views/legacy_templates/_properties.haml    |    4 -
 .../views/legacy_templates/_search_packages.haml   |   45 ---
 .../legacy_templates/_software_selection.haml      |   41 ---
 src/app/views/legacy_templates/collections.haml    |    1 -
 src/app/views/legacy_templates/edit.haml           |    9 -
 src/app/views/legacy_templates/index.haml          |    2 -
 .../views/legacy_templates/managed_content.haml    |    1 -
 .../views/legacy_templates/metagroup_packages.haml |    1 -
 src/app/views/legacy_templates/new.haml            |   10 -
 .../views/legacy_templates/search_packages.haml    |    1 -
 src/app/views/legacy_templates/show.haml           |    5 -
 .../xml/_hardware_profile.xml.haml                 |    6 -
 .../xml/_hardware_profile_property.xml.haml        |    9 -
 src/app/views/pools/_instances.haml                |    2 +-
 .../image_descriptor_package_metagroups.conf       |   20 --
 .../image_descriptor_package_repositories.yml      |   35 ---
 .../image_descriptor_platform_repositories.yml     |    9 -
 src/config/image_descriptor_targets.yml            |   18 --
 src/config/locales/en.yml                          |    9 -
 src/config/navigation.rb                           |    6 -
 src/config/routes.rb                               |   10 +-
 src/db/migrate/20110207101100_deployment_roles.rb  |    1 -
 ...132404_add_target_id_column_to_legacy_images.rb |   14 -
 .../20110302120000_add_status_to_provider_image.rb |   18 --
 ...10322120000_add_legacy_template_creator_role.rb |   47 ---
 .../migrate/20110616100915_remove_legacy_models.rb |   20 ++
 src/db/seeds.rb                                    |   11 +-
 src/features/authentication.feature                |    6 +-
 src/features/instance.feature                      |  112 ++++----
 src/features/step_definitions/authentication.rb    |    3 +-
 src/features/support/custom.rb                     |   16 -
 src/features/support/paths.rb                      |   21 --
 src/lib/tasks/dc_tasks.rake                        |   21 --
 src/script/use-existing-ec2-templates              |   81 ------
 .../legacy_templates_controller_spec.rb            |   18 --
 src/spec/factories/build_job.rb                    |    7 -
 src/spec/factories/legacy_assembly.rb              |    6 -
 src/spec/factories/legacy_deployable.rb            |    5 -
 src/spec/factories/legacy_image.rb                 |   15 -
 src/spec/factories/legacy_provider_image.rb        |   15 -
 src/spec/factories/legacy_template.rb              |   11 -
 src/spec/factories/push_job.rb                     |    3 -
 src/spec/models/build_job_spec.rb                  |    9 -
 src/spec/models/legacy_assembly_spec.rb            |   25 --
 src/spec/models/legacy_deployable_spec.rb          |   56 ----
 src/spec/models/legacy_image_spec.rb               |   75 -----
 src/spec/models/legacy_template_spec.rb            |   46 ---
 src/spec/models/push_job_spec.rb                   |   13 -
 src/spec/services/registration_service_spec.rb     |    6 +-
 src/spec/utils/repository_manager_spec.rb          |   52 ----
 129 files changed, 118 insertions(+), 3630 deletions(-)
 delete mode 100644 src/app/controllers/builds_controller.rb
 delete mode 100644 src/app/controllers/image_imports_controller.rb
 delete mode 100644 src/app/controllers/legacy_assemblies_controller.rb
 delete mode 100644 src/app/controllers/legacy_deployables_controller.rb
 delete mode 100644 src/app/controllers/legacy_templates_controller.rb
 delete mode 100644 src/app/helpers/legacy_templates_helper.rb
 delete mode 100644 src/app/models/build_job.rb
 delete mode 100644 src/app/models/legacy_assembly.rb
 delete mode 100644 src/app/models/legacy_deployable.rb
 delete mode 100644 src/app/models/legacy_image.rb
 delete mode 100644 src/app/models/legacy_provider_image.rb
 delete mode 100644 src/app/models/legacy_template.rb
 delete mode 100644 src/app/models/push_job.rb
 delete mode 100644 src/app/util/image_descriptor_xml.rb
 delete mode 100644 src/app/util/repository_manager.rb
 delete mode 100644 src/app/util/repository_manager/abstract_repository.rb
 delete mode 100644 src/app/util/repository_manager/comps_repository.rb
 delete mode 100644 src/app/util/repository_manager/pulp_repository.rb
 delete mode 100644 src/app/views/builds/index.haml
 delete mode 100644 src/app/views/deployments/_legacy_launch_new.haml
 delete mode 100644 src/app/views/deployments/_legacy_new.haml
 delete mode 100644 src/app/views/deployments/legacy_launch_new.haml
 delete mode 100644 src/app/views/deployments/legacy_new.haml
 delete mode 100644 src/app/views/image_imports/new.haml
 delete mode 100644 src/app/views/instances/_new.haml
 delete mode 100644 src/app/views/instances/select_legacy_template.haml
 delete mode 100644 src/app/views/legacy_assemblies/index.haml
 delete mode 100644 src/app/views/legacy_deployables/_assemblies.haml
 delete mode 100644 src/app/views/legacy_deployables/_deployments.haml
 delete mode 100644 src/app/views/legacy_deployables/_form.haml
 delete mode 100644 src/app/views/legacy_deployables/_list.haml
 delete mode 100644 src/app/views/legacy_deployables/_pick_assemblies.haml
 delete mode 100644 src/app/views/legacy_deployables/_properties.haml
 delete mode 100644 src/app/views/legacy_deployables/edit.haml
 delete mode 100644 src/app/views/legacy_deployables/index.haml
 delete mode 100644 src/app/views/legacy_deployables/new.haml
 delete mode 100644 src/app/views/legacy_deployables/pick_assemblies.haml
 delete mode 100644 src/app/views/legacy_deployables/show.haml
 delete mode 100644 src/app/views/legacy_templates/_addbuttons.haml
 delete mode 100644 src/app/views/legacy_templates/_basics.haml
 delete mode 100644 src/app/views/legacy_templates/_builds.haml
 delete mode 100644 src/app/views/legacy_templates/_collections.haml
 delete mode 100644 src/app/views/legacy_templates/_form.haml
 delete mode 100644 src/app/views/legacy_templates/_hidden_fields.haml
 delete mode 100644 src/app/views/legacy_templates/_list.haml
 delete mode 100644 src/app/views/legacy_templates/_local_content_to_bundle.haml
 delete mode 100644 src/app/views/legacy_templates/_managed_content.haml
 delete mode 100644 src/app/views/legacy_templates/_metagroup_packages.haml
 delete mode 100644 src/app/views/legacy_templates/_metagroups.haml
 delete mode 100644 src/app/views/legacy_templates/_preboot_configuration.haml
 delete mode 100644 src/app/views/legacy_templates/_properties.haml
 delete mode 100644 src/app/views/legacy_templates/_search_packages.haml
 delete mode 100644 src/app/views/legacy_templates/_software_selection.haml
 delete mode 100644 src/app/views/legacy_templates/collections.haml
 delete mode 100644 src/app/views/legacy_templates/edit.haml
 delete mode 100644 src/app/views/legacy_templates/index.haml
 delete mode 100644 src/app/views/legacy_templates/managed_content.haml
 delete mode 100644 src/app/views/legacy_templates/metagroup_packages.haml
 delete mode 100644 src/app/views/legacy_templates/new.haml
 delete mode 100644 src/app/views/legacy_templates/search_packages.haml
 delete mode 100644 src/app/views/legacy_templates/show.haml
 delete mode 100644 src/app/views/legacy_templates/xml/_hardware_profile.xml.haml
 delete mode 100644 src/app/views/legacy_templates/xml/_hardware_profile_property.xml.haml
 delete mode 100644 src/config/image_descriptor_package_metagroups.conf
 delete mode 100644 src/config/image_descriptor_package_repositories.yml
 delete mode 100644 src/config/image_descriptor_platform_repositories.yml
 delete mode 100644 src/config/image_descriptor_targets.yml
 delete mode 100644 src/db/migrate/20110322120000_add_legacy_template_creator_role.rb
 create mode 100644 src/db/migrate/20110616100915_remove_legacy_models.rb
 delete mode 100755 src/script/use-existing-ec2-templates
 delete mode 100644 src/spec/controllers/legacy_templates_controller_spec.rb
 delete mode 100644 src/spec/factories/build_job.rb
 delete mode 100644 src/spec/factories/legacy_assembly.rb
 delete mode 100644 src/spec/factories/legacy_deployable.rb
 delete mode 100644 src/spec/factories/legacy_image.rb
 delete mode 100644 src/spec/factories/legacy_provider_image.rb
 delete mode 100644 src/spec/factories/legacy_template.rb
 delete mode 100644 src/spec/factories/push_job.rb
 delete mode 100644 src/spec/models/build_job_spec.rb
 delete mode 100644 src/spec/models/legacy_assembly_spec.rb
 delete mode 100644 src/spec/models/legacy_deployable_spec.rb
 delete mode 100644 src/spec/models/legacy_image_spec.rb
 delete mode 100644 src/spec/models/legacy_template_spec.rb
 delete mode 100644 src/spec/models/push_job_spec.rb
 delete mode 100644 src/spec/utils/repository_manager_spec.rb

diff --git a/aeolus-conductor.spec.in b/aeolus-conductor.spec.in
index 64a9e3c..41c634d 100644
--- a/aeolus-conductor.spec.in
+++ b/aeolus-conductor.spec.in
@@ -132,10 +132,7 @@ haml="app/views/hardware_profiles app/views/realm_mappings \
       app/views/users app/views/provider_accounts \
       app/views/roles app/views/providers app/views/settings \
       app/views/realms app/views/pool_families app/views/layouts\
-      app/views/quotas app/views/legacy_deployables \
-      app/views/image_imports app/views/legacy_assemblies \
-      app/views/legacy_templates app/views/builds \
-      app/views/permissions app/views/legacy_templates/xml \
+      app/views/quotas app/views/permissions \
       app/views/deployments app/views/pools \
       app/views/instances app/views/user_sessions"
 html="public"
@@ -152,11 +149,11 @@ png="public/images public/images/icons public/stylesheets/images \
 rake="lib/tasks"
 rb="app/models app/controllers \
     app/helpers \
-    app/services app/util app/util/repository_manager \
+    app/services app/util \
     config config/initializers config/environments db db/migrate dutils \
     features/support features/step_definitions lib public spec \
     spec/controllers spec/factories spec/helpers spec/models spec/services \
-    spec/utils warehouse_sync"
+    warehouse_sync"
 rhtml="app/views/layouts"
 scss="app/stylesheets"
 svg="public/images public/images/icons public/javascripts/jquery-svg"
@@ -187,7 +184,6 @@ done
 # something of a policy we are encoding in the RPM, it is nice to give the user
 # sane defaults.  The user can still override this with their own configuration
 %{__cp} src/config/database.pg %{buildroot}%{app_root}/config/database.yml
-%{__cp} src/config/image_descriptor_package_metagroups.conf %{buildroot}%{app_root}/config
 
 %{__mkdir} -p %{buildroot}%{app_root}/dbomatic
 %{__cp} src/dbomatic/dbomatic %{buildroot}%{app_root}/dbomatic
diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb
index dccd401..4eed65a 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -28,7 +28,6 @@ class ApplicationController < ActionController::Base
   filter_parameter_logging :password, :password_confirmation
   helper_method :current_user_session, :current_user, :filter_view?
   before_filter :read_breadcrumbs
-  layout 'old'
 
   def top_section; end
 
diff --git a/src/app/controllers/builds_controller.rb b/src/app/controllers/builds_controller.rb
deleted file mode 100644
index 18e891d..0000000
--- a/src/app/controllers/builds_controller.rb
+++ /dev/null
@@ -1,110 +0,0 @@
-class BuildsController < ApplicationController
-  before_filter [:require_user], :except => [:update_status]
-
-  def index
-  end
-
-  def create
-    @tpl = LegacyTemplate.find(params[:legacy_template_id])
-    check_permission
-
-    errors = {}
-    warnings = []
-    begin
-      target = ProviderType.find(params[:target])
-      LegacyImage.create_and_build!(@tpl, target)
-    rescue
-      flash[:error] = "Warning: #{$!.message}"
-      logger.error $!.message
-      logger.error $!.backtrace.join("\n   ")
-    end
-    redirect_to legacy_template_path(@tpl, :details_tab => 'builds')
-  end
-
-  def upload
-    @tpl = LegacyTemplate.find(params[:template_id])
-    pimg = LegacyProviderImage.create!(
-      :legacy_image => LegacyImage.find(params[:image_id]),
-      :provider => Provider.find(params[:provider_id]),
-      :status => LegacyProviderImage::STATE_QUEUED
-    )
-    Delayed::Job.enqueue(PushJob.new(pimg.id))
-    redirect_to legacy_template_path(@tpl, :details_tab => 'builds')
-  end
-
-  def delete
-    @tpl = LegacyTemplate.find(params[:template_id])
-    # FIXME: add logic to delete image when v2 image factory lands
-    redirect_to legacy_template_path(@tpl, :details_tab => 'builds')
-  end
-
-  def edit
-    # FIXME: is @tpl defined here? do we need check_permission here?
-  end
-
-  def update
-    # FIXME: is @tpl defined here? do we need check_permission here?
-  end
-
-  def retry
-    @tpl = LegacyTemplate.find(params[:legacy_template_id])
-    check_permission
-    begin
-      if params[:legacy_image_id]
-        image = LegacyImage.find(params[:legacy_image_id])
-        if image
-          errors = {}
-          warnings = []
-          image.rebuild!
-          flash[:notice] = "Queued rebuild for image #{image.name}"
-        else
-          flash[:warning] = "could not find image #{image_id}"
-        end
-      elsif params[:provider_image_id]
-        provider_image = LegacyProviderImage.find(params[:provider_image_id])
-        if provider_image
-          provider_image.retry_upload!
-          flash[:notice] = "Queued upload of provider image #{provider_image.image.name} to #{provider_image.provider.name}"
-        else
-          flash[:warning] = "could not find provider image #{provider_image_id}"
-        end
-      else
-        flash[:warning] = 'You need to specify either a provider or a provider image'
-      end
-    rescue
-      flash[:warning] = $!.message
-      logger.error $!.message
-      logger.error $!.backtrace.join("\n   ")
-    end
-    redirect_to legacy_template_path(@tpl, :details_tab => 'builds')
-  end
-
-  def update_status
-    image = LegacyImage.find_by_uuid(params[:uuid])
-    image = LegacyProviderImage.find_by_uuid(params[:uuid]) unless image
-
-    if image
-      image.status = params[:status]
-      image.save!
-    end
-    return head :not_found unless image
-    respond_to do |format|
-      format.xml {
-        render :xml => image.to_xml
-      }
-    end
-
-  end
-  private
-
-  # TODO: DRY this, is used in legacy_templates controller too
-  def get_order(default)
-    @order_dir = params[:order_dir] == 'desc' ? 'desc' : 'asc'
-    @order_field = params[:order_field] || default
-    "#{@order_field} #{@order_dir}"
-  end
-
-  def check_permission
-    require_privilege(Privilege::MODIFY, @tpl)
-  end
-end
diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb
index b5cfaf3..e802095 100644
--- a/src/app/controllers/deployments_controller.rb
+++ b/src/app/controllers/deployments_controller.rb
@@ -3,8 +3,6 @@ class DeploymentsController < ApplicationController
   before_filter :load_deployments, :only => [:index, :show]
   before_filter :load_deployment, :only => [:edit, :update]
 
-  layout 'application'
-
   viewstate :show do |default|
     default.merge!({
       :view => 'pretty',
@@ -34,19 +32,6 @@ class DeploymentsController < ApplicationController
     end
   end
 
-  # TODO - 03may2011 - This is going away
-  def legacy_launch_new
-    @launchable_deployables = []
-    LegacyDeployable.all.each do |deployable|
-      @launchable_deployables << deployable if deployable.launchable?
-    end
-    respond_to do |format|
-      format.js { render :partial => 'legacy_launch_new' }
-      format.html
-      format.json { render :json => @launchable_deployables }
-    end
-  end
-
   # launch_new will post here, but you can use this RESTfully as well
   def new
     @deployment = Deployment.new(params[:deployment])
@@ -63,28 +48,6 @@ class DeploymentsController < ApplicationController
     end
   end
 
-  # TODO - 03may2011 - This is going away
-  def legacy_new
-    require_privilege(Privilege::CREATE, Deployment)
-    @deployment = Deployment.new(:legacy_deployable_id => params[:legacy_deployable_id])
-    respond_to do |format|
-      if @deployment.legacy_deployable.legacy_assemblies.empty?
-        flash[:warning] = "Deployable must have at least one assembly"
-        format.js do
-          load_deployments
-          render :partial => 'list'
-        end
-        format.html { redirect_to deployments_path }
-        format.json { render :json => {:error => flash[:warning]}, :status => :unprocessable_entity }
-      else
-        init_new_deployment_attrs
-        format.js { render :partial => 'legacy_new' }
-        format.html
-        format.json { render :json => @deployment }
-      end
-    end
-  end
-
   def create
     @deployment = Deployment.new(params[:deployment])
     require_privilege(Privilege::CREATE, Deployment, @deployment.pool)
@@ -109,7 +72,7 @@ class DeploymentsController < ApplicationController
         @pool = @deployment.pool
         flash.now[:warning] = "Deployment launch failed"
         init_new_deployment_attrs
-        format.js { legacy_launch_new }
+        format.js { launch_new }
         format.html { render :action => 'new' }
         format.json { render :json => @deployment.errors, :status => :unprocessable_entity }
       end
diff --git a/src/app/controllers/hardware_profiles_controller.rb b/src/app/controllers/hardware_profiles_controller.rb
index 4b06f18..9051de8 100644
--- a/src/app/controllers/hardware_profiles_controller.rb
+++ b/src/app/controllers/hardware_profiles_controller.rb
@@ -5,7 +5,6 @@ class HardwareProfilesController < ApplicationController
   before_filter :load_hardware_profile, :only => [:show]
   before_filter :setup_new_hardware_profile, :only => [:new]
   before_filter :setup_hardware_profile, :only => [:new, :create, :edit, :update]
-  layout 'application'
 
   def top_section
     :administer
diff --git a/src/app/controllers/image_imports_controller.rb b/src/app/controllers/image_imports_controller.rb
deleted file mode 100644
index de73ad2..0000000
--- a/src/app/controllers/image_imports_controller.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-class ImageImportsController < ApplicationController
-  before_filter :require_user
-
-  def new
-    init_provider_vars
-  end
-
-  def create
-    begin
-      LegacyImage.import(ProviderAccount.find(params[:provider_account_id]), params[:ami_id], current_user)
-      flash[:notice]="Image successfully imported"
-      redirect_to legacy_templates_path
-    rescue Exception => e
-      init_provider_vars
-      # The full message may be multiple lines, including the actual request, so only include the first line:
-      flash.now[:error]="Could not import image: #{e.message.split("\n").first}"
-      Rails.logger.error([e.message,e.backtrace].join("\n  "))
-      render :new
-    end
-  end
-
-protected
-def init_provider_vars
-    @providers = Provider.list_for_user(current_user, Privilege::VIEW)
-end
-end
diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
index 88fda19..8053203 100644
--- a/src/app/controllers/instances_controller.rb
+++ b/src/app/controllers/instances_controller.rb
@@ -21,77 +21,9 @@ class InstancesController < ApplicationController
   end
 
   def new
-    @instance = Instance.new(params[:instance])
-    require_privilege(Privilege::CREATE, Instance, @instance.pool) if @instance.pool
-
-    unless @instance.legacy_template
-      redirect_to select_legacy_template_instances_path
-      return
-    end
-
-    init_new_instance_attrs
-    respond_to do |format|
-      format.js { render :partial => 'new' }
-      format.html
-      format.json { render :json => @instance }
-    end
-  end
-
-  def select_legacy_template
-    # FIXME: we need to list only legacy_templates for particular user,
-    # => TODO: add TEMPLATE_* permissions
-    @legacy_templates = LegacyTemplate.paginate(
-      :page => params[:page] || 1,
-      :include => {:legacy_images => :legacy_provider_images},
-      :conditions => "legacy_provider_images.status = '#{LegacyProviderImage::STATE_COMPLETED}'"
-    )
-    respond_to do |format|
-      format.html
-      format.json { render :json => @legacy_templates }
-    end
   end
 
   def create
-    if params[:cancel]
-      redirect_to select_legacy_template_instances_path
-      return
-    end
-
-    @instance = Instance.new(params[:instance])
-    @instance.state = Instance::STATE_NEW
-    @instance.owner = current_user
-
-    respond_to do |format|
-      begin
-        require_privilege(Privilege::CREATE, Instance,
-                          Pool.find(@instance.pool_id))
-        free_quota = Quota.can_start_instance?(@instance, nil)
-        raise "Pool is not enabled" unless @instance.pool and @instance.pool.enabled
-        @instance.transaction do
-          @instance.save!
-          # set owner permissions:
-          @task = InstanceTask.create!({:user        => current_user,
-                                        :task_target => @instance,
-                                        :action      => InstanceTask::ACTION_CREATE})
-          condormatic_instance_create(@task)
-        end
-      rescue
-        init_new_instance_attrs
-        flash[:warning] = "Failed to launch instance: #{$!}"
-        format.js { render :partial => 'new' }
-        format.html { render :new }
-        format.json { render :json => @instance, :status => :unprocessable_entity}
-      else
-        if free_quota
-          flash[:notice] = "Instance added."
-        else
-          flash[:warning] = "Quota Exceeded: Instance will not start until you have free quota"
-        end
-        format.js { render :partial => 'properties', :id => @instance.id }
-        format.html { redirect_to instances_path }
-        format.json { render :json => @instance, :status => :created }
-      end
-    end
   end
 
   def show
@@ -309,7 +241,6 @@ class InstancesController < ApplicationController
     @header = [
       {:name => 'VM NAME', :sort_attr => 'name'},
       {:name => 'STATUS', :sortable => false},
-      {:name => 'TEMPLATE', :sort_attr => 'legacy_templates.name'},
       {:name => 'PUBLIC ADDRESS', :sort_attr => 'public_addresses'},
       {:name => 'PROVIDER', :sortable => false},
       {:name => 'CREATED BY', :sort_attr => 'users.last_name'},
@@ -319,7 +250,7 @@ class InstancesController < ApplicationController
   end
 
   def load_instances
-    @instances = Instance.all(:include => [:legacy_template, :owner],
+    @instances = Instance.all(:include => [:owner],
                               :conditions => {:pool_id => @pools},
                               :order => (params[:order_field] || 'name') +' '+ (params[:order_dir] || 'asc')
     )
diff --git a/src/app/controllers/legacy_assemblies_controller.rb b/src/app/controllers/legacy_assemblies_controller.rb
deleted file mode 100644
index 300db23..0000000
--- a/src/app/controllers/legacy_assemblies_controller.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class LegacyAssembliesController < ApplicationController
-  before_filter :require_user
-
-  def index
-  end
-end
diff --git a/src/app/controllers/legacy_deployables_controller.rb b/src/app/controllers/legacy_deployables_controller.rb
deleted file mode 100644
index 0024cf7..0000000
--- a/src/app/controllers/legacy_deployables_controller.rb
+++ /dev/null
@@ -1,149 +0,0 @@
-class LegacyDeployablesController < ApplicationController
-  before_filter :require_user
-  before_filter :load_deployables, :only => [:index, :show, :pick_assemblies]
-  before_filter :load_deployable_with_assemblies, :only => [:remove_assemblies, :add_assemblies, :pick_assemblies]
-
-  def index
-    require_privilege(Privilege::VIEW, LegacyTemplate)
-    @search_term = params[:q]
-    return if @search_term.blank?
-    search = LegacyDeployable.search() do
-      keywords(params[:q])
-    end
-    @deployables = search.results
-  end
-
-  def show
-    @deployable = LegacyDeployable.find(params[:id])
-    require_privilege(Privilege::VIEW, @deployable)
-    @url_params = params.clone
-    @tab_captions = ['Properties', 'Assemblies', 'Deployments']
-    @details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
-    if @details_tab == 'deployments'
-      @deployments = @deployable.deployments
-    end
-    respond_to do |format|
-      format.js do
-        if @url_params.delete :details_pane
-          render :partial => 'layouts/details_pane' and return
-        end
-        render :partial => @details_tab and return
-      end
-      format.html { render :action => 'show'}
-    end
-  end
-
-  def new
-    require_privilege(Privilege::CREATE, LegacyTemplate)
-    @deployable = LegacyDeployable.new
-  end
-
-  def create
-    require_privilege(Privilege::CREATE, LegacyTemplate)
-    @deployable = LegacyDeployable.new(params[:legacy_deployable])
-    @deployable.owner = current_user
-    if @deployable.save
-      flash[:notice] = "Deployable added."
-      redirect_to legacy_deployable_url(@deployable)
-    else
-      render :action => :new
-    end
-  end
-
-  def edit
-    @deployable = LegacyDeployable.find(params[:id])
-    require_privilege(Privilege::MODIFY, @deployable)
-  end
-
-  def update
-    @deployable = LegacyDeployable.find(params[:id])
-    require_privilege(Privilege::MODIFY, @deployable)
-    if @deployable.update_attributes(params[:legacy_deployable])
-      flash[:notice] = "Deployable updated."
-      redirect_to legacy_deployable_url(@deployable)
-    else
-      render :action => :edit
-    end
-  end
-
-  def multi_destroy
-    destroyed = []
-    failed = []
-    LegacyDeployable.find(params[:deployables_selected]).each do |deployable|
-      if check_privilege(Privilege::MODIFY, deployable) and deployable.destroyable?
-        deployable.destroy
-        destroyed << deployable.name
-      else
-        failed << deployable.name
-      end
-    end
-
-    unless destroyed.empty?
-      flash[:notice] = t('deployables.index.deleted', :count => destroyed.length, :list => destroyed.join(', '))
-    end
-    unless failed.empty?
-      flash[:error] = t('deployables.index.not_deleted', :count => failed.length, :list => failed.join(', '))
-    end
-    redirect_to legacy_deployables_url
-  end
-
-  def pick_assemblies
-    require_privilege(Privilege::MODIFY, @deployable)
-    @assemblies = LegacyAssembly.all - @deployable.legacy_assemblies
-    respond_to do |format|
-      format.js { render :partial => 'pick_assemblies' }
-      format.html { render 'pick_assemblies' }
-    end
-  end
-
-  def add_assemblies
-    require_privilege(Privilege::MODIFY, @deployable)
-    if assemblies = params.delete(:assemblies_selected)
-      @deployable.legacy_assembly_ids += assemblies.collect{|a| a.to_i}
-      @deployable.save!
-      flash[:notice] = "Assemblies saved."
-    end
-    respond_to do |format|
-      format.js { render :partial => 'assemblies' }
-      format.html { redirect_to legacy_deployable_url(@deployable, :details_tab => 'assemblies') and return }
-    end
-  end
-
-  def remove_assemblies
-    require_privilege(Privilege::MODIFY, @deployable)
-    if params[:assemblies_selected].present?
-      @deployable.legacy_assembly_ids = @deployable.legacy_assembly_ids - params[:assemblies_selected].collect{|a| a.to_i}
-      @deployable.save!
-      flash[:notice] = "Assemblies removed."
-    end
-    respond_to do |format|
-      format.js { render :partial => 'assemblies' }
-      format.html { redirect_to legacy_deployable_url(@deployable, :details_tab => 'assemblies') and return }
-    end
-  end
-
-  protected
-
-  def load_deployables
-    @header = [
-      { :name => "Deployable name", :sort_attr => :name }
-    ]
-    @header_deployments = [
-      { :name => "Deployment name", :sort_attr => :name },
-      { :name => "Deployable", :sortable => false },
-      { :name => "Deployment Owner", :sort_attr => "owner.last_name"},
-      { :name => "Running Since", :sort_attr => :running_since },
-      { :name => "Heath Metric", :sort_attr => :health },
-      { :name => "Pool", :sort_attr => "pool.name" }
-    ]
-    @deployables = LegacyDeployable.paginate(:all,
-      :page => params[:page] || 1,
-      :order => (params[:order_field] || 'name') +' '+ (params[:order_dir] || 'asc')
-    )
-    @url_params = params.clone
-  end
-
-  def load_deployable_with_assemblies
-    @deployable = LegacyDeployable.find(params[:id], :include => :legacy_assemblies)
-  end
-end
diff --git a/src/app/controllers/legacy_templates_controller.rb b/src/app/controllers/legacy_templates_controller.rb
deleted file mode 100644
index 5870cb0..0000000
--- a/src/app/controllers/legacy_templates_controller.rb
+++ /dev/null
@@ -1,301 +0,0 @@
-require 'util/repository_manager'
-
-class LegacyTemplatesController < ApplicationController
-  before_filter :require_user
-  before_filter :set_view_vars, :only => [:index, :show]
-
-  def index
-    require_privilege(Privilege::VIEW, LegacyTemplate)
-    @params = params
-    @search_term = params[:q]
-    if @search_term.blank?
-      load_legacy_templates
-      return
-    end
-
-    # FIXME: Filter on Permissions
-    search = LegacyTemplate.search do
-      keywords(params[:q])
-    end
-    @legacy_templates = search.results
-  end
-
-  def show
-    load_legacy_templates
-    @tpl = LegacyTemplate.find(params[:id])
-    require_privilege(Privilege::VIEW, @tpl)
-    @url_params = params.clone
-    @tab_captions = ['Properties', 'Builds']
-    @details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
-    load_images(@tpl) if @details_tab == 'builds'
-    respond_to do |format|
-      format.js do
-        if @url_params.delete :details_pane
-          render :partial => 'layouts/details_pane' and return
-        end
-        render :partial => @details_tab and return
-      end
-      format.html { render :action => 'show'}
-    end
-  end
-
-  def new
-    check_create_permission
-    # can't use @template variable - is used by compass (or something other)
-    @tpl = LegacyTemplate.new(params[:tpl])
-    @repository_manager = RepositoryManager.new(:repositories => params[:repository] || @tpl.platform)
-  end
-
-  def add_selected
-    if params[:tpl] and not params[:tpl][:id].blank?
-      @tpl = LegacyTemplate.find(params[:tpl][:id])
-      check_edit_permission
-      @tpl.attributes = params[:tpl]
-    else
-      @tpl = LegacyTemplate.new(params[:tpl])
-      check_create_permission
-    end
-    @repository_manager = RepositoryManager.new(:repositories => params[:repository] || @tpl.platform)
-    @tpl.add_software(params[:packages].to_a + params[:selected_packages].to_a + params[:cached_packages].to_a,
-                      params[:groups].to_a + params[:selected_groups].to_a)
-    render :action => @tpl.id ? :edit : :new
-  end
-
-  def edit
-    @tpl = LegacyTemplate.find(params[:id])
-    check_edit_permission
-    @tpl.attributes = params[:tpl] unless params[:tpl].blank?
-    @tpl.add_software(params[:packages].to_a, params[:groups].to_a)
-    @repository_manager = RepositoryManager.new(:repositories => params[:repository] || @tpl.platform)
-  end
-
-  def create
-    check_create_permission
-    @tpl = LegacyTemplate.new(params[:tpl])
-    @tpl.packages = params[:packages]
-    @tpl.owner = current_user
-    if @tpl.save
-      flash[:notice] = "Template saved."
-      @tpl.set_complete
-      if params[:create_deployable]
-        LegacyDeployable.create!(:name => @tpl.name, :legacy_assemblies => @tpl.legacy_assemblies, :owner => current_user)
-      end
-      redirect_to legacy_templates_path
-    else
-      @repository_manager = RepositoryManager.new(:repositories => params[:repository] || @tpl.platform)
-      render :new
-    end
-  end
-
-  def update
-    @tpl = LegacyTemplate.find(params[:id])
-    check_edit_permission
-    @tpl.packages = []
-    @tpl.add_software(params[:packages].to_a, params[:groups].to_a)
-
-    if @tpl.update_attributes(params[:tpl])
-      @tpl.set_complete
-      flash[:notice] = "Template updated."
-      redirect_to legacy_templates_path
-    else
-      @repository_manager = RepositoryManager.new(:repositories => params[:repository] || @tpl.platform)
-      render :action => 'edit'
-    end
-  end
-
-  def search_packages
-    set_package_vars
-    @page = get_page
-    @cached_packages = params[:cached_packages].to_a + params[:selected_packages].to_a
-    @searched_packages = params[:package_search].empty? ? [] : @repository_manager.search_package(
-      params[:package_search]).paginate(:page => @page, :per_page => 60)
-    if request.xhr?
-      render :partial => 'search_packages'
-    else
-      render 'search_packages'
-    end
-  end
-
-  def metagroup_packages
-    set_package_vars
-    group = params[:__rewrite] ? params[:__rewrite][:metagroup_packages] : nil
-    @metagroup_packages = @repository_manager.metagroup_packages(group)
-    if request.xhr?
-      render :partial => 'metagroup_packages'
-    end
-  end
-
-  def collections
-    if params[:package_search_button]
-      search_packages
-      return
-    end
-    set_package_vars
-    @collections = @repository_manager.groups
-    if request.xhr?
-      render :partial => 'collections'
-    end
-  end
-
-  def content_selection
-    set_package_vars(true)
-    @collections = @repository_manager.groups
-    if request.xhr?
-      render :partial => 'software_selection', :locals => {:view => 'collections'}
-    else
-      render :collections
-    end
-  end
-
-  def managed_content
-    if params[:template_id].blank?
-      @tpl = LegacyTemplate.new
-      check_create_permission
-    else
-      @tpl = LegacyTemplate.find(params[:template_id])
-      check_edit_permission
-    end
-    @tpl.add_software(params[:packages].to_a + params[:selected_packages].to_a,
-                      params[:groups].to_a + params[:selected_groups].to_a)
-    render :layout => false
-  end
-
-  def legacy_assembly
-    # FIXME: do we need perm check here?
-  end
-
-  def deployment_definition
-    # FIXME: do we need perm check here?
-    @all_targets = ProviderType.all(:conditions => {:build_supported => true})
-  end
-
-  def remove_package
-    params[:packages].delete(params[:name]) unless params[:name].blank?
-    if params[:tpl] and not params[:tpl][:id].blank?
-      @tpl = LegacyTemplate.find(params[:tpl][:id])
-      check_edit_permission
-      @tpl.attributes = params[:tpl]
-    else
-      @tpl = LegacyTemplate.new(params[:tpl])
-      check_create_permission
-    end
-    @tpl.add_software(params[:packages].to_a, params[:groups].to_a)
-    @repository_manager = RepositoryManager.new(:repositories => params[:repository] || @tpl.platform)
-    render :action => @tpl.id ? :edit : :new
-  end
-
-  def multi_destroy
-    destroyed = []
-    failed = []
-    LegacyTemplate.find(params[:selected]).each do |template|
-      if check_privilege(Privilege::MODIFY, template) and template.destroy
-        destroyed << template.name
-      else
-        failed << template.name
-      end
-    end
-
-    unless destroyed.empty?
-      flash[:notice] = t('legacy_templates.index.deleted', :count => destroyed.length, :list => destroyed.join(', '))
-    end
-    unless failed.empty?
-      flash[:error] = t('legacy_templates.index.not_deleted', :count => failed.length, :list => failed.join(', '))
-    end
-    redirect_to legacy_templates_url
-  end
-
-  protected
-
-  def load_images(tpl)
-    @targets_not_built = {}
-
-    Provider.all.each do |p|
-      @targets_not_built[p.provider_type.id] = p.provider_type.name
-    end
-
-    tpl.legacy_images.each do |img|
-      @targets_not_built.delete(img.provider_type_id)
-    end
-    @targets_not_built = @targets_not_built.invert
-
-    @images = tpl.legacy_images
-  end
-
-  def set_view_vars
-    @header = [
-      {:name => 'NAME', :sort_attr => 'name'},
-      {:name => 'OS', :sort_attr => 'platform'},
-      {:name => 'VERSION', :sort_attr => 'platform_version'},
-      {:name => 'BOOTABLE', :sortable => false},
-      {:name => 'ARCH', :sort_attr => 'architecture'},
-    ]
-
-    @url_params = params.clone
-  end
-
-  def load_legacy_templates
-    @legacy_templates = LegacyTemplate.list_for_user(current_user,
-                                        Privilege::VIEW,
-                                        :include => :legacy_images,
-                                        :order => get_order('name')
-                                        )
-  end
-
-  def set_package_vars(set_all = false)
-    id = params[:id] || (params[:tpl] && params[:tpl][:id]) || nil
-    if id.blank?
-      @tpl = LegacyTemplate.new
-      check_create_permission
-    else
-      @tpl = LegacyTemplate.find(id)
-      check_edit_permission
-    end
-    @tpl.attributes = params[:tpl] unless params[:tpl].nil?
-    @repository_manager = RepositoryManager.new(:repositories => params[:repository] || @tpl.platform)
-    @groups = @repository_manager.groups
-    @categories = @repository_manager.categories if not request.xhr? or set_all
-    @metagroups = @repository_manager.metagroups if not request.xhr? or set_all
-    @tpl.add_software(params[:packages].to_a, params[:groups].to_a)
-  end
-
-  def get_order(default)
-    @order_dir = params[:order_dir] == 'desc' ? 'desc' : 'asc'
-    @order_field = params[:order_field] || default
-    "#{@order_field} #{@order_dir}"
-  end
-
-  def flash_error(summary, errs)
-    flash.now[:error] ||= {}
-    flash.now[:error][:summary] = summary
-    flash.now[:error][:failures] ||= {}
-    flash.now[:error][:failures].merge!(errs)
-  end
-
-  def check_create_permission
-    require_privilege(Privilege::CREATE, LegacyTemplate)
-  end
-
-  def check_edit_permission
-    require_privilege(Privilege::MODIFY, @tpl)
-  end
-
-  def get_selected_id
-    ids = params[:ids].to_a
-    if ids.size != 1
-      flash[:warning] = ids.empty? ? 'No Template Selected' : 'You can select only one template'
-      return
-    end
-    return ids.first
-  end
-
-  def get_page
-    if params[:page] == 'Previous'
-      return params[:old_page].to_i - 1
-    elsif params[:page] == 'Next'
-      return params[:old_page].to_i + 1
-    else
-      return params[:page].blank? ? 1 : params[:page].to_i
-    end
-  end
-
-end
diff --git a/src/app/controllers/pool_families_controller.rb b/src/app/controllers/pool_families_controller.rb
index bd57b2e..c8acdc8 100644
--- a/src/app/controllers/pool_families_controller.rb
+++ b/src/app/controllers/pool_families_controller.rb
@@ -3,7 +3,6 @@ class PoolFamiliesController < ApplicationController
   before_filter :set_params_and_header, :only => [:index, :show]
   before_filter :load_pool_families, :only =>[:show]
   before_filter :load_tab_captions_and_details_tab, :only => [:show]
-  layout 'application'
 
   def top_section
     :administer
diff --git a/src/app/controllers/pools_controller.rb b/src/app/controllers/pools_controller.rb
index 594fdac..1068bd2 100644
--- a/src/app/controllers/pools_controller.rb
+++ b/src/app/controllers/pools_controller.rb
@@ -2,7 +2,6 @@ class PoolsController < ApplicationController
   before_filter :require_user
   before_filter :set_params_and_header, :only => [:index, :show]
   before_filter :load_pools, :only => [:show]
-  layout 'application'
 
   viewstate :index do |default|
     default.merge!({
diff --git a/src/app/controllers/provider_accounts_controller.rb b/src/app/controllers/provider_accounts_controller.rb
index f17ee70..710f5d4 100644
--- a/src/app/controllers/provider_accounts_controller.rb
+++ b/src/app/controllers/provider_accounts_controller.rb
@@ -2,7 +2,6 @@ class ProviderAccountsController < ApplicationController
   before_filter :require_user
   before_filter :load_accounts, :only => [:index,:show]
   before_filter :set_view_vars, :only => [:index,:show]
-  layout 'application'
 
   def top_section
     :administer
diff --git a/src/app/controllers/providers_controller.rb b/src/app/controllers/providers_controller.rb
index 7acaeb8..7364389 100644
--- a/src/app/controllers/providers_controller.rb
+++ b/src/app/controllers/providers_controller.rb
@@ -1,7 +1,6 @@
 class ProvidersController < ApplicationController
   before_filter :require_user
   before_filter :set_view_envs, :only => [:show, :index]
-  layout 'application'
 
   def top_section
     :administer
diff --git a/src/app/controllers/realm_mappings_controller.rb b/src/app/controllers/realm_mappings_controller.rb
index 966942c..18ddce2 100644
--- a/src/app/controllers/realm_mappings_controller.rb
+++ b/src/app/controllers/realm_mappings_controller.rb
@@ -1,6 +1,5 @@
 class RealmMappingsController < ApplicationController
   before_filter :require_user
-  layout 'application'
 
   def top_section
     :administer
diff --git a/src/app/controllers/realms_controller.rb b/src/app/controllers/realms_controller.rb
index 9146c1d..59051fa 100644
--- a/src/app/controllers/realms_controller.rb
+++ b/src/app/controllers/realms_controller.rb
@@ -1,7 +1,6 @@
 class RealmsController < ApplicationController
   before_filter :require_user
   before_filter :load_realms, :only =>[:index, :show]
-  layout 'application'
 
   def top_section
     :administer
diff --git a/src/app/controllers/roles_controller.rb b/src/app/controllers/roles_controller.rb
index 72bd984..89968c3 100644
--- a/src/app/controllers/roles_controller.rb
+++ b/src/app/controllers/roles_controller.rb
@@ -2,7 +2,6 @@ class RolesController < ApplicationController
   before_filter :require_user
   before_filter :load_roles, :only => [:show]
   before_filter :load_params_and_headers, :only => [:index]
-  layout 'application'
 
   def top_section
     :administer
diff --git a/src/app/controllers/settings_controller.rb b/src/app/controllers/settings_controller.rb
index b0e9567..5be3ba9 100644
--- a/src/app/controllers/settings_controller.rb
+++ b/src/app/controllers/settings_controller.rb
@@ -1,6 +1,5 @@
 class SettingsController < ApplicationController
   before_filter :require_user
-  layout 'application'
 
   def top_section
     :administer
diff --git a/src/app/controllers/suggested_deployables_controller.rb b/src/app/controllers/suggested_deployables_controller.rb
index 6ec8251..0404fbc 100644
--- a/src/app/controllers/suggested_deployables_controller.rb
+++ b/src/app/controllers/suggested_deployables_controller.rb
@@ -1,6 +1,5 @@
 class SuggestedDeployablesController < ApplicationController
   before_filter :require_user
-  layout 'application'
 
   def top_section
     :administer
diff --git a/src/app/controllers/users_controller.rb b/src/app/controllers/users_controller.rb
index 106c0eb..1b4f7b5 100644
--- a/src/app/controllers/users_controller.rb
+++ b/src/app/controllers/users_controller.rb
@@ -1,7 +1,6 @@
 class UsersController < ApplicationController
   before_filter :require_user, :except => [:new, :create]
   before_filter :load_users, :only => [:show]
-  layout 'application'
 
   def top_section
     :administer
diff --git a/src/app/helpers/legacy_templates_helper.rb b/src/app/helpers/legacy_templates_helper.rb
deleted file mode 100644
index 10047bc..0000000
--- a/src/app/helpers/legacy_templates_helper.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-module LegacyTemplatesHelper
-  class ButtonPaginationRenderer < WillPaginate::LinkRenderer
-    def page_link(page, text, attributes = {})
-      #submit_tag text, :name => 'page'
-      "<input type=submit value='#{text}' name='page' class='#{attributes[:class]}' />"
-    end
-  end
-end
diff --git a/src/app/models/build_job.rb b/src/app/models/build_job.rb
deleted file mode 100644
index 02f6252..0000000
--- a/src/app/models/build_job.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# Copyright (C) 2011 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.  A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-require 'typhoeus'
-require 'nokogiri'
-
-class BuildJob < Struct.new(:image_id, :hydra)
-  def perform
-    @hydra = hydra
-    @logger = Delayed::Worker.logger
-    @logger.info "--- start ---"
-    @logger.info "BuildJob for image_id: #{image_id}"
-    begin
-      if (@hydra == nil)
-        @hydra = Typhoeus::Hydra.new
-      end
-      image = LegacyImage.find(image_id)
-      request = Typhoeus::Request.new(YAML.load_file("#{RAILS_ROOT}/config/image_factory_console.yml")['buildurl'],
-                                      :method => :post,
-                                      :timeout => 60*1000, # in milliseconds
-                                      :params => {
-                                        :template => image.legacy_template.warehouse_url,
-                                        :target => image.provider_type.codename})
-      request.on_complete do |response|
-        if response.success?
-          @logger.info "success "
-          xml = Nokogiri::XML(response.body)
-          @return_uuid = xml.xpath('//image/uuid').first.text
-          image.uuid = @return_uuid
-          image.save
-          @logger.info "uuid: #{@return_uuid}"
-        else
-          return_uuid = nil
-          @logger.error "failure"
-          @logger.error response.body
-        end
-      end
-      @hydra.queue(request)
-      @hydra.run
-    rescue Exception => e
-      @logger.error "Exception: "
-      @logger.error e
-    end
-    @logger.info "--- done ---"
-    @return_uuid
-  end
-end
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index cd5371f..9251b36 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -1,19 +1,18 @@
 # == Schema Information
-# Schema version: 20110603204130
+# Schema version: 20110616100915
 #
 # Table name: deployments
 #
-#  id                   :integer         not null, primary key
-#  name                 :string(1024)    not null
-#  realm_id             :integer
-#  owner_id             :integer
-#  pool_id              :integer         not null
-#  legacy_deployable_id :integer
-#  lock_version         :integer         default(0)
-#  created_at           :datetime
-#  updated_at           :datetime
-#  frontend_realm_id    :integer
-#  deployable_xml       :text
+#  id                :integer         not null, primary key
+#  name              :string(1024)    not null
+#  realm_id          :integer
+#  owner_id          :integer
+#  pool_id           :integer         not null
+#  lock_version      :integer         default(0)
+#  created_at        :datetime
+#  updated_at        :datetime
+#  frontend_realm_id :integer
+#  deployable_xml    :text
 #
 
 #
@@ -48,7 +47,6 @@ class Deployment < ActiveRecord::Base
 
   belongs_to :pool
 
-  belongs_to :legacy_deployable
   has_many :instances
 
   belongs_to :realm
diff --git a/src/app/models/icicle.rb b/src/app/models/icicle.rb
index 28b857f..dfea6c8 100644
--- a/src/app/models/icicle.rb
+++ b/src/app/models/icicle.rb
@@ -1,14 +1,13 @@
 # == Schema Information
-# Schema version: 20110603204130
+# Schema version: 20110616100915
 #
 # Table name: icicles
 #
-#  id                       :integer         not null, primary key
-#  uuid                     :string(255)
-#  xml                      :text
-#  legacy_provider_image_id :integer
-#  created_at               :datetime
-#  updated_at               :datetime
+#  id         :integer         not null, primary key
+#  uuid       :string(255)
+#  xml        :text
+#  created_at :datetime
+#  updated_at :datetime
 #
 
 class Icicle < ActiveRecord::Base
@@ -16,7 +15,6 @@ class Icicle < ActiveRecord::Base
 
   validates_presence_of :uuid
   validates_uniqueness_of :uuid
-  belongs_to :legacy_provider_image
 
   def self.create_or_update(uuid)
     icicle = Icicle.find_by_uuid(uuid) || Icicle.new(:uuid => uuid)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 95e7519..9c212d1 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -1,5 +1,5 @@
 # == Schema Information
-# Schema version: 20110607104800
+# Schema version: 20110616100915
 #
 # Table name: instances
 #
@@ -7,7 +7,6 @@
 #  external_key            :string(255)
 #  name                    :string(1024)    not null
 #  hardware_profile_id     :integer         not null
-#  legacy_template_id      :integer
 #  frontend_realm_id       :integer
 #  owner_id                :integer
 #  pool_id                 :integer         not null
@@ -29,7 +28,6 @@
 #  time_last_stopped       :datetime
 #  created_at              :datetime
 #  updated_at              :datetime
-#  legacy_assembly_id      :integer
 #  deployment_id           :integer
 #  assembly_xml            :text
 #  image_uuid              :string(255)
@@ -83,8 +81,6 @@ class Instance < ActiveRecord::Base
   belongs_to :deployment
 
   belongs_to :hardware_profile
-  belongs_to :legacy_template
-  belongs_to :legacy_assembly
   belongs_to :frontend_realm
   belongs_to :owner, :class_name => "User", :foreign_key => "owner_id"
   belongs_to :instance_hwp
@@ -138,13 +134,6 @@ class Instance < ActiveRecord::Base
   # changed if called from another Aeolus component, so attr_protected isn't quite what we want:
   USER_MUTABLE_ATTRS = ['name']
 
-  def validate
-    if legacy_assembly and legacy_template
-      errors.add(:legacy_assembly, "Please specify either template or legacy_assembly, but not both")
-      errors.add(:legacy_template, "Please specify either template or legacy_assembly, but not both")
-    end
-  end
-
   def object_list
     super + [pool, deployment]
   end
@@ -310,7 +299,7 @@ class Instance < ActiveRecord::Base
 
   def self.list_or_search(query,order_field,order_dir)
     if query.blank?
-      instances = Instance.all(:include => [ :legacy_template, :owner ],
+      instances = Instance.all(:include => [ :owner ],
                                :order => (order_field || 'name') +' '+ (order_dir || 'asc'))
     else
       instances = search() { keywords(query) }.results
diff --git a/src/app/models/legacy_assembly.rb b/src/app/models/legacy_assembly.rb
deleted file mode 100644
index 6c663c7..0000000
--- a/src/app/models/legacy_assembly.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-# == Schema Information
-# Schema version: 20110603204130
-#
-# Table name: legacy_assemblies
-#
-#  id           :integer         not null, primary key
-#  uuid         :string(255)     not null
-#  xml          :binary          not null
-#  uri          :string(255)
-#  name         :string(255)
-#  architecture :string(255)
-#  summary      :text
-#  uploaded     :boolean
-#  lock_version :integer         default(0)
-#  created_at   :datetime
-#  updated_at   :datetime
-#  owner_id     :integer
-#
-
-#
-# Copyright (C) 2011 Red Hat, Inc.
-# Written by Scott Seago <sseago@redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.  A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-require 'sunspot_rails'
-class LegacyAssembly < ActiveRecord::Base
-  include PermissionedObject
-  include ImageWarehouseObject
-  searchable do
-    text :name, :as => :code_substring
-    text :architecture, :as => :code_substring
-    text :summary, :as => :code_substring
-  end
-
-  has_and_belongs_to_many :legacy_templates
-  has_and_belongs_to_many :legacy_deployables
-  has_and_belongs_to_many :legacy_templates
-  has_and_belongs_to_many :deployables
-  has_many :instances
-
-  has_many :permissions, :as => :permission_object, :dependent => :destroy,
-           :include => [:role],
-           :order => "permissions.id ASC"
-  belongs_to :owner, :class_name => "User", :foreign_key => "owner_id"
-  after_create "assign_owner_roles(owner)"
-
-  before_validation :generate_uuid
-  before_save :update_xml
-
-  validates_presence_of :uuid
-  validates_uniqueness_of :uuid
-  validates_presence_of :name
-  validates_uniqueness_of :name
-  validates_length_of   :name, :maximum => 255
-  validates_presence_of :architecture
-  validates_presence_of :owner_id
-
-  def self.default_privilege_target_type
-    LegacyTemplate
-  end
-
-  def update_xml
-    xml.name = self.name
-    xml.description = self.summary
-    xml.architecture = self.architecture
-    write_attribute(:xml, xml.to_xml)
-  end
-
-  def self.find_or_create(id)
-    id ? LegacyAssembly.find(id) : LegacyAssembly.new
-  end
-
-end
diff --git a/src/app/models/legacy_deployable.rb b/src/app/models/legacy_deployable.rb
deleted file mode 100644
index aa68faf..0000000
--- a/src/app/models/legacy_deployable.rb
+++ /dev/null
@@ -1,95 +0,0 @@
-# == Schema Information
-# Schema version: 20110603204130
-#
-# Table name: legacy_deployables
-#
-#  id           :integer         not null, primary key
-#  name         :string(255)
-#  created_at   :datetime
-#  updated_at   :datetime
-#  lock_version :integer         default(0)
-#  uuid         :string(255)     not null
-#  xml          :binary          not null
-#  uri          :string(255)
-#  summary      :text
-#  uploaded     :boolean
-#  owner_id     :integer
-#
-
-#
-# Copyright (C) 2011 Red Hat, Inc.
-# Written by Scott Seago <sseago@redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.  A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-require 'sunspot_rails'
-class LegacyDeployable < ActiveRecord::Base
-  include PermissionedObject
-  include ImageWarehouseObject
-  searchable do
-    text :name, :as => :code_substring
-    text :summary, :as => :code_substring
-  end
-
-  has_and_belongs_to_many :legacy_assemblies
-  has_many :deployments
-
-  has_many :permissions, :as => :permission_object, :dependent => :destroy,
-           :include => [:role],
-           :order => "permissions.id ASC"
-  belongs_to :owner, :class_name => "User", :foreign_key => "owner_id"
-  after_create "assign_owner_roles(owner)"
-
-  before_validation :generate_uuid
-  before_save :update_xml
-
-  validates_presence_of :uuid
-  validates_uniqueness_of :uuid
-  validates_presence_of :name
-  validates_uniqueness_of :name
-  validates_length_of   :name, :maximum => 255
-  validates_presence_of :owner_id
-
-  before_destroy :destroyable?
-
-  def self.default_privilege_target_type
-    LegacyTemplate
-  end
-
-  def update_xml
-    xml.name = self.name
-    xml.description = self.summary
-    write_attribute(:xml, xml.to_xml)
-  end
-
-  def self.find_or_create(id)
-    id ? LegacyDeployable.find(id) : LegacyDeployable.new
-  end
-
-  def destroyable?
-    deployments.all? {|d| d.destroyable? }
-  end
-
-  def launchable?
-    return false if legacy_assemblies.empty?
-    legacy_assemblies.each do |a|
-      return false if a.legacy_templates.empty?
-      # TODO: should we check if there is an uploaded image for each template in
-      # assembly?
-    end
-    return true
-  end
-end
diff --git a/src/app/models/legacy_image.rb b/src/app/models/legacy_image.rb
deleted file mode 100644
index 61ca46e..0000000
--- a/src/app/models/legacy_image.rb
+++ /dev/null
@@ -1,245 +0,0 @@
-# == Schema Information
-# Schema version: 20110603204130
-#
-# Table name: legacy_images
-#
-#  id                 :integer         not null, primary key
-#  uuid               :string(255)
-#  name               :string(255)     not null
-#  build_id           :string(255)
-#  uri                :string(255)
-#  status             :string(255)
-#  legacy_template_id :integer
-#  created_at         :datetime
-#  updated_at         :datetime
-#  provider_type_id   :integer         default(100), not null
-#
-
-#
-# Copyright (C) 2009 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.  A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-# Filters added to this controller apply to all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
-
-class ImageExistsError < Exception;end
-
-class LegacyImage < ActiveRecord::Base
-  include SearchFilter
-  include ImageWarehouseObject
-
-  before_save :generate_uuid
-
-  cattr_reader :per_page
-  @@per_page = 15
-
-  belongs_to :legacy_template, :counter_cache => true
-  has_many :legacy_provider_images, :dependent => :destroy
-  has_many :providers, :through => :legacy_provider_images
-  belongs_to :provider_type
-
-  validates_presence_of :name
-  validates_length_of :name, :maximum => 1024
-  validates_presence_of :status
-  validates_presence_of :legacy_template_id
-  validates_presence_of :provider_type_id
-
-  validates_uniqueness_of :legacy_template_id, :scope => :provider_type_id
-
-  SEARCHABLE_COLUMNS = %w(name)
-
-  STATE_QUEUED = 'queued'
-  STATE_CREATED = 'created'
-  STATE_BUILDING = 'building'
-  STATE_COMPLETED = 'completed'
-  STATE_CANCELED = 'canceled'
-  STATE_FAILED = 'failed'
-
-  ACTIVE_STATES = [ STATE_QUEUED, STATE_CREATED, STATE_BUILDING ]
-  INACTIVE_STATES = [STATE_COMPLETED, STATE_FAILED, STATE_CANCELED]
-
-  def generate_uuid
-    self.uuid ||= "image-#{self.legacy_template_id}-#{Time.now.to_f.to_s}"
-  end
-
-  # TODO: for now when build is finished we call upload automatically for all providers
-  def after_update
-    if not self.new_record? and self.status_changed? and self.status == STATE_COMPLETED
-      safe_warehouse_sync
-      upload_to_all_providers_with_account
-    end
-  end
-
-  def rebuild!
-    # TODO: remove this check when we have UI for pushing images
-    if self.provider_type.providers.empty? or not self.provider_type.providers.detect {|p| !p.provider_accounts.empty?}
-      raise "Error: A valid provider and provider account are required to create and build legacy_templates"
-    end
-    self.status = STATE_QUEUED
-    self.save!
-    self.legacy_provider_images.each {|pimg| pimg.destroy}
-    Delayed::Job.enqueue(BuildJob.new(self.id))
-  end
-
-  def not_uploaded_providers
-    uploaded = self.legacy_provider_images
-    Provider.all(:conditions => {:provider_type_id => self.provider_type.id}).select do |p|
-      not uploaded.detect {|pimg| pimg.provider_id == p.id}
-    end
-  end
-
-  def self.create_and_build!(legacy_template, provider_type)
-    if LegacyImage.find_by_legacy_template_id_and_provider_type_id(legacy_template.id, provider_type.id)
-      raise ImageExistsError,  "An attempted build of this template for the target '#{provider_type.name}' already exists"
-    end
-    # TODO: remove this check when we have UI for pushing images
-    if provider_type.providers.empty? or not provider_type.providers.detect {|p| !p.provider_accounts.empty?}
-      raise "Error: A valid provider and provider account are required to create and build legacy_templates"
-    end
-    img = LegacyImage.create!(
-      :name => "#{legacy_template.name}/#{provider_type.codename}",
-      :provider_type_id => provider_type.id,
-      :legacy_template_id => legacy_template.id,
-      :status => LegacyImage::STATE_QUEUED
-    )
-    Delayed::Job.enqueue(BuildJob.new(img.id))
-    img
-  end
-  def self.single_import(providername, username, password, image_id, user)
-    account = LegacyImage.get_account(providername, username, password)
-    LegacyImage.import(account, image_id, user)
-  end
-
-  def self.bulk_import(providername, username, password, images, user)
-    account = LegacyImage.get_account(providername, username, password)
-    images.each do |image|
-      begin
-        LegacyImage.import(account, image['id'], user)
-        $stderr.puts "imported image with id '#{image['id']}'"
-      rescue
-        $stderr.puts "failed to import image with id '#{image['id']}'"
-      end
-    end
-  end
-
-  def self.import(account, image_id, user)
-    if image_id.blank?
-      raise "image id should not be blank"
-    end
-    unless raw_image = account.connect.image(image_id)
-      raise "There is no image with '#{image_id}' id"
-    end
-
-    if LegacyProviderImage.find_by_provider_id_and_provider_image_key(account.provider.id, image_id)
-      raise "Image '#{image_id}' is already imported"
-    end
-
-    image = nil
-    ActiveRecord::Base.transaction do
-      template = LegacyTemplate.new(
-        :name             => raw_image.name + '_template',
-        :summary          => raw_image.description,
-        :platform_hash    => {:platform => 'unknown',
-                              :version => 'unknown',
-                              :architecture => raw_image.architecture},
-        :complete         => true,
-        :uploaded         => true,
-        :imported         => true,
-        :owner            => user
-      )
-      template.save!
-
-      image = LegacyImage.new(
-        :name         => raw_image.name,
-        :status       => STATE_COMPLETED,
-        :provider_type_id => account.provider.provider_type_id,
-        :legacy_template_id  => template.id
-      )
-      image.generate_uuid
-      image.upload
-      image.save!
-
-      rep = LegacyProviderImage.new(
-        :legacy_image_id           => image.id,
-        :provider_id        => account.provider.id,
-        :provider_image_key => image_id,
-        :status             => STATE_COMPLETED
-      )
-      rep.generate_uuid
-      rep.upload
-      rep.save!
-
-    end
-    image
-  end
-
-  def warehouse_bucket
-    'images'
-  end
-
-  def warehouse_sync
-    bucket = warehouse.bucket(warehouse_bucket)
-    raise WarehouseObjectNotFoundError unless bucket.include?(self.uuid)
-    obj = bucket.object(self.uuid)
-    attrs = obj.attrs([:uuid, :target, :template])
-    unless attrs[:target]
-      raise "target uuid is not set"
-    end
-    unless ptype = ProviderType.find_by_codename(attrs[:target])
-      raise "provider type #{attrs[:target]} not found"
-    end
-    unless attrs[:template]
-      raise "template uuid is not set"
-    end
-    unless tpl = LegacyTemplate.find_by_uuid(attrs[:template])
-      raise "Template with uuid #{attrs[:template]} not found"
-    end
-    self.provider_type_id = ptype.id
-    self.legacy_template_id = tpl.id
-  end
-
-  private
-
-  def upload_to_all_providers_with_account
-    provider_type.providers.each do |p|
-      # upload only to providers with account
-      unless p.provider_accounts.empty?
-        pimg = LegacyProviderImage.create!(
-          :legacy_image => self,
-          :provider => p,
-          :status => LegacyProviderImage::STATE_QUEUED
-        )
-        Delayed::Job.enqueue(PushJob.new(pimg.id))
-      end
-    end
-  end
-
-  def self.get_account(providername, username, password)
-    unless provider = Provider.find_by_name(providername)
-      raise "There is not provider with name '#{providername}'"
-    end
-
-    account = ProviderAccount.new(:provider => provider)
-    account.credentials_hash = {:username => username, :password => password}
-
-    unless account.valid_credentials?
-      raise "Invalid credentials for provider '#{providername}'"
-    end
-
-    return account
-  end
-end
diff --git a/src/app/models/legacy_provider_image.rb b/src/app/models/legacy_provider_image.rb
deleted file mode 100644
index cc25944..0000000
--- a/src/app/models/legacy_provider_image.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-# == Schema Information
-# Schema version: 20110603204130
-#
-# Table name: legacy_provider_images
-#
-#  id                 :integer         not null, primary key
-#  legacy_image_id    :integer         not null
-#  provider_id        :integer         not null
-#  provider_image_key :string(255)
-#  uuid               :string(255)
-#  status             :string(255)
-#
-
-class LegacyProviderImage < ActiveRecord::Base
-  include ImageWarehouseObject
-
-  belongs_to :provider
-  belongs_to :legacy_image
-  has_one :icicle, :dependent => :destroy
-
-  validates_presence_of :provider_id
-  validates_presence_of :legacy_image_id
-  validates_uniqueness_of :uuid, :allow_nil => true
-  validates_uniqueness_of :legacy_image_id, :scope => :provider_id
-
-  STATE_QUEUED = 'queued'
-  STATE_COMPLETED = 'completed'
-  STATE_CANCELED = 'canceled'
-  STATE_FAILED = 'failed'
-
-  ACTIVE_STATES = [ STATE_QUEUED ]
-  INACTIVE_STATES = [STATE_COMPLETED, STATE_FAILED, STATE_CANCELED]
-
-  def after_update
-    if self.status_changed? and self.status == STATE_COMPLETED
-      safe_warehouse_sync
-    end
-  end
-
-  def retry_upload!
-    self.status = STATE_QUEUED
-    self.save!
-    Delayed::Job.enqueue(PushJob.new(self.id))
-  end
-
-  def warehouse_bucket
-    'legacy_provider_images'
-  end
-
-  def warehouse_sync
-    bucket = warehouse.bucket(warehouse_bucket)
-    raise WarehouseObjectNotFoundError unless bucket.include?(self.uuid)
-    obj = bucket.object(self.uuid)
-    attrs = obj.attrs([:uuid, :image, :icicle, :target_identifier])
-    unless attrs[:image]
-      raise "image uuid is not set"
-    end
-    unless img = LegacyImage.find_by_uuid(attrs[:image])
-      raise "image with uuid #{attrs[:image]} not found"
-    end
-    begin
-      self.icicle = Icicle.create_or_update(attrs[:icicle])
-    rescue
-      logger.error "Failed to fetch icicle '#{attrs[:icicle]}', setting icicle to nil: #{$!.message}"
-    end
-    self.legacy_image_id = img.id
-    self.provider_image_key = attrs[:target_identifier]
-  end
-end
diff --git a/src/app/models/legacy_template.rb b/src/app/models/legacy_template.rb
deleted file mode 100644
index 3fbf137..0000000
--- a/src/app/models/legacy_template.rb
+++ /dev/null
@@ -1,187 +0,0 @@
-# == Schema Information
-# Schema version: 20110603204130
-#
-# Table name: legacy_templates
-#
-#  id                  :integer         not null, primary key
-#  uuid                :string(255)     not null
-#  xml                 :binary          not null
-#  uri                 :string(255)
-#  name                :string(255)
-#  platform            :string(255)
-#  platform_version    :string(255)
-#  architecture        :string(255)
-#  summary             :text
-#  complete            :boolean
-#  uploaded            :boolean
-#  imported            :boolean
-#  legacy_images_count :integer
-#  created_at          :datetime
-#  updated_at          :datetime
-#  owner_id            :integer
-#
-
-require 'util/image_descriptor_xml'
-require 'typhoeus'
-
-class LegacyTemplate < ActiveRecord::Base
-  include PermissionedObject
-  include ImageWarehouseObject
-
-  searchable do
-    text :name, :as => :code_substring
-    text :platform, :as => :code_substring
-    text :platform_version, :as => :code_substring
-    text :architecture, :as => :code_substring
-    text :summary, :as => :code_substring
-  end
-
-  has_many :legacy_images, :dependent => :destroy
-  has_many :instances
-  has_and_belongs_to_many :legacy_assemblies
-  before_validation :generate_uuid
-  before_save [:update_xml, :upload]
-  before_destroy [:no_instances?, :delete_in_warehouse]
-
-  has_many :permissions, :as => :permission_object, :dependent => :destroy,
-           :include => [:role],
-           :order => "permissions.id ASC"
-  belongs_to :owner, :class_name => "User", :foreign_key => "owner_id"
-  after_create "assign_owner_roles(owner)"
-  after_create :ensure_legacy_assembly
-
-  validates_presence_of :uuid
-  validates_uniqueness_of :uuid
-  validates_presence_of :name
-  validates_uniqueness_of :name
-  validates_length_of   :name, :maximum => 255
-  validates_presence_of :platform
-  validates_presence_of :platform_version
-  validates_presence_of :architecture
-  validates_presence_of :owner_id
-
-  def no_instances?
-    unless instances.empty?
-      errors.add(:base, 'There are instances for this template.')
-      return false
-    end
-
-    true
-  end
-
-  def update_xml
-    xml.name = self.name
-    xml.description = self.summary
-    xml.platform = {
-      'id'      => self.platform,
-      'name'    => platforms[self.platform] ? platforms[self.platform]['name'] : '',
-      'version' => self.platform_version,
-      'arch'    => self.architecture,
-    }
-    write_attribute(:xml, xml.to_xml)
-  end
-
-  def update_from_xml
-    self.name = xml.name
-    self.summary = xml.description
-    self.platform_hash = {
-      :platform => xml.platform,
-      :version => xml.platform_version,
-      :architecture => xml.architecture,
-    }
-  end
-
-  def providers
-    # TODO: rewrite cleanly
-    LegacyProviderImage.all(
-      :include => [:legacy_image, :provider],
-      :conditions => {:legacy_images => {:legacy_template_id => self.id}}
-    ).map {|p| p.provider}
-  end
-
-  def self.find_or_create(id)
-    id ? LegacyTemplate.find(id) : LegacyTemplate.new
-  end
-
-  def set_complete
-    update_attributes(:complete => true, :uploaded => false)
-  end
-
-  def platforms
-    @platforms ||= YAML.load_file("#{RAILS_ROOT}/config/image_descriptor_platform_repositories.yml")
-  end
-
-  def add_packages(packages)
-    packages.to_a.each {|pkg| xml.add_package(pkg)}
-  end
-
-  def add_groups(groups)
-    groups.to_a.each {|pkg| xml.add_group(pkg)}
-  end
-
-  def add_software(packages, groups)
-    add_packages(packages)
-    add_groups(groups)
-  end
-
-  # sets platform info from predefined platform list
-  def platform=(plat)
-    write_attribute(:platform, plat)
-    self.platform_version = platforms[plat]['version'].to_s
-    self.architecture = platforms[plat]['architecture']
-  end
-
-  def platform_name
-    platforms[self.platform] ? platforms[self.platform]['name'] : ''
-  end
-
-  # sets platform info from hash (used when importing images)
-  def platform_hash=(plat)
-    write_attribute(:platform, plat[:platform])
-    self.platform_version = plat[:version]
-    self.architecture = plat[:architecture]
-  end
-
-  # packages and groups are virtual attributes
-  def packages
-    xml.packages
-  end
-
-  def packages=(packages)
-    xml.clear_packages
-    packages.to_a.each {|pkg| xml.add_package(pkg)}
-  end
-
-  def groups
-    xml.groups
-  end
-
-  def groups=(groups)
-    xml.clear_groups
-    groups.to_a.each {|group| xml.add_group(group)}
-  end
-
-  def warehouse_body
-    self.xml.to_xml
-  end
-
-  def warehouse_bucket
-    'templates'
-  end
-
-  def warehouse_sync
-    obj = warehouse.bucket(warehouse_bucket).object(self.uuid)
-    xml = obj.body
-    update_from_xml
-  end
-
-  private
-
-  def ensure_legacy_assembly
-    self.legacy_assemblies.create!({
-      :name => self.name,
-      :architecture => self.architecture,
-      :owner => self.owner
-    }) unless self.legacy_assemblies.count > 0
-  end
-end
diff --git a/src/app/models/permission.rb b/src/app/models/permission.rb
index 02b142b..c7e7c38 100644
--- a/src/app/models/permission.rb
+++ b/src/app/models/permission.rb
@@ -59,12 +59,6 @@ class Permission < ActiveRecord::Base
                                       :foreign_key => "permission_object_id"
   belongs_to :provider_account,          :class_name => "ProviderAccount",
                                       :foreign_key => "permission_object_id"
-  belongs_to :legacy_template,               :class_name => "LegacyTemplate",
-                                      :foreign_key => "permission_object_id"
-  belongs_to :legacy_assembly,               :class_name => "LegacyAssembly",
-                                      :foreign_key => "permission_object_id"
-  belongs_to :legacy_deployable,             :class_name => "LegacyDeployable",
-                                      :foreign_key => "permission_object_id"
   belongs_to :base_permission_object, :class_name => "BasePermissionObject",
                                       :foreign_key => "permission_object_id"
 
diff --git a/src/app/models/privilege.rb b/src/app/models/privilege.rb
index c0c46a5..22f1eeb 100644
--- a/src/app/models/privilege.rb
+++ b/src/app/models/privilege.rb
@@ -53,7 +53,6 @@ class Privilege < ActiveRecord::Base
   ACTIONS = [ CREATE, MODIFY, USE, VIEW,
               PERM_SET, PERM_VIEW]
   TYPES   = { BasePermissionObject => [MODIFY, PERM_SET, PERM_VIEW],
-              LegacyTemplate => ACTIONS,
               Pool => ACTIONS - [USE],
               PoolFamily => ACTIONS - [USE],
               Instance => ACTIONS,
diff --git a/src/app/models/provider.rb b/src/app/models/provider.rb
index f1e648e..c937533 100644
--- a/src/app/models/provider.rb
+++ b/src/app/models/provider.rb
@@ -45,7 +45,6 @@ class Provider < ActiveRecord::Base
 
   has_many :provider_accounts, :dependent => :destroy
   has_many :hardware_profiles, :dependent => :destroy
-  has_many :legacy_provider_images, :dependent => :destroy
   has_many :realms, :dependent => :destroy
   has_many :realm_backend_targets, :as => :realm_or_provider
   has_many :frontend_realms, :through => :realm_backend_targets
diff --git a/src/app/models/provider_type.rb b/src/app/models/provider_type.rb
index e60ad0e..e1f8668 100644
--- a/src/app/models/provider_type.rb
+++ b/src/app/models/provider_type.rb
@@ -16,7 +16,6 @@
 class ProviderType < ActiveRecord::Base
 
   has_many :providers
-  has_many :legacy_images
   has_many :credential_definitions, :dependent => :destroy
 
   validates_presence_of :name
diff --git a/src/app/models/push_job.rb b/src/app/models/push_job.rb
deleted file mode 100644
index 953828e..0000000
--- a/src/app/models/push_job.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# Copyright (C) 2011 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.  A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-require 'rest_client'
-require 'nokogiri'
-
-class PushJob < Struct.new(:legacy_provider_image_id, :hydra)
-  def perform
-    @logger = Delayed::Worker.logger
-    @logger.info "--- start ---"
-    @logger.info "PushJob for legacy_provider_image_id: #{legacy_provider_image_id}"
-    provider_image = LegacyProviderImage.find(legacy_provider_image_id)
-    # TODO: what if a provider has multiple accounts
-    # for now pick first account
-    provider_account = provider_image.provider.provider_accounts.first
-    cred_block = provider_account.build_credentials.to_xml.html_safe
-    response = RestClient.post(YAML.load_file("#{RAILS_ROOT}/config/image_factory_console.yml")['pushurl'], :image_id => provider_image.legacy_image.uuid,
-                      :provider => provider_image.provider.name,
-                      :credentials => cred_block
-                    )
-    if response.code==200
-      @logger.info "success "
-      xml = Nokogiri::XML(response.body)
-      @return_uuid = xml.xpath('//image/uuid').first.text
-      provider_image.uuid = @return_uuid
-      provider_image.save
-      @logger.info "uuid: #{@return_uuid}"
-    else
-      @logger.error "failure"
-      @logger.error response.body
-      # TODO: raise an error and capture it somewhere
-    end
-    @return_uuid
-  end
-end
diff --git a/src/app/models/suggested_deployable.rb b/src/app/models/suggested_deployable.rb
index fb32113..c368d36 100644
--- a/src/app/models/suggested_deployable.rb
+++ b/src/app/models/suggested_deployable.rb
@@ -1,5 +1,5 @@
 # == Schema Information
-# Schema version: 20110607104800
+# Schema version: 20110616100915
 #
 # Table name: suggested_deployables
 #
@@ -7,6 +7,7 @@
 #  name        :string(1024)    not null
 #  description :text            not null
 #  url         :string(255)
+#  owner_id    :integer
 #
 
 class SuggestedDeployable < ActiveRecord::Base
diff --git a/src/app/util/image_descriptor_xml.rb b/src/app/util/image_descriptor_xml.rb
deleted file mode 100644
index dd2f33c..0000000
--- a/src/app/util/image_descriptor_xml.rb
+++ /dev/null
@@ -1,238 +0,0 @@
-#
-# Copyright (C) 2009 Red Hat, Inc.
-# Written by Jan Provaznik <jprovazn@redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.  A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-require 'yaml'
-require 'util/repository_manager'
-
-class ImageDescriptorXML
-
-  UNKNOWN_GROUP = 'Individual packages'
-
-  def initialize(xmlstr = "")
-    @doc = Nokogiri::XML(xmlstr)
-    # create at least root node if it doesn't exist
-    unless @doc.root
-      @doc.root = Nokogiri::XML::Node.new('template', @doc)
-    end
-    @root = @doc.root.at_xpath('/template')
-  end
-
-  def name=(str)
-    node = get_or_create_node('name')
-    node.content = str
-  end
-
-  def name
-    return get_node_text('name')
-  end
-
-  def description=(str)
-    node = get_or_create_node('description')
-    node.content = str
-  end
-
-  def description
-    return get_node_text('description')
-  end
-
-  def platform
-    return get_node_text('os/name')
-  end
-
-  def platform=(platform_hash)
-    # FIXME: we remove all repos because we don't know which one is for
-    # platform
-    # update: we don't add platform repo, image builder chooses right one from OS
-    # name, but we add all other repos
-    #recreate_repo_nodes
-    platform_node = get_or_create_node('os')
-    platform_node.xpath('.//*').remove
-    platform_id = platform_hash.delete('id')
-    platform_hash.each do |key, value|
-      snode = Nokogiri::XML::Node.new(key, @doc)
-      platform_node << snode
-      snode.content = value
-    end
-    install_node = Nokogiri::XML::Node.new('install', @doc)
-    install_node.set_attribute('type', 'url')
-    platform_node << install_node
-    url_node = Nokogiri::XML::Node.new('url', @doc)
-    # TODO - currently we have platform repositories and package repositories,
-    # mainly because it was possible to have multiple package repositories for
-    # a platform before. Also platform url wasn't needed for old imagefactory.
-    # Should be reworked when we switch to pulp
-    rep = repository_manager.repositories.find {|r| r.id == platform_id}
-    url_node.content = rep.yumurl if rep
-    install_node << url_node
-    custom_repositories(platform_id)
-  end
-
-  def custom_repositories(platform)
-    repos = repository_manager.repositories.find_all {|r| r.platform_id == platform && r.install == false}.flatten
-    if repos.size > 0
-      repo_block = get_or_create_node('repositories')
-      repo_block.xpath('.//*').remove
-      @root << repo_block
-      repos.each do |r|
-        repo_node = Nokogiri::XML::Node.new('repository', @doc)
-        repo_node['name'] = 'custom'
-        repo_block << repo_node
-        url_node = Nokogiri::XML::Node.new('url', repo_node)
-        url_node.content = r.baseurl
-        signed_node = Nokogiri::XML::Node.new('signed', repo_node)
-        signed_node.content = 'false'
-        repo_node << url_node
-        repo_node << signed_node
-      end
-    end
-  end
-
-  def platform_version
-    return get_node_text('os/version')
-  end
-
-  def architecture
-    return get_node_text('os/arch')
-  end
-
-  def architecture=(str)
-    node = get_or_create_node('arch', get_or_create_node('os'))
-    node.content = str
-  end
-
-  def services=(services)
-    service_node = get_or_create_node('services')
-    service_node.xpath('.//service').remove
-    platform_hash.each do |key, value|
-      snode = Nokogiri::XML::Node.new(key, @doc)
-      platform_node << snode
-      snode.content = value
-    end
-  end
-
-  def services=(services)
-    service_node = get_or_create_node('services')
-    service_node.xpath('.//service').remove
-    services.each do |s|
-      snode = Nokogiri::XML::Node.new('service', @doc)
-      service_node << snode
-      snode.content = s[0]
-    end
-    @services = nil
-  end
-
-  def services
-    unless @services
-      @services = []
-      @root.xpath('/template/services/service').each do |s|
-        services << s.text
-      end
-    end
-    return @services
-  end
-
-  def to_xml
-    return @doc.to_xml
-  end
-
-  def packages
-    @root.xpath('/template/packages/package').map do |s|
-      s.attr('name').to_s
-    end
-  end
-
-  def groups
-    @root.xpath('/template/groups/group').map do |s|
-      s.attr('name').to_s
-    end
-  end
-
-  def add_package(pkg)
-    pkgs_node = get_or_create_node('packages')
-    add_package_node(pkgs_node, pkg) unless packages.include?(pkg)
-  end
-
-  def add_group(gname)
-    # FIXME: this is temporary hack until we have new design:
-    # when adding group, we add particular group packages
-    # instead of whole group
-    unless group = repository_manager.groups.find {|g| g[:id] == gname}
-      raise "group #{gname} not found in repositories"
-    end
-    group[:packages].keys.each {|p| add_package(p)}
-    #node = get_or_create_node('groups')
-    #add_group_node(node, gname) unless groups.include?(gname)
-  end
-
-  def remove_package(package)
-    @root.xpath('/template/packages/package').each do |s|
-      if name = s.at_xpath('.//name') and name.text.to_s == package
-        s.remove
-      end
-    end
-  end
-
-  def clear_packages
-    @root.xpath('/template/packages').each { |s| s.remove }
-  end
-
-  def clear_groups
-    @root.xpath('/template/groups').each { |s| s.remove }
-  end
-
-  private
-
-  def add_group_node(parent, group)
-    pnode = get_or_create_node('group', parent)
-    pnode['name'] = group
-    pnode
-  end
-
-  def recreate_repo_nodes
-    repo_node = get_or_create_node('repos')
-    repo_node.xpath('.//repo').remove
-    repository_manager.repositories.each do |repo|
-      rnode = get_or_create_node('repo', repo_node)
-      rnode.content = repo.yumurl
-    end
-  end
-
-  def get_or_create_node(name, parent = @root)
-    unless node = @root.at_xpath(name)
-      node = Nokogiri::XML::Node.new(name, @doc)
-      parent << node
-    end
-    return node
-  end
-
-  def get_node_text(path)
-    node = @root.at_xpath('/template/' + path)
-    return node ? node.text : nil
-  end
-
-  def add_package_node(parent, name)
-    pnode = get_or_create_node('package', parent)
-    pnode['name'] = name
-    pnode
-  end
-
-  def repository_manager
-    @repository_manager ||= RepositoryManager.new
-  end
-end
diff --git a/src/app/util/repository_manager.rb b/src/app/util/repository_manager.rb
deleted file mode 100644
index 0a33ad2..0000000
--- a/src/app/util/repository_manager.rb
+++ /dev/null
@@ -1,111 +0,0 @@
-#
-# Copyright (C) 2009 Red Hat, Inc.
-# Written by Jan Provaznik <jprovazn@redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.  A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-require 'yaml'
-require 'util/repository_manager/comps_repository'
-require 'util/repository_manager/pulp_repository'
-
-class RepositoryManager
-  attr_reader :repositories
-
-  def initialize(opts = {})
-    @config = opts[:config] || load_config
-    @config = [ @config ] if Hash === @config
-    @repositories = get_repositories
-    @selected_repositories = get_selected_repositories(opts[:repositories])
-  end
-
-  def groups
-    @groups ||= @selected_repositories.map {|repo| repo.groups}.flatten
-  end
-
-  def packages
-    @packages ||= @selected_repositories.map {|repo| repo.packages}.flatten
-  end
-
-  def categories
-    @categories ||= @selected_repositories.map {|repo| repo.categories}.flatten
-  end
-
-  def repositories_hash
-    res = {}
-    @repositories.each do |r|
-      res[r.id] = r
-    end
-    res
-  end
-
-  def search_package(str)
-    @selected_repositories.map {|repo| repo.search_package(str)}.flatten
-  end
-
-  # TODO (remove): this is temporary solution for categorizing packages
-  def metagroup_packages(category)
-    res = []
-    grps = groups
-    metagroups[category].to_a.each do |entry|
-      gname = entry[1]
-      cat = categories.find{|t| t[:id] == entry[0]}
-      group = grps.find{|g| g[:id] == gname}
-      next unless cat and cat[:groups].include?(gname) and group
-      next if res.find{|g| g[:name] == gname}
-      res << {:label => group[:name], :name => gname, :packages => group[:packages].keys}
-    end
-    res
-  end
-
-  # TODO (remove): this is temporary solution for categorizing packages
-  def metagroups
-    unless @metagroups
-      @metagroups = {}
-      File.readlines('config/image_descriptor_package_metagroups.conf').each do |line|
-        group, entries_str = line.chomp.split('=')
-        next unless group and entries_str
-        @metagroups[group] = entries_str.split(',').map {|entry| entry.split(';')}
-      end
-    end
-    @metagroups
-  end
-
-  private
-
-  def load_config
-    YAML.load_file("#{RAILS_ROOT}/config/image_descriptor_package_repositories.yml")
-  end
-
-  def get_repositories
-    repositories = []
-    @config.each do |rep|
-      if rep['type'] == 'xml'
-        repositories << CompsRepository.new(rep)
-      elsif rep['type'] == 'pulp'
-        repositories += PulpRepository.repositories(rep)
-      end
-    end
-    return repositories
-  end
-
-  def get_selected_repositories(repos)
-    return @repositories if repos.blank?
-    repos.map do |repo|
-      @repositories.find_all {|r| r.platform_id == repo} or raise "repository '#{repo}' not found"
-    end.flatten
-    @repositories
-  end
-end
diff --git a/src/app/util/repository_manager/abstract_repository.rb b/src/app/util/repository_manager/abstract_repository.rb
deleted file mode 100644
index 63496f2..0000000
--- a/src/app/util/repository_manager/abstract_repository.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class AbstractRepository
-  attr_reader :id, :name, :baseurl, :yumurl, :type, :platform_id, :install
-
-  def initialize(conf)
-    @id = conf['id']
-    @name = conf['name']
-    @baseurl = conf['baseurl']
-    @yumurl = conf['yumurl'] || conf['baseurl']
-    @type = conf['type']
-    @platform_id = conf['platform_id']
-    @install = conf['install'] || false
-  end
-
-  def search_package(what)
-    packages.select {|p| p[:name] =~ /#{Regexp.escape(what)}/i}
-  end
-end
diff --git a/src/app/util/repository_manager/comps_repository.rb b/src/app/util/repository_manager/comps_repository.rb
deleted file mode 100644
index a13f461..0000000
--- a/src/app/util/repository_manager/comps_repository.rb
+++ /dev/null
@@ -1,158 +0,0 @@
-require 'util/repository_manager/abstract_repository'
-require 'open-uri'
-
-class CompsRepository < AbstractRepository
-  def initialize(conf)
-    super
-    @baseurl = conf['baseurl']
-    @cache_dir = "#{RAILS_ROOT}/config/image_descriptor_xmls"
-    @cache_file = File.join(@cache_dir, "#{@id}.data")
-    @repomd_url = File.join(@baseurl, 'repodata', 'repomd.xml')
-  end
-
-  def groups
-    @groups ||= load_data[:groups]
-  end
-
-  def categories
-    @categories ||= load_data[:categories]
-  end
-
-  def packages
-    @packages ||= load_data[:packages]
-  end
-
-  def prepare_repo
-    @all_packages = get_packages
-    Dir.mkdir(@cache_dir) unless File.directory?(@cache_dir)
-    File.open(@cache_file, 'w') do |f|
-      Marshal.dump({
-        :packages => @all_packages,
-        :groups => get_groups,
-        :categories => get_categories
-      }, f)
-    end
-  end
-
-  private
-
-  def get_packages
-    packages = package_nodes.map do |node|
-      {
-        #:id => node.at_xpath('./xmlns:id/child::text()').text,
-        :name => node.at_xpath('./xmlns:name/child::text()').text,
-        :repository_id => @id,
-      }
-    end
-  end
-
-  def get_groups
-    @all_packages_hash = {}
-    @all_packages.each {|p| @all_packages_hash[p[:name]] = true}
-
-    group_nodes.map do |g|
-      pkgs = group_packages(g)
-      next if pkgs.empty?
-      {
-        :id => g.at_xpath('id').text,
-        :name => g.at_xpath('name').text,
-        :repository_id => @id,
-        :packages => pkgs
-      }
-    end.compact
-  end
-
-  def get_categories
-    category_nodes.map do |cat|
-      {
-        :id => cat.at_xpath('id').text,
-        :name => cat.at_xpath('name').text,
-        :groups => cat.xpath('./grouplist/groupid').map {|g| g.text}
-      }
-    end
-  end
-
-  def load_data
-    unless @load_data
-      begin
-        File.open(@cache_file, 'r') { |f| @load_data = Marshal.load(f) }
-      rescue Errno::ENOENT
-        raise "failed to read cached packages info, run 'rake dc:prepare_repos'"
-      end
-    end
-    @load_data
-  end
-
-  def parsed_group_xml
-    unless @xml
-      return nil unless data = group_xml
-      @xml = Nokogiri::XML(data)
-    end
-    @xml
-  end
-
-  def group_nodes
-    return [] unless xml = parsed_group_xml
-    xml.xpath('/comps/group')
-  end
-
-  def category_nodes
-    return [] unless xml = parsed_group_xml
-    xml.xpath('/comps/category')
-  end
-
-  def package_nodes
-    xml = Nokogiri::XML(primary_xml)
-    xml.xpath('/xmlns:metadata/xmlns:package')
-  end
-
-  def download_xml(url)
-    body = nil
-    5.times do |i|
-      resp = Typhoeus::Request.get(url, :timeout => 60000, :follow_location => true, :max_redirects => 10)
-      if resp.code == 200
-        body = resp.body
-        break
-      end
-      sleep 2
-    end
-    raise "failed to fetch #{url}, aborting" unless body
-
-    if url =~ /\.gz$/
-      return Zlib::GzipReader.new(StringIO.new(body)).read
-    else
-      return body
-    end
-  end
-
-  def repomd
-    @repomd ||= Nokogiri::XML(download_xml(@repomd_url))
-  end
-
-  def primary_xml
-    unless primary = repomd.xpath("/xmlns:repomd/xmlns:data[@type=\"primary\"]/xmlns:location").first
-      raise "there is no 'primary' info in the repomd.xml (#{@repomd_url})"
-    end
-    download_xml(File.join(@baseurl, primary['href']))
-  end
-
-  def group_xml
-    # we don't raise exception if group is missing - group is not required
-    if group = repomd.xpath("/xmlns:repomd/xmlns:data[@type=\"group\"]/xmlns:location").first
-      download_xml(File.join(@baseurl, group['href']))
-    else
-      nil
-    end
-  end
-
-  def group_packages(group_node)
-    pkgs = {}
-    group_node.xpath('packagelist/packagereq').each do |p|
-      pkg_name = p.text
-      # skip pkg if it's not in all packages list
-      next unless @all_packages_hash[pkg_name]
-      (pkgs[pkg_name] ||= {})[:type] = p.attr('type')
-    end
-    return pkgs
-  end
-end
diff --git a/src/app/util/repository_manager/pulp_repository.rb b/src/app/util/repository_manager/pulp_repository.rb
deleted file mode 100644
index 3817cd6..0000000
--- a/src/app/util/repository_manager/pulp_repository.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-require 'json'
-require 'typhoeus'
-require 'util/repository_manager/abstract_repository'
-
-class PulpRepository < AbstractRepository
-  class WrappedRestClient
-    def self.method_missing(method, *args)
-      resp = Typhoeus::Request.send(method, *args)
-      unless resp.code == 200
-        raise "pulp repository: failed to fetch #{args.first} (code #{resp.code}): #{resp.body}"
-      end
-      begin
-        JSON.parse(resp.body)
-      rescue JSON::ParserError
-        raise "pulp repository: failed to parse response (#{args.first})"
-      end
-    end
-  end
-
-  HTTP_OPTS = { :disable_ssl_peer_verification => true, :timeout => 30000 }
-
-  def self.repositories(conf)
-    WrappedRestClient.get(File.join(conf['baseurl'], "/repositories/"), HTTP_OPTS).map do |r|
-      next if conf['except'] and conf['except'].include?(r['id'])
-      PulpRepository.new(r.merge('baseurl' => conf['baseurl'],
-                                 'yumurl' => File.join(conf['yumurl'], r['id'])))
-    end.compact
-  end
-
-  def initialize(conf)
-    super
-    @groups_url = File.join(strip_path(@baseurl), conf['packagegroups'])
-    @categories_url = File.join(strip_path(@baseurl), conf['packagegroupcategories'])
-    @packages_url = File.join(strip_path(@baseurl), conf['packages'])
-  end
-
-  def groups
-    WrappedRestClient.get(@groups_url, HTTP_OPTS).map do |id, info|
-      pkgs = {}
-      info['default_package_names'].each {|p| pkgs[p] = {:type => 'default'}}
-      info['optional_package_names'].each {|p| pkgs[p] = {:type => 'optional'}}
-      info['mandatory_package_names'].each {|p| pkgs[p] = {:type => 'mandatory'}}
-      next if pkgs.empty?
-      {
-        :id => id,
-        :name => info['name'],
-        :description => info['description'].to_s,
-        :repository_id => @id,
-        :packages => pkgs,
-      }
-    end.compact
-  end
-
-  def categories
-    WrappedRestClient.get(@categories_url, HTTP_OPTS).map do |id, info|
-      {
-        :id => id,
-        :name => info['name'],
-        :groups => info['packagegroupids'],
-      }
-    end
-  end
-
-  def packages
-    WrappedRestClient.get(@packages_url, HTTP_OPTS).map do |info|
-      {:name => info['name']}
-    end
-  end
-
-  def search_package(str)
-    WrappedRestClient.get(@packages_url + "?name=" + str, HTTP_OPTS).map do |info|
-      {:name => info['name']}
-    end
-  end
-
-  private
-
-  def strip_path(url)
-    uri = URI.parse(url)
-    uri.path = ''
-    uri.to_s
-  end
-end
diff --git a/src/app/views/builds/index.haml b/src/app/views/builds/index.haml
deleted file mode 100644
index e69de29..0000000
diff --git a/src/app/views/deployments/_edit.haml b/src/app/views/deployments/_edit.haml
index 1bccdee..21190b0 100644
--- a/src/app/views/deployments/_edit.haml
+++ b/src/app/views/deployments/_edit.haml
@@ -1,7 +1,6 @@
 = error_messages_for 'deployment'
 %h2 Edit deployment
 - form_for @deployment do
-  = hidden_field :deployment, :legacy_deployable_id
   %ul
     %li
       = label :deployment, :name
diff --git a/src/app/views/deployments/_filter_view.haml b/src/app/views/deployments/_filter_view.haml
index 6c5a00a..9812547 100644
--- a/src/app/views/deployments/_filter_view.haml
+++ b/src/app/views/deployments/_filter_view.haml
@@ -7,7 +7,7 @@
     %td
       = link_to(deployment.name, deployment)
     %td
-      = link_to(deployment.legacy_deployable.name, deployment.legacy_deployable) if deployment.legacy_deployable
+      = deployment.deployable_xml.name
     %td
       = count_uptime(deployment.created_at)
     %td
diff --git a/src/app/views/deployments/_legacy_launch_new.haml b/src/app/views/deployments/_legacy_launch_new.haml
deleted file mode 100644
index f2d4770..0000000
--- a/src/app/views/deployments/_legacy_launch_new.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-= if request.xhr?
-  = render :partial => '/layouts/notification'
-%h2 Launch new deployment via
-- form_tag legacy_new_deployments_path, :method => :get do
-  = label_tag "Deployable:"
-  = select_tag :legacy_deployable_id, options_from_collection_for_select(@launchable_deployables, "id", "name")
-  = submit_tag "Launch"
-  = link_to "Cancel", deployments_path, :class => "button"
diff --git a/src/app/views/deployments/_legacy_new.haml b/src/app/views/deployments/_legacy_new.haml
deleted file mode 100644
index 22b213c..0000000
--- a/src/app/views/deployments/_legacy_new.haml
+++ /dev/null
@@ -1,25 +0,0 @@
-= error_messages_for 'deployment'
-%h2 Launch deployable
-- form_for @deployment, :url => deployments_path do
-  = hidden_field :deployment, :legacy_deployable_id
-  %ul
-    %li
-      = label :deployment, :name
-      = text_field :deployment, :name
-    %li
-      = label :deployment, :pool
-      = select :deployment, :pool_id, @pools.map {|p| [ p.name, p.id ]}, { :include_blank => true }
-    %li
-      = label :deployment, :frontend_realm
-      = select :deployment, :frontend_realm_id, @realms.map {|r| [ r.name, r.id ]}, { :include_blank => true }
-    %p
-    %h3 Assemblies hardware profiles
-    %ul
-      - @deployment.legacy_deployable.legacy_assemblies.each do |assembly|
-        %li
-          - hwprofiles = @hardware_profiles.select {|hwp| hwp.architecture.value == assembly.legacy_templates.first.architecture}
-          = label_tag "hw_profiles[#{assembly.id}]", assembly.name
-          = select_tag "hw_profiles[#{assembly.id}]", options_from_collection_for_select(hwprofiles, 'id', 'name')
-
-  = submit_tag 'Cancel', :name => 'cancel'
-  = submit_tag 'Launch', :name => 'launch'
diff --git a/src/app/views/deployments/_list.haml b/src/app/views/deployments/_list.haml
index 77f6307..7916f3b 100644
--- a/src/app/views/deployments/_list.haml
+++ b/src/app/views/deployments/_list.haml
@@ -2,7 +2,7 @@
   = render :partial => '/layouts/notification'
 
 - form_tag do
-  = link_to "New Deployment", legacy_launch_new_deployments_path, { :class => 'button' }
+  = link_to "New Deployment", launch_new_deployments_path, { :class => 'button' }
   = restful_submit_tag "Stop", "multi_stop", multi_stop_deployments_path, 'POST', :id => 'stop_button'
   = label_tag "More actions"
   = select_tag("more_actions",nil, :disabled => true)
diff --git a/src/app/views/deployments/legacy_launch_new.haml b/src/app/views/deployments/legacy_launch_new.haml
deleted file mode 100644
index 43771b3..0000000
--- a/src/app/views/deployments/legacy_launch_new.haml
+++ /dev/null
@@ -1 +0,0 @@
-= render :partial => 'legacy_launch_new'
\ No newline at end of file
diff --git a/src/app/views/deployments/legacy_new.haml b/src/app/views/deployments/legacy_new.haml
deleted file mode 100644
index d49ca7c..0000000
--- a/src/app/views/deployments/legacy_new.haml
+++ /dev/null
@@ -1 +0,0 @@
-= render :partial => 'legacy_new'
\ No newline at end of file
diff --git a/src/app/views/image_imports/new.haml b/src/app/views/image_imports/new.haml
deleted file mode 100644
index 8c18021..0000000
--- a/src/app/views/image_imports/new.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-- form_tag :image_imports do
-  %fieldset.clear
-    = label_tag :provider_account_id, "Provider Account ID: "
-    = select_tag :provider_account_id, option_groups_from_collection_for_select(@providers,:provider_accounts, :name, :id,:name)
-  %fieldset.clear
-    = label_tag :ami_id, "Image ID: "
-    = text_field_tag :ami_id, params[:ami_id]
-    = restful_submit_tag "Import", 'create', image_imports_path, 'POST', :class => "submit"
diff --git a/src/app/views/instances/_list.haml b/src/app/views/instances/_list.haml
index af39180..77c2a31 100644
--- a/src/app/views/instances/_list.haml
+++ b/src/app/views/instances/_list.haml
@@ -1,6 +1,5 @@
 - form_tag do
   = restful_submit_tag 'Stop', 'stop', multi_stop_instances_path, 'GET'
-  = restful_submit_tag 'Create', 'new', select_legacy_template_instances_path, 'GET'
   = restful_submit_tag 'Remove failed', 'remove_failed', remove_failed_instances_path, 'GET'
 
   %p
@@ -17,7 +16,6 @@
           %input{:name => 'instance_selected[]', :type => 'checkbox', :value => inst.id, :id => "instance_checkbox_#{inst.id}", :checked => selected }
           = link_to inst.name, instance_path(inst)
         %td= inst.state
-        %td= inst.legacy_template ? inst.legacy_template.name : "#{inst.image_uuid} (image uuid)"
         %td= inst.public_addresses
         %td= inst.provider_account ? inst.provider_account.provider.name : ''
         %td= owner_name(inst)
diff --git a/src/app/views/instances/_new.haml b/src/app/views/instances/_new.haml
deleted file mode 100644
index 82a3b99..0000000
--- a/src/app/views/instances/_new.haml
+++ /dev/null
@@ -1,27 +0,0 @@
-= error_messages_for 'instance'
-%h2 Launch instance
-- form_for @instance, :url => instances_path do
-  = hidden_field :instance, :legacy_template_id
-  %ul
-    %li
-      = label :instance, :name
-      = text_field :instance, :name
-    %li
-      = label :instance, :legacy_template
-      = text_field_tag :template_name, @instance.legacy_template ? @instance.legacy_template.name : '', :disabled => true
-    %li
-      = label :instance, :pool
-      - if @instance.pool
-        = text_field_tag :pool_name, @instance.pool.name, :disabled => true
-        = hidden_field :instance, :pool_id
-      - else
-        = select :instance, :pool_id, @pools.map {|p| [ p.name, p.id ]}, { :include_blank => true }
-    %li
-      = label :instance, :hardware_profile
-      = select :instance, :hardware_profile_id, @hardware_profiles.map {|p| [ p.name, p.id ]}, { :include_blank => false }
-    %li
-      = label :instance, :frontend_realm
-      = select :instance, :frontend_realm_id, @realms.map {|r| [ r.name, r.id ]}, { :include_blank => true }
-
-  = submit_tag 'Cancel', :name => 'cancel'
-  = submit_tag 'Launch', :name => 'launch'
diff --git a/src/app/views/instances/index.haml b/src/app/views/instances/index.haml
index 62ccbc6..9dabd7e 100644
--- a/src/app/views/instances/index.haml
+++ b/src/app/views/instances/index.haml
@@ -1,2 +1 @@
-- content_for :list do
-  = render :partial => 'list'
+= render :partial => 'list'
diff --git a/src/app/views/instances/select_legacy_template.haml b/src/app/views/instances/select_legacy_template.haml
deleted file mode 100644
index fe4b045..0000000
--- a/src/app/views/instances/select_legacy_template.haml
+++ /dev/null
@@ -1,19 +0,0 @@
-%h3 Show Templates
-%hr
-%ul
-  - @legacy_templates.each do |tpl|
-    %li
-      - form_tag new_instance_path do
-        = hidden_field :instance, :legacy_template_id, :value => tpl.id
-        - if tpl.platform != "unknown"
-          = image_tag "platform_#{tpl.platform}.png", :size => "32x32", :alt => tpl.platform
-        %h3= tpl.name
-        %p= tpl.summary
-        %p
-          %label Group:
-          System
-          %label Version:
-          2.5
-        = submit_tag 'Launch', :name => 'launch'
-= will_paginate(@legacy_templates)
-= page_entries_info(@legacy_templates)
diff --git a/src/app/views/instances/show.haml b/src/app/views/instances/show.haml
index 05eeedd..dcaa50e 100644
--- a/src/app/views/instances/show.haml
+++ b/src/app/views/instances/show.haml
@@ -1,5 +1 @@
-- content_for :list do
-  = render :partial => 'list'
-
-- content_for :details do
-  = render :partial => 'layouts/details_pane'
+= render :partial => 'properties'
diff --git a/src/app/views/layouts/application.haml b/src/app/views/layouts/application.haml
index 1549d54..044d9e0 100644
--- a/src/app/views/layouts/application.haml
+++ b/src/app/views/layouts/application.haml
@@ -33,8 +33,6 @@
           - # NOTE this is a hack to implement switching between the top-level
           - # navigation before the proper wireframes exist for all the sections.
           - # Then we'll want to switch to the simple-nav gem or something else.
-          %li{:class => "#{'active' if controller.top_section == :design}" }
-            = link_to 'Design &amp; Deploy', legacy_templates_path
           %li{:class => "#{'active' unless [:design, :administer].include? controller.top_section}" }
             = link_to 'Monitor', pools_path
           %li{:class => "#{'active' if controller.top_section == :administer}" }
diff --git a/src/app/views/legacy_assemblies/index.haml b/src/app/views/legacy_assemblies/index.haml
deleted file mode 100644
index aba40ed..0000000
--- a/src/app/views/legacy_assemblies/index.haml
+++ /dev/null
@@ -1 +0,0 @@
-assemblies/index.haml
diff --git a/src/app/views/legacy_deployables/_assemblies.haml b/src/app/views/legacy_deployables/_assemblies.haml
deleted file mode 100644
index e86efbb..0000000
--- a/src/app/views/legacy_deployables/_assemblies.haml
+++ /dev/null
@@ -1,30 +0,0 @@
-.grid_13
-- form_tag do
-  = restful_submit_tag "Remove Selected", 'destroy', remove_assemblies_legacy_deployable_path(@deployable), 'DELETE', :id => 'delete_button'
-  = link_to "Add Assembly...", pick_assemblies_legacy_deployable_path(@deployable), :class => 'button', :id => 'add_assembly'
-
-  %table#assemblies_table
-    %thead
-      %tr
-        %th
-        %th= "Name"
-        %th= "Created"
-    -@deployable.legacy_assemblies(:include => :legacy_templates).each do |assembly|
-      %tr
-        %td
-          %input{:name => "assemblies_selected[]", :type => "checkbox", :value => assembly.id, :id => "assembly_checkbox_#{assembly.id}" }
-        %td= assembly.name
-        %td= assembly.created_at
-
-:javascript
-  $(document).ready(function () {
-    $('#add_assembly').click(function(e) {
-      e.preventDefault();
-      var url = $(this).attr('href');
-      $.get(url, function(data) {
-        var selectedTabIndex = $("#details-view").tabs('option', 'selected');
-        var $selectedTab = $("#details-view div.ui-tabs-panel").eq(selectedTabIndex);
-        $selectedTab.html(data);
-      });
-    });
-  });
diff --git a/src/app/views/legacy_deployables/_deployments.haml b/src/app/views/legacy_deployables/_deployments.haml
deleted file mode 100644
index 175b918..0000000
--- a/src/app/views/legacy_deployables/_deployments.haml
+++ /dev/null
@@ -1,25 +0,0 @@
-.grid_13
-  %h2 Deployments for #{@deployable.name}
-
-  - unless @deployments.empty?
-    - form_tag do
-      %table#deployments_table
-        = sortable_table_header @header_deployments
-        - @deployments.each do |deployment|
-          %tr
-            %td
-              - selected = @url_params[:select] == 'all'
-              %input{:name => "deployments_selected[]", :type => "checkbox", :value => deployment.id, :id => "deployment_checkbox_#{deployment.id}", :checked => selected }
-              = link_to deployment.name, deployment_path(deployment)
-            %td
-              = deployment.legacy_deployable.name
-            %td
-              = deployment.owner.login
-            %td
-              = deployment.created_at.strftime("%d-%b-%Y %H:%M:%S")
-            %td
-              TODO
-            %td
-              = deployment.pool.name
-  - else
-    No Deployments for #{@deployable.name}
diff --git a/src/app/views/legacy_deployables/_form.haml b/src/app/views/legacy_deployables/_form.haml
deleted file mode 100644
index 75d46d0..0000000
--- a/src/app/views/legacy_deployables/_form.haml
+++ /dev/null
@@ -1,10 +0,0 @@
-= form.error_messages
-%fieldset.clear
-  = form.label :name, t(:name), :class => "grid_3 alpha"
-  = form.text_field :name, :class => "grid_5"
-%fieldset.clear
-  = form.label :summary, t(:summary), :class => "grid_3 alpha"
-  = form.text_area :summary, :class => "grid_5", :rows => 3
-%fieldset.clearfix
-  = form.submit "Save",  :class => "submit formbutton"
-  = link_to t(:cancel), legacy_deployables_path, :class => 'button formbutton'
diff --git a/src/app/views/legacy_deployables/_list.haml b/src/app/views/legacy_deployables/_list.haml
deleted file mode 100644
index 1fdb80c..0000000
--- a/src/app/views/legacy_deployables/_list.haml
+++ /dev/null
@@ -1,28 +0,0 @@
-- form_tag do
-  = link_to "Create", new_legacy_deployable_url, :class => 'button'
-  = restful_submit_tag "Delete", 'destroy', multi_destroy_legacy_deployables_path, 'DELETE', :id => 'delete_button'
-
-  %table#deployables_table
-    %thead
-      %tr
-        %th
-        %th= link_to "Name", legacy_deployables_url(:sort_by => "name")
-    -@deployables.each do |deployable|
-      %tr
-        %td
-          %input{:name => "deployables_selected[]", :type => "checkbox", :value => deployable.id, :id => "deployable_checkbox_#{deployable.id}" }
-        %td= link_to deployable.name, legacy_deployable_path(deployable)
-
-:javascript
-  $(document).ready(function () {
-    $('#delete_button').click(function(e) {
-      if ($("#deployables_table input[@type=radio]:checked").length == 0) {
-        alert('Please select any deployable to be deleted before clicking Delete button.');
-        e.preventDefault();
-      } else {
-        if (!confirm("Are you sure you want to delete this deployable?")) {
-          e.preventDefault();
-        }
-      }
-    });
-  });
diff --git a/src/app/views/legacy_deployables/_pick_assemblies.haml b/src/app/views/legacy_deployables/_pick_assemblies.haml
deleted file mode 100644
index ca4d190..0000000
--- a/src/app/views/legacy_deployables/_pick_assemblies.haml
+++ /dev/null
@@ -1,16 +0,0 @@
-.grid_13
-  - form_tag(legacy_deployable_path(@deployable)) do
-    %table#assemblies_list
-      %thead
-        %tr
-          %th
-          %th= "Name"
-      -@assemblies.each do |assembly|
-        %tr
-          %td
-            %input{:name => "assemblies_selected[]", :type => "checkbox", :value => assembly.id, :id => "assembly_checkbox_#{assembly.id}" }
-          %td= assembly.name
-
-    -# AJAX post
-    = restful_submit_tag('Save', 'add_assemblies', add_assemblies_legacy_deployable_path(@deployable), 'PUT')
-    = link_to "Back", legacy_deployable_path(@deployable, :details_tab => 'assemblies'), :class => 'button'
diff --git a/src/app/views/legacy_deployables/_properties.haml b/src/app/views/legacy_deployables/_properties.haml
deleted file mode 100644
index bc00c3f..0000000
--- a/src/app/views/legacy_deployables/_properties.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-.grid_13
-  %h2 #{@deployable.name}
-
-  = link_to 'Edit', edit_legacy_deployable_path(@deployable), :class => 'button'
-  - if @deployable.launchable?
-    = link_to "Launch", legacy_new_deployments_path(:legacy_deployable_id => @deployable.id), {:class => 'button'}
-  - else
-    The deployable can't be launched - the deployable must have at least one assembly and each assembly must have at least one template.
diff --git a/src/app/views/legacy_deployables/edit.haml b/src/app/views/legacy_deployables/edit.haml
deleted file mode 100644
index d94495e..0000000
--- a/src/app/views/legacy_deployables/edit.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-%h2 Editing Deployable: #{@deployable.name}
-
-- form_for @deployable, :url => legacy_deployable_path(@deployable), :html => { :method => :put } do |f|
-  = render :partial => "form", :locals => { :form => f }
diff --git a/src/app/views/legacy_deployables/index.haml b/src/app/views/legacy_deployables/index.haml
deleted file mode 100644
index 62ccbc6..0000000
--- a/src/app/views/legacy_deployables/index.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-- content_for :list do
-  = render :partial => 'list'
diff --git a/src/app/views/legacy_deployables/new.haml b/src/app/views/legacy_deployables/new.haml
deleted file mode 100644
index 4637af5..0000000
--- a/src/app/views/legacy_deployables/new.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-%h2 New Deployable
-- form_for @deployable, :url => legacy_deployables_path do |f|
-  = render :partial => "form", :locals => { :form => f }
diff --git a/src/app/views/legacy_deployables/pick_assemblies.haml b/src/app/views/legacy_deployables/pick_assemblies.haml
deleted file mode 100644
index c223367..0000000
--- a/src/app/views/legacy_deployables/pick_assemblies.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-- content_for :list do
-  = render :partial => 'list'
-
-- content_for :details do
-  = render :partial => 'pick_assemblies'
diff --git a/src/app/views/legacy_deployables/show.haml b/src/app/views/legacy_deployables/show.haml
deleted file mode 100644
index 05eeedd..0000000
--- a/src/app/views/legacy_deployables/show.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-- content_for :list do
-  = render :partial => 'list'
-
-- content_for :details do
-  = render :partial => 'layouts/details_pane'
diff --git a/src/app/views/legacy_templates/_addbuttons.haml b/src/app/views/legacy_templates/_addbuttons.haml
deleted file mode 100644
index 7605ae8..0000000
--- a/src/app/views/legacy_templates/_addbuttons.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-%fieldset.clear
-  - cancel_path = @tpl.id ? edit_legacy_template_path(@tpl) : new_legacy_template_path
-  = restful_submit_tag "Add Selected", "add_selected", add_selected_legacy_templates_path, 'GET', {:class => "grid_2 alpha", :id => "do_add_software"}
-  = restful_submit_tag "Cancel", "cancel_add_software", cancel_path, 'GET', {:class => "grid_2", :id => "cancel_add_software"}
diff --git a/src/app/views/legacy_templates/_basics.haml b/src/app/views/legacy_templates/_basics.haml
deleted file mode 100644
index 72d2423..0000000
--- a/src/app/views/legacy_templates/_basics.haml
+++ /dev/null
@@ -1,27 +0,0 @@
-%h3 General Information
-%fieldset.clearfix
-  %label.grid_4.alpha.la Template Name:
-  %label.grid_7.la Summary:
-  %label.grid_3.suffix_2.omega.la Version:
-  = text_field :tpl, :name, :value => @tpl.name || 'Template Name', :class => "grid_4 alpha"
-  = text_field :tpl, :summary, :value => @tpl.summary || 'Template Description', :class => "grid_7"
-  = text_field_tag 'current_version', 'Current Version', :disabled => true, :class => "grid_3"
-  %button{:type => 'button', :disabled => 'disabled', :class => "grid_2 omega"} New Version
-%fieldset.clearfix
-  %label.grid_4.alpha Choose Logo:
-  %input{:type => 'file', :disabled => 'disabled', :class => "grid_7"}
-%fieldset.clearfix
-  - default = @tpl.platforms['fedora']
-  = label :tpl, :platform, 'Platform Choice:', :class => "grid_4 alpha"
-  = select :tpl, :platform, @tpl.platforms.map {|id, p| ["#{p['name']} #{p['version']} (#{p['architecture']})", id]}, {:selected => @tpl.platform || 'fedora'}, {:class => 'grid_7'}
-%fieldset.clearfix
-  = label_tag :bootable, 'Bootable:', :class => "grid_4 alpha"
-  .grid_12.omega
-    = radio_button_tag :bootable, 'yes', true, :disabled => true
-    = label_tag :bootable, 'Yes'
-    = radio_button_tag :bootable, 'no', false, :disabled => true
-    = label_tag :bootable, 'No'
-%fieldset.clearfix
-  %label{:for => :template_group, :class => 'grid_4 alpha'}
-    Template Group:
-  = select_tag(:template_group, options_for_select([['User Private', 1]]), :class => 'grid_4')
diff --git a/src/app/views/legacy_templates/_builds.haml b/src/app/views/legacy_templates/_builds.haml
deleted file mode 100644
index f6cc7bf..0000000
--- a/src/app/views/legacy_templates/_builds.haml
+++ /dev/null
@@ -1,41 +0,0 @@
-Builds for
-= @tpl.platform_name
-= @tpl.platform_version
-, legacy_template "#{@tpl.name}"
-
-- form_tag builds_path do
-  = hidden_field_tag :legacy_template_id, @tpl.id
-  - if @targets_not_built.count > 0 then
-    - if @tpl.imported
-      Build imported template is not supported
-    - else
-      New Build for
-      = select_tag 'target', options_for_select(@targets_not_built)
-      = submit_tag "Go", :name => "build"
-
-%ul
-  - if @images.empty?
-    %li No Builds
-  - else
-    - @images.each do |img|
-      %li
-        - form_tag(retry_builds_path, { :method => :post }) do
-          = "#{img.name}-#{img.legacy_template.architecture}: #{img.status}"
-          = hidden_field_tag :template_id, @tpl.id
-          = hidden_field_tag :image_id, img.id
-          = submit_tag "Retry build", :name => "build"
-        - if img.status == LegacyImage::STATE_COMPLETED
-          %ul
-            - img.legacy_provider_images.each do |pimg|
-              %li
-                - form_tag(retry_builds_path, { :method => :post }) do
-                  = "#{pimg.provider.name}: #{pimg.status}"
-                  = hidden_field_tag :template_id, @tpl.id
-                  = hidden_field_tag :provider_image_id, pimg.id
-                  = submit_tag "Retry upload", :name => "build"
-            - unless @tpl.imported
-              - img.not_uploaded_providers.each do |provider|
-                %li
-                  = "#{provider.name}: "
-                  not uploaded
-                  = link_to 'upload', upload_builds_path(:template_id => @tpl.id, :image_id => img.id, :provider_id => provider.id), {:class => 'button'}
diff --git a/src/app/views/legacy_templates/_collections.haml b/src/app/views/legacy_templates/_collections.haml
deleted file mode 100644
index 98ce959..0000000
--- a/src/app/views/legacy_templates/_collections.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-%ul.collections
-  - @collections.each do |c|
-    %li
-      /- selected = c[:selected] ? true : false
-      - selected = false
-      = check_box_tag 'groups[]', c[:id], selected, {:disabled => selected, :id => "group_#{c[:id]}", :class => "#{selected ? 'selected' : ''}"}
-      = label_tag "group_#{c[:id]}", c[:name]
-= render :partial => 'addbuttons'
diff --git a/src/app/views/legacy_templates/_form.haml b/src/app/views/legacy_templates/_form.haml
deleted file mode 100644
index dba9f46..0000000
--- a/src/app/views/legacy_templates/_form.haml
+++ /dev/null
@@ -1,120 +0,0 @@
-:javascript
-  $(document).ready(function() {
-    var $content_container = $('#managed_content');
-    var $sel_pkg_container = $('#package_selection_list');
-    var $submit            = $('#add_software_button');
-    $submit.click(function(e) {
-      e.preventDefault();
-      $submit.hide();
-      var data = {
-        'packages[]': $("input[name='packages[]']").map(function() {return $(this).val()}).get(),
-        'repository': $("select[name='tpl[platform]']").val() || ''
-      }
-      var url = '#{url_for :action => 'content_selection', :id => @id}';
-      //$content_container.empty().show();
-      $sel_pkg_container.empty().show().addClass('loading');
-      $sel_pkg_container.load(url, data, function(){
-        $sel_pkg_container.removeClass('loading');
-        var $groups = $('.softwaregroups .disclosure', this);
-        //search
-        $("input[name='package_search']").keypress(function(event) {
-          if (event.keyCode == '13') {
-            event.preventDefault();
-            $("input[name=package_search] ~ button").click();
-          }
-        });
-        $("input[name=package_search] ~ button").click(function(event) {
-          event.preventDefault();
-          var data = {
-            'packages[]': $("input:text[name='packages[]']").map(function() {return $(this).val()}).get(),
-            'package_search': $("input[name='package_search']").val(),
-            'repository': $("select[name='tpl[platform]']").val()
-          };
-          var url = '#{url_for :action => 'search_packages', :id => @id}';
-          $('#metagrouppackages').empty().addClass('loading');
-          $('#metagrouppackages').load(url, data, function() {
-            $('#metagrouppackages').removeClass('loading');
-          });
-        });
-      });
-    });
-    //removing packages from the list
-    $('.remove_package').live('click', function (e) {
-      e.preventDefault();
-      $(this).parent().hide(300, function () {
-        $(this).remove();
-      });
-    });
-    //displaying extended package info and actions
-    $('.dropdown').hide();
-    $('.packagename').live('click', function () {
-      var dropdowncontent = $(this).siblings('.dropdown').html(),
-      $dropdown = $("#dropdown");
-      $('.packagewrap').removeClass('selected');
-      $(this).parent().addClass('selected');
-      $dropdown.empty().html(dropdowncontent).css({
-        'top': $(this).positionAncestor('#content').top + 17,
-        'left': $(this).positionAncestor('#content').left - 4
-      }).show();
-    });
-    //catch #content clicks and hide the #dropdown if it's not within it
-    $("#content").click(function (e) {
-      if(!e.target.id === 'dropdown' || !$(e.target).closest("#dropdown").length) {
-        $("#dropdown").hide();
-        $('.packagewrap').removeClass('selected');
-      }
-    });
-    // select correct package repo when we change platform
-    $("select[name='tpl[platform]']").change(function() {
-      if ($submit.is(':hidden')) {
-        $submit.trigger('click');
-      }
-    });
-    // add selected pkgs/groups
-    $('#do_add_software').live('click', function(e) {
-      e.preventDefault();
-      var $button = $(this).clone();
-      var label = "<span id='do_add_software' class='loading fl'>Adding Packages</span>";
-      var url = '#{url_for :action => 'managed_content'}';
-      var new_pkgs = $("input:checked[name='selected_packages[]']").map(function() {return $(this).val()}).get();
-      var old_pkgs =  $("input:hidden[name='packages[]']").map(function() {return $(this).val()}).get()
-      var cached_pkgs =  $("input:hidden[name='cached_packages[]']").map(function() {return $(this).val()}).get()
-      var data = {
-        'selected_packages[]': old_pkgs.concat(new_pkgs.concat(cached_pkgs)),
-        'selected_groups[]': $("input:checked[name='groups[]']").map(function() {return $(this).val()}).get(),
-        'collections': $("input:hidden[name=collections]").val(),
-        'template_id'  : '#{@id.nil? ? nil : @id}'
-      };
-      $(this).replaceWith(label);
-      $('#managed_content').load(url, data, function(){
-        $("input:checked[name='groups[]']").attr('disabled', 'disabled');
-        $("input:checked[name='packages[]']").attr('disabled', 'disabled');
-        // $('#add_software_button').show();
-        $('.dropdown').hide();
-        $('#do_add_software').replaceWith($button);
-      });
-    });
-    // hide sw selection panel
-    $('#cancel_add_software').live('click', function(e) {
-      e.preventDefault();
-      $('#package_selection_list').hide();
-      $('#add_software_button').show();
-      $('.dropdown').hide();
-    });
-  });
-
-#build
-  = error_messages_for :tpl, :object_name => 'template'
-  = render :partial => 'basics'
-  = render :partial => 'local_content_to_bundle'
-
-  #managed_content
-    = render :partial => 'managed_content'
-
-  .clearfix
-    .grid_16.alpha.omega
-      = restful_submit_tag "Add Software", 'collections', collections_legacy_templates_path, 'GET', {:id => "add_software_button", :class => "iconbutton"}
-
-  #package_selection_list{:style => 'display: none'}
-
-  = render :partial => 'preboot_configuration'
diff --git a/src/app/views/legacy_templates/_hidden_fields.haml b/src/app/views/legacy_templates/_hidden_fields.haml
deleted file mode 100644
index 5709087..0000000
--- a/src/app/views/legacy_templates/_hidden_fields.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-= hidden_field :tpl, :id
-= hidden_field :tpl, :name
-= hidden_field :tpl, :summary
-= hidden_field :tpl, :platform
-= hidden_field :tpl, :platform_version
-= hidden_field :tpl, :architecture
-- @tpl.packages.each do |p|
-  = hidden_field_tag "packages[]", p, :id => "package_#{p}"
diff --git a/src/app/views/legacy_templates/_list.haml b/src/app/views/legacy_templates/_list.haml
deleted file mode 100644
index b33bbfc..0000000
--- a/src/app/views/legacy_templates/_list.haml
+++ /dev/null
@@ -1,35 +0,0 @@
-- form_tag do
-  = link_to "Create", new_legacy_template_path, :class => 'button'
-  = restful_submit_tag "Delete", 'destroy', multi_destroy_legacy_templates_path, 'DELETE', :id => 'delete_button'
-
-  %table#legacy_templates_table
-    = sortable_table_header @header
-    %tbody
-      - if @legacy_templates.empty?
-        %tr
-          %td{:colspan => 6} No Templates
-      - else
-        - @legacy_templates.each do |template|
-          %tr
-            %td
-              = check_box_tag 'selected[]', template.id, @url_params[:select] == 'all', :id => "selected_#{template.id}"
-              = image_tag "blnk.png", :alt => template.platform, :class => "icon platform #{template.platform}"
-              = link_to template.name, legacy_template_path(template)
-            %td= template.platform_name
-            %td= template.platform_version
-            %td= image_tag 'blnk.png', :alt => 'yes', :class => "icon yes"
-            %td= template.architecture
-
-:javascript
-  $(document).ready(function () {
-    $('#delete_button').click(function(e) {
-      if ($("#legacy_templates_table input[@type=radio]:checked").length == 0) {
-        alert('Please select any template to be deleted before clicking Delete button.');
-        e.preventDefault();
-      } else {
-        if (!confirm("Are you sure you want to delete this template?")) {
-          e.preventDefault();
-        }
-      }
-    });
-  });
diff --git a/src/app/views/legacy_templates/_local_content_to_bundle.haml b/src/app/views/legacy_templates/_local_content_to_bundle.haml
deleted file mode 100644
index 109ce20..0000000
--- a/src/app/views/legacy_templates/_local_content_to_bundle.haml
+++ /dev/null
@@ -1,21 +0,0 @@
-%h3.disabled.gap Local Content to Bundle
-%fieldset.clearfix
-  = label_tag :local_bundle_name, 'Local:', :class => "disabled grid_2 alpha"
-  = text_field_tag 'local_bundle_name[]', 'Bundle Name', :disabled => true, :class => "grid_8"
-  .grid_6.omega
-    %button{:type => 'button', :disabled => 'disabled'} Browse
-    %button{:type => 'button', :disabled => 'disabled'} Config
-    %button{:type => 'button', :disabled => 'disabled'} Metadata
-    (
-    %a{:href => '#'} Remove
-    )
-  .grid_2.alpha
-    &nbsp;
-  = text_field_tag 'local_bundle_name[]', 'Bundle Name', :disabled => true, :class => "grid_8"
-  .grid_6.omega
-    %button{:type => 'button', :disabled => 'disabled'} Browse
-    %button{:type => 'button', :disabled => 'disabled'} Config
-    %button{:type => 'button', :disabled => 'disabled'} Metadata
-    (
-    %a{:href => '#'} Remove
-    )
diff --git a/src/app/views/legacy_templates/_managed_content.haml b/src/app/views/legacy_templates/_managed_content.haml
deleted file mode 100644
index db4a190..0000000
--- a/src/app/views/legacy_templates/_managed_content.haml
+++ /dev/null
@@ -1,21 +0,0 @@
-#selected_packages
-  %h3.gap Managed Content to Bundle
-  .grid_16.alpha.omega
-    - if @tpl.packages.empty?
-      No selected packages
-    - else
-      /- repos = @repository_manager.repositories_hash
-      - @tpl.packages.sort.each do |pkg|
-        /- pkg_group = @groups.keys.find {|g| @groups[g][:packages][pkg]}
-        .packagewrap
-          %a.packagename{:id => "package_#{pkg}"}=pkg
-          = hidden_field_tag 'packages[]', pkg, :id => "package_#{pkg}"
-          = restful_submit_tag "Remove", "remove_package", remove_package_legacy_templates_path(:name => pkg), 'GET', {:id => "remove_package_#{pkg}", :class => 'remove_package'}
-          .dropdown
-            / we don't display repository for now, it's pretty difficult with current design
-            /%section
-            /  Repository:
-            /  %label= (pkg_group and repo = repos[@groups[pkg_group][:repository_id]]) ? repo.name.to_s : '&nbsp;'
-            %fieldset.nomargin
-              %button{:disabled => true} Browse
-              %button{:disabled => true} Config
diff --git a/src/app/views/legacy_templates/_metagroup_packages.haml b/src/app/views/legacy_templates/_metagroup_packages.haml
deleted file mode 100644
index 82c2697..0000000
--- a/src/app/views/legacy_templates/_metagroup_packages.haml
+++ /dev/null
@@ -1,19 +0,0 @@
-- if @metagroup_packages.blank?
-  %span.disabled No group selected
-- else
-  %h4
-    = "#{@metagroup} Packages"
-  %ul.metagrouppackages
-    - @metagroup_packages.sort {|a, b| a[:name] <=> b[:name]}.each do |group|
-      %li
-        - selected = false
-        %h5
-          = check_box_tag 'selected_groups[]', group[:id], selected, {:disabled => selected, :id => "group_#{group[:id]}", :class => "softwaregroups #{selected ? 'selected' : ''}"}
-          = label_tag "group_#{group[:id]}", group[:label]
-        %ul
-          - group[:packages].each do |pkg|
-            %li
-              - selected = @packages.to_a.find {|p| p[:name] == pkg}
-              = check_box_tag 'selected_packages[]', pkg, selected, {:disabled => selected, :id => "pkg_#{group[:name]}_#{pkg}"}
-              = label_tag "pkg_#{group[:name]}_#{pkg}", pkg
-  = render :partial => 'addbuttons'
diff --git a/src/app/views/legacy_templates/_metagroups.haml b/src/app/views/legacy_templates/_metagroups.haml
deleted file mode 100644
index e6f36e5..0000000
--- a/src/app/views/legacy_templates/_metagroups.haml
+++ /dev/null
@@ -1,13 +0,0 @@
-%fieldset.clearfix
-  .search.grid_4.alpha
-    %input{:type => "search", :placeholder => "Search for package", :name => 'package_search', :value => params[:package_search], :id => 'package_search'}
-    %button.action{:id => 'package_search_button', :name => 'package_search_button' , :value => 'true'}
-  .grid_8
-  %a.grid_4.omega Advanced Search
-
-%ul.metagroups{:class => 'packagegroupsidebar grid_4 alpha'}
-  %li
-    = restful_submit_tag 'Collections', 'collections', collections_legacy_templates_path, 'GET', {:id => 'collections', :class => 'icon'}
-  - @metagroups.keys.sort.each do |cat|
-    %li
-      = restful_submit_tag cat, "metagroup_packages", metagroup_packages_legacy_templates_path, 'GET', {:class => 'icon'}
diff --git a/src/app/views/legacy_templates/_preboot_configuration.haml b/src/app/views/legacy_templates/_preboot_configuration.haml
deleted file mode 100644
index 79ae839..0000000
--- a/src/app/views/legacy_templates/_preboot_configuration.haml
+++ /dev/null
@@ -1,11 +0,0 @@
-%h3.clear.gap Preboot Configuration
-%fieldset.clearfix
-  .grid_4.alpha
-    = radio_button_tag :configure_via_script, 'no', :disabled => true
-    = label_tag :configure_via_script, 'Configure Via Script'
-  = file_field_tag 'script_file', :disabled => true, :class => 'grid_12 omega'
-%fieldset.clearfix
-  .grid_4.alpha
-    = radio_button_tag :configure_via_script, 'no', :disabled => true
-    = label_tag :configure_via_script, 'Configure Via Script'
-  = file_field_tag 'script_file', :disabled => true, :class => 'grid_12 omega'
diff --git a/src/app/views/legacy_templates/_properties.haml b/src/app/views/legacy_templates/_properties.haml
deleted file mode 100644
index e068197..0000000
--- a/src/app/views/legacy_templates/_properties.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-%h3
-  Properties for
-  = @tpl.name
-= link_to "Edit", edit_legacy_template_path(@tpl), { :class => 'button' }
diff --git a/src/app/views/legacy_templates/_search_packages.haml b/src/app/views/legacy_templates/_search_packages.haml
deleted file mode 100644
index 1c6c25a..0000000
--- a/src/app/views/legacy_templates/_search_packages.haml
+++ /dev/null
@@ -1,45 +0,0 @@
-:javascript
-  $(document).ready(function() {
-    $('.pagination input[type=submit]').click(function(e) {
-      e.preventDefault();
-      var url = '#{url_for :action => 'search_packages', :id => @id}';
-      var old_pkgs = $("input:hidden[name='cached_packages[]']").map(function() {return $(this).val()}).get();
-      var new_pkgs = $("input:checked[name='selected_packages[]']").map(function() {return $(this).val()}).get();
-      var data = {
-        'selected_packages[]': $("input:hidden[name='packages[]']").map(function() {return $(this).val()}).get(),
-        'cached_packages[]': old_pkgs.concat(new_pkgs),
-        'selected_groups[]': $("input:checked[name='groups[]']").map(function() {return $(this).val()}).get(),
-        'package_search': $("input[name='package_search']").val(),
-        'old_page': '#{@page}',
-        'template_id'  : '#{@id.nil? ? nil : @id}',
-        'page': $(this).val(),
-        'repository': $("select[name='tpl[platform]']").val()
-      };
-      $('#metagrouppackages').empty().addClass('loading');
-      $('#metagrouppackages').load(url, data, function() {
-        $('#metagrouppackages').removeClass('loading');
-      })
-    });
-  });
-
-- @cached_packages.uniq.each do |pkg|
-  = hidden_field_tag 'cached_packages[]', pkg
-
-- if params[:package_search].empty?
-  Search string is empty.
--else
-  %h4
-    = "Search Results for '#{params[:package_search]}'"
-  %ul.searchedpackages
-    - @searched_packages.sort {|a, b| a [:name] <=> b[:name]}.each do |pkg|
-      %li
-        - selected = (@packages.to_a.find {|p| p[:name] == pkg[:name]} or @cached_packages.include?(pkg[:name]))
-        - disabled = @tpl.packages.include?(pkg[:name])
-        = check_box_tag 'selected_packages[]', pkg[:name], selected, {:disabled => disabled, :id => "pkg_#{pkg[:name]}"}
-        = label_tag "pkg_#{pkg[:name]}", pkg[:name]
-  .pageinfo
-    = page_entries_info @searched_packages, :entry_name => 'package'
-  = will_paginate @searched_packages, :params => {:package_search => params[:package_search]}, :renderer => LegacyTemplatesHelper::ButtonPaginationRenderer.new, :previous_label => 'Previous', :next_label => 'Next'
-
-
-  = render :partial => 'addbuttons'
diff --git a/src/app/views/legacy_templates/_software_selection.haml b/src/app/views/legacy_templates/_software_selection.haml
deleted file mode 100644
index 34606fc..0000000
--- a/src/app/views/legacy_templates/_software_selection.haml
+++ /dev/null
@@ -1,41 +0,0 @@
-:javascript
-  $(document).ready(function() {
-    var $metagrouppackages = $('#metagrouppackages');
-    $('.metagroups input').click(function(e) {
-      e.preventDefault();
-      var data = {
-        'repository': $("select[name='tpl[platform]']").val(),
-        'packages[]':  $("input:hidden[name='packages[]']").map(function() {return $(this).val()}).get()
-      };
-      if ($(this).attr('name') == '__rewrite[collections]') {
-        var url = '#{url_for :action => 'collections', :id => @id}';
-      } else {
-        var url = '#{url_for :action => 'metagroup_packages', :id => @id}';
-        data.__rewrite = {
-          metagroup_packages: e.currentTarget.value
-        };
-      }
-      $metagrouppackages.empty().addClass('loading');
-      $metagrouppackages.load(url, data, function() {
-        $metagrouppackages.removeClass('loading');
-        //select all packages in collection
-        $(".softwaregroups").click(function() {
-          if ($(this).attr("checked") === true) {
-            $(this).parent().siblings("ul").find("input[type='checkbox']").attr("checked","checked");
-          } else {
-            $(this).parent().siblings("ul").find("input[type='checkbox']").removeAttr("checked");
-          }
-        });
-      });
-    });
-  });
-
-.grid_16
-  %h4 Managed Content Selection
-
-  - form_tag do
-    - unless request.xhr?
-      = render :partial => 'hidden_fields'
-    = render :partial => 'metagroups'
-    #metagrouppackages.grid_12.omega.gap
-      = render :partial => view
diff --git a/src/app/views/legacy_templates/collections.haml b/src/app/views/legacy_templates/collections.haml
deleted file mode 100644
index a899c85..0000000
--- a/src/app/views/legacy_templates/collections.haml
+++ /dev/null
@@ -1 +0,0 @@
-= render :partial => 'software_selection', :locals => {:view => 'collections'}
diff --git a/src/app/views/legacy_templates/edit.haml b/src/app/views/legacy_templates/edit.haml
deleted file mode 100644
index 7ccd0af..0000000
--- a/src/app/views/legacy_templates/edit.haml
+++ /dev/null
@@ -1,9 +0,0 @@
-#dropdown
-.grid_16
-  %h2 Edit Template
-  /- form_for @tpl, :url => legacy_template_path(@tpl), :html => { :method => :put } do |f|
-  - form_tag do
-    = hidden_field_tag :id, @tpl.id
-    = render :partial => 'form'
-    = restful_submit_tag "Save", 'update', legacy_template_path(@tpl), 'PUT', :class => "formbutton"
-    = link_to 'Cancel', legacy_templates_path, :class => 'button formbutton'
diff --git a/src/app/views/legacy_templates/index.haml b/src/app/views/legacy_templates/index.haml
deleted file mode 100644
index 62ccbc6..0000000
--- a/src/app/views/legacy_templates/index.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-- content_for :list do
-  = render :partial => 'list'
diff --git a/src/app/views/legacy_templates/managed_content.haml b/src/app/views/legacy_templates/managed_content.haml
deleted file mode 100644
index 926142d..0000000
--- a/src/app/views/legacy_templates/managed_content.haml
+++ /dev/null
@@ -1 +0,0 @@
-= render :partial => 'managed_content'
diff --git a/src/app/views/legacy_templates/metagroup_packages.haml b/src/app/views/legacy_templates/metagroup_packages.haml
deleted file mode 100644
index 9703663..0000000
--- a/src/app/views/legacy_templates/metagroup_packages.haml
+++ /dev/null
@@ -1 +0,0 @@
-= render :partial => 'software_selection', :locals => {:view => 'metagroup_packages'}
diff --git a/src/app/views/legacy_templates/new.haml b/src/app/views/legacy_templates/new.haml
deleted file mode 100644
index 2c67cd2..0000000
--- a/src/app/views/legacy_templates/new.haml
+++ /dev/null
@@ -1,10 +0,0 @@
-#dropdown
-.grid_16
-  %h2 New Template
-  /- form_for @tpl, :url => legacy_templates_path do |f|
-  - form_tag do
-    = render :partial => 'form'
-    = check_box_tag :create_deployable
-    = label_tag :create_deployable, "Create Deployable for this template"
-    = restful_submit_tag "Save", 'create', legacy_templates_path, 'POST', :class => "formbutton"
-    = link_to 'Cancel', legacy_templates_path, :class => 'button formbutton'
diff --git a/src/app/views/legacy_templates/search_packages.haml b/src/app/views/legacy_templates/search_packages.haml
deleted file mode 100644
index 94e30f5..0000000
--- a/src/app/views/legacy_templates/search_packages.haml
+++ /dev/null
@@ -1 +0,0 @@
-= render :partial => 'software_selection', :locals => {:view => 'search_packages'}
diff --git a/src/app/views/legacy_templates/show.haml b/src/app/views/legacy_templates/show.haml
deleted file mode 100644
index 05eeedd..0000000
--- a/src/app/views/legacy_templates/show.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-- content_for :list do
-  = render :partial => 'list'
-
-- content_for :details do
-  = render :partial => 'layouts/details_pane'
diff --git a/src/app/views/legacy_templates/xml/_hardware_profile.xml.haml b/src/app/views/legacy_templates/xml/_hardware_profile.xml.haml
deleted file mode 100644
index 68ccc36..0000000
--- a/src/app/views/legacy_templates/xml/_hardware_profile.xml.haml
+++ /dev/null
@@ -1,6 +0,0 @@
-!!! XML
-%hardware_profile{ :href => hardware_profile_path(profile.id), :id => profile.external_key }<>
-  %name<>
-    = profile.name
-  - [profile.memory, profile.cpu, profile.architecture, profile.storage].each do |prop|
-    = render  :partial => 'legacy_templates/xml/hardware_profile_property.xml', :locals => { :property => prop }
diff --git a/src/app/views/legacy_templates/xml/_hardware_profile_property.xml.haml b/src/app/views/legacy_templates/xml/_hardware_profile_property.xml.haml
deleted file mode 100644
index bb0fa70..0000000
--- a/src/app/views/legacy_templates/xml/_hardware_profile_property.xml.haml
+++ /dev/null
@@ -1,9 +0,0 @@
-!!! XML
-- if property.kind == "range"
-  %property{ :kind => property.kind, :name => property.name, :unit => property.unit, :value => property.value, :first => property.range_first, :last => property.range_last }<>
-- else
-  %property{ :kind => property.kind, :name => property.name, :unit => property.unit, :value => property.value }<>
-    - if property.kind == "enum"
-      %enum<>
-        - property.property_enum_entries.each do |e|
-          %entry{ :value => e.value }<>
\ No newline at end of file
diff --git a/src/app/views/pools/_instances.haml b/src/app/views/pools/_instances.haml
index 868f962..3b7e60c 100644
--- a/src/app/views/pools/_instances.haml
+++ b/src/app/views/pools/_instances.haml
@@ -19,7 +19,7 @@
           %input{:name => 'instance_selected[]', :type => 'checkbox', :value => instance.id, :id => "instance_checkbox_#{instance.id}" }
           = link_to instance.name, instance_path(instance)
         %td
-          = instance.legacy_assembly.present? ? link_to((instance.legacy_assembly.name), legacy_assembly_path(instance.legacy_assembly)) : '&mdash;'
+          = instance.assembly_xml.name
         %td
           = instance.deployment.present? ? link_to((instance.deployment.name), deployment_path(instance.deployment)) : '&mdash;'
         %td
diff --git a/src/config/image_descriptor_package_metagroups.conf b/src/config/image_descriptor_package_metagroups.conf
deleted file mode 100644
index 7218e5c..0000000
--- a/src/config/image_descriptor_package_metagroups.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-admin-tools=base-system;system-tools,base-system;admin-tools,rpmfusion_free;hardware-support
-desktop-gnome=rpmfusion_free;gnome-desktop,desktops;gnome-desktop
-desktop-kde=desktops;kde-desktop,rpmfusion_free;kde-desktop
-desktop-xfce=desktops;xfce-desktop
-desktop-other=desktops;window-managers,desktops;sugar-desktop,desktops;lxde-desktop,desktops;moblin-desktop
-education=apps;education,development;electronic-lab
-fonts=base-system;fonts,base-system;legacy-fonts
-games=apps;games,rpmfusion_free;games,rpmfusion_nonfree;games
-graphics=apps;graphics
-internet=apps;text-internet,apps;graphical-internet,rpmfusion_free;internet
-legacy=base-system;legacy-software-support
-localization=base-system;input-methods,language-support;khmer-support,language-support;persian-support,language-support;georgian-support,language-support;malay-support,language-support;tonga-support,language-support;portuguese-support,language-support;japanese-support,language-support;hungarian-support,language-support;somali-support,language-support;punjabi-support,language-support;bhutanese-support,language-support;british-support,language-support;korean-support,language-support;lao-support,language-support;inuktitut-support,language-support;german-support,language-support;hindi-support,language-support;faeroese-support,language-support;swedish-support,language-support;tsonga-support,language-support;russian-support,language-support;serbian-support,language-support;latvian-support,language-support;samoan-support,language-support;sinhala-support,language-support;catalan-support,language-support;lithuanian-support,language-support;turkish-support,language-support;arabic-support,language-support;vietnamese-support,language-support;mongolian-support,language-support;tswana-support,language-support;irish-support,language-support;italian-support,language-support;slovak-support,language-support;slovenian-support,language-support;belarusian-support,language-support;northern-sotho-support,language-support;kannada-support,language-support;malayalam-support,language-support;swati-support,language-support;breton-support,language-support;romanian-support,language-support;greek-support,language-support;tagalog-support,language-support;zulu-support,language-support;tibetan-support,language-support;danish-support,language-support;afrikaans-support,language-support;southern-sotho-support,language-support;bosnian-support,language-support;brazilian-support,language-support;basque-support,language-support;welsh-support,language-support;thai-support,language-support;telugu-support,language-support;low-saxon-support,language-support;urdu-support,language-support;tamil-support,language-support;indonesian-support,language-support;gujarati-support,language-support;xhosa-support,language-support;chinese-support,language-support;czech-support,language-support;venda-support,language-support;bulgarian-support,language-support;albanian-support,language-support;galician-support,language-support;armenian-support,language-support;dutch-support,language-support;oriya-support,language-support;maori-support,language-support;nepali-support,language-support;icelandic-support,language-support;ukrainian-support,language-support;assamese-support,language-support;bengali-support,language-support;spanish-support,language-support;hebrew-support,language-support;estonian-support,language-support;french-support,language-support;croatian-support,language-support;filipino-support,language-support;finnish-support,language-support;norwegian-support,language-support;southern-ndebele-support,language-support;polish-support,language-support;gaelic-support,language-support;marathi-support,language-support;ethiopic-support,language-support;esperanto-support,language-support;northern-sami-support,language-support;macedonian-support,language-support;walloon-support,language-support;kashubian-support,language-support;kashmiri-support,language-support;konkani-support,language-support;tajik-support,language-support;sindhi-support,language-support;uzbek-support,language-support;burmese-support,language-support;maithili-support,language-support;kazakh-support,language-support;azerbaijani-support,language-support;fijian-support,language-support;tetum-support,language-support;upper-sorbian-support,language-support;sanskrit-support,language-support;sardinian-support,language-support;swahili-support,language-support;maltese-support,language-support;friulian-support,language-support;latin-support,language-support;interlingua-support,language-support;occitan-support,language-support;hiligaynon-support,language-support;malagasy-support,language-support;amazigh-support,language-support;manx-support,language-support;turkmen-support,language-support;kinyarwanda-support,language-support;kurdish-support,language-support;coptic-support,language-support;luxembourgish-support,language-support;frisian-support,language-support;chichewa-support
-multimedia=apps;sound-and-video,rpmfusion_free;sound-and-video
-office=apps;office,apps;editors
-other=apps;engineering-and-scientific,rpmfusion_free;misc-libs,rpmfusion_nonfree;emulators
-programming=development;haskell,development;kde-software-development,development;gnome-software-development,development;development-tools,development;eclipse,development;development-libs,development;x-software-development,development;web-development,development;legacy-software-development,development;ruby,development;java-development,development;xfce-software-development,development;fedora-packager,development;mingw32,development;ocaml;development;perl;development;books
-publishing=apps;authoring-and-publishing,apps;font-design
-servers=servers;clustering,servers;dns-server,servers;server-cfg,servers;news-server,servers;web-server,servers;smb-server,servers;sql-server,servers;ftp-server,servers;printing,servers;mysql,servers;mail-server,servers;network-server,servers;legacy-network-server;servers;directory-server
-system=base-system;java,base-system;base-x,base-system;hardware-support,base-system;dial-up,base-system;base,rpmfusion_free;base,rpmfusion_free;system-tools,rpmfusion_nonfree;hardware-support,rpmfusion_nonfree;misc-tools,rpmfusion_nonfree;base
-virtualization=base-system;virtualization
diff --git a/src/config/image_descriptor_package_repositories.yml b/src/config/image_descriptor_package_repositories.yml
deleted file mode 100644
index 6285ff1..0000000
--- a/src/config/image_descriptor_package_repositories.yml
+++ /dev/null
@@ -1,35 +0,0 @@
--
-  id: fedora13
-  name: Fedora
-  baseurl: http://download.fedoraproject.org/pub/fedora/linux/releases/13/Fedora/x86_64/os/
-  type: xml
-  install: true
-  platform_id: fedora13
-
--
-  id: fedora14
-  name: Fedora
-  baseurl: http://download.fedoraproject.org/pub/fedora/linux/releases/14/Fedora/x86_64/os/
-  type: xml
-  install: true
-  platform_id: fedora14
-
--
-  id: aeolus-custom
-  name: Aeolus-custom
-  baseurl: http://repos.fedorapeople.org/repos/aeolus/demo/webapp/
-  type: xml
-  platform_id: fedora14
-
-# you can define multiple repositories, as array, for example:
-#
-# -
-#   id: repo1
-#   name: Repo
-#   baseurl: url
-#   type: xml
-#
-# -
-#   baseurl: https://admin:admin@localhost/pulp/api/
-#   yumurl: https://localhost/pulp/repos/
-#   type: pulp
diff --git a/src/config/image_descriptor_platform_repositories.yml b/src/config/image_descriptor_platform_repositories.yml
deleted file mode 100644
index b43c115..0000000
--- a/src/config/image_descriptor_platform_repositories.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-fedora13:
-  name: Fedora
-  version: 13
-  architecture: x86_64
-
-fedora14:
-  name: Fedora
-  version: 14
-  architecture: x86_64
diff --git a/src/config/image_descriptor_targets.yml b/src/config/image_descriptor_targets.yml
deleted file mode 100644
index 771ddfc..0000000
--- a/src/config/image_descriptor_targets.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-#rhevm:
-#  name: RHEV-M
-
-ec2:
-  name: Amazon EC2
-
-#rackspace:
-#  name: RackSpace
-
-#gogrid:
-#  name: GoGrid
-
-#vmware_esx:
-#  name: VMWare ESX
-
-# For development, just uncomment this target to do fake image builds
-#mock:
-#  name: Mock
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 93b65e3..021cffa 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -131,15 +131,6 @@ en:
     index:
       deleted: "Deleted the following Pool Families: %{list}."
       not_deleted: "Could not delete the following Pool Families: %{list}."
-  legacy_templates:
-    legacy_templates: Templates
-    index:
-      deleted:
-        one: "Template %{list} was deleted."
-        other: "Templates %{list} were deleted."
-      not_deleted:
-        one: "Template %{list} was not deleted."
-        other: "Templates %{list} were not deleted."
   suggested_deployables:
     index:
       suggested_deployables: Suggested Deployables
diff --git a/src/config/navigation.rb b/src/config/navigation.rb
index c05a5a4..4d2a589 100644
--- a/src/config/navigation.rb
+++ b/src/config/navigation.rb
@@ -6,12 +6,6 @@ SimpleNavigation::Configuration.run do |navigation|
       second_level.item :deployments, t('deployments.deployments'),deployments_path, :highlights_on => /^\/$|\/deployments/
       second_level.item :instances, t("instances.instances"), instances_path
     end
-    first_level.item :image_factory, t(:image_factory), legacy_templates_path, :highlights_on => /\/image_factory/ do |second_level|
-      second_level.item :legacy_templates, t('legacy_templates.legacy_templates'), legacy_templates_path
-      second_level.item :assemblies, t(:assemblies), legacy_assemblies_path
-      second_level.item :deployables, t('deployables.index.deployables'), legacy_deployables_path
-      second_level.item :image_imports, t(:image_imports), new_image_import_path
-    end
     first_level.item :administration, t(:administration), users_path, :highlights_on => /\/admin/ do |second_level|
       second_level.item :users, t(:users), users_path, :highlights_on => /\/users/
       second_level.item :roles, t(:roles), roles_path, :highlights_on => /\/roles/
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 3e9caa0..7f83338 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -33,19 +33,13 @@ ActionController::Routing::Routes.draw do |map|
   # -- just remember to delete public/index.html.
 
   map.resources :pools, :collection => { :multi_destroy => :delete }
-  map.resources :deployments, :collection  => { :multi_stop => :get, :launch_new => :get, :legacy_new => :get,
-                                :legacy_launch_new => :get, :check_name => :get }
-  map.resources :instances, :collection => {:start => :get, :multi_stop => :get, :select_legacy_template => :get, :remove_failed => :get, :can_start => :get, :can_create => :get }, :member => {:key => :get}
+  map.resources :deployments, :collection  => { :multi_stop => :get, :launch_new => :get, :check_name => :get }
+  map.resources :instances, :collection => {:start => :get, :multi_stop => :get, :remove_failed => :get, :can_start => :get, :can_create => :get }, :member => {:key => :get}
 
   map.can_start_instance '/instances/:instance_id/can_start/:provider_account_id', :controller => 'instances', :action => 'can_start', :conditions => { :method => :get }
   map.can_create_instance '/instances/:instance_id/can_create/:provider_account_id', :controller => 'instances', :action => 'can_create', :conditions => { :method => :get }
 
-  map.resources :legacy_assemblies
   map.resources :image_imports
-  map.resources :legacy_deployables, :collection => { :multi_destroy => :delete }, :member => { :pick_assemblies => :get, :remove_assemblies => :delete, :add_assemblies => :put, :launch => :post }
-  map.resources :legacy_templates, :collection => {:collections => :get, :add_selected => :get, :metagroup_packages => :get, :remove_package => :get, :multi_destroy => :delete}
-  map.connect "/builds/update_status.:format", :controller => :builds, :action => :update_status
-  map.resources :builds, :collection => { :delete => :delete, :upload => :get, :retry => :post }
 
   map.resources :hardware_profiles, :collection => { :multi_destroy => :delete }
   map.resources :providers, :collection => { :multi_destroy => :delete }
diff --git a/src/db/migrate/20110207101100_deployment_roles.rb b/src/db/migrate/20110207101100_deployment_roles.rb
index 87dab6e..88e88ac 100644
--- a/src/db/migrate/20110207101100_deployment_roles.rb
+++ b/src/db/migrate/20110207101100_deployment_roles.rb
@@ -36,7 +36,6 @@ class DeploymentRoles < ActiveRecord::Migration
                                            Deployment   => [VIEW,USE,MOD,CRE,VPRM,GPRM],
                                            Quota        => [VIEW,    MOD],
                                            PoolFamily   => [VIEW,    MOD,CRE,VPRM,GPRM],
-                                           LegacyTemplate     => [VIEW,USE,MOD,CRE,VPRM,GPRM],
                                            BasePermissionObject => [ MOD,    VPRM,GPRM]}]}}
   def self.up
     unless Role.all.size == 0
diff --git a/src/db/migrate/20110223132404_add_target_id_column_to_legacy_images.rb b/src/db/migrate/20110223132404_add_target_id_column_to_legacy_images.rb
index 62bb690..f7ed2bc 100644
--- a/src/db/migrate/20110223132404_add_target_id_column_to_legacy_images.rb
+++ b/src/db/migrate/20110223132404_add_target_id_column_to_legacy_images.rb
@@ -5,24 +5,10 @@ class AddTargetIdColumnToLegacyImages < ActiveRecord::Migration
 
   def self.up
     add_column :legacy_images, :provider_type_id, :integer, :null => false, :default => 100
-    transform_target_column
     remove_column :legacy_images, :target  end
 
   def self.down
     add_column :legacy_images, :target, :integer
-    transform_target_column_back
     remove_column :legacy_images, :provider_type_id
   end
-
-  def self.transform_target_column
-    LegacyImage.all.each do |image|
-      image.update_attribute(:provider_type_id, ProviderType.first(:conditions => {:name => PROVIDER_TYPES[image.target] }).id)
-    end
-  end
-
-  def self.transform_target_column_back
-    LegacyImage.all.each do |image|
-      image.update_attribute(:target, INVERTED_PROVIDER_TYPES[image.provider_type.name])
-    end
-  end
 end
diff --git a/src/db/migrate/20110302120000_add_status_to_provider_image.rb b/src/db/migrate/20110302120000_add_status_to_provider_image.rb
index 9225021..1fe41a3 100644
--- a/src/db/migrate/20110302120000_add_status_to_provider_image.rb
+++ b/src/db/migrate/20110302120000_add_status_to_provider_image.rb
@@ -1,14 +1,6 @@
 class AddStatusToProviderImage < ActiveRecord::Migration
   def self.up
     add_column :legacy_provider_images, :status, :string
-    LegacyProviderImage.all.each do |image|
-      if image.uploaded
-        image.status = 'completed'
-      else
-        image.status = "queued"
-      end
-      image.save!
-    end
     remove_column :legacy_provider_images, :uploaded
     remove_column :legacy_provider_images, :registered
   end
@@ -16,16 +8,6 @@ class AddStatusToProviderImage < ActiveRecord::Migration
   def self.down
     add_column :legacy_provider_images, :uploaded, :boolean
     add_column :legacy_provider_images, :registered, :boolean
-    LegacyProviderImage.all.each do |image|
-      if image.status == 'completed'
-        image.uploaded = true
-        image.registered = true
-      else
-        image.uploaded = false
-        image.registered = false
-      end
-      image.save!
-    end
     remove_column :legacy_provider_images, :status
   end
 end
diff --git a/src/db/migrate/20110322120000_add_legacy_template_creator_role.rb b/src/db/migrate/20110322120000_add_legacy_template_creator_role.rb
deleted file mode 100644
index 7b35532..0000000
--- a/src/db/migrate/20110322120000_add_legacy_template_creator_role.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Copyright (C) 2011 Red Hat, Inc.
-# Written by Scott Seago <sseago@redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.  A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-class AddLegacyTemplateCreatorRole < ActiveRecord::Migration
-
-
-  def self.up
-    unless Role.all.empty?
-      Role.transaction do
-        role_name = "LegacyTemplate Creator"
-        role = Role.find_or_initialize_by_name(role_name)
-        role.update_attributes({:name => role_name, :scope => BasePermissionObject.name,
-                                 :assign_to_owner => false})
-        role.save!
-        ["view","use","create"].each do |action|
-          Privilege.create!(:role => role, :target_type => LegacyTemplate.name,
-                            :action => action)
-        end
-      end
-      settings = {"self_service_default_template_obj" => BasePermissionObject.general_permission_scope,
-        "self_service_default_template_role" => Role.find_by_name("LegacyTemplate Creator"),
-        "self_service_perms_list" => "[self_service_default_pool,self_service_default_role], [self_service_default_template_obj,self_service_default_template_role]"}
-      settings.each_pair do |key, value|
-        MetadataObject.set(key, value)
-      end
-    end
-  end
-
-  def self.down
-  end
-end
diff --git a/src/db/migrate/20110616100915_remove_legacy_models.rb b/src/db/migrate/20110616100915_remove_legacy_models.rb
new file mode 100644
index 0000000..d9af3b1
--- /dev/null
+++ b/src/db/migrate/20110616100915_remove_legacy_models.rb
@@ -0,0 +1,20 @@
+class RemoveLegacyModels < ActiveRecord::Migration
+  def self.up
+    drop_table :instances_legacy_assemblies
+    drop_table :legacy_assemblies
+    drop_table :legacy_assemblies_legacy_deployables
+    drop_table :legacy_assemblies_legacy_templates
+    drop_table :legacy_deployables
+    drop_table :legacy_images
+    drop_table :legacy_provider_images
+    drop_table :legacy_templates
+    remove_column :deployments, :legacy_deployable_id
+    remove_column :icicles, :legacy_provider_image_id
+    remove_column :instances, :legacy_template_id
+    remove_column :instances, :legacy_assembly_id
+  end
+
+  def self.down
+    raise ActiveRecord::IrreversibleMigration
+  end
+end
diff --git a/src/db/seeds.rb b/src/db/seeds.rb
index 76e3772..eee6904 100644
--- a/src/db/seeds.rb
+++ b/src/db/seeds.rb
@@ -41,9 +41,6 @@ roles =
    ProviderAccount =>
      {"Provider Account User"  => [false, {ProviderAccount => [VIEW,USE]}],
       "Provider Account Owner" => [true,  {ProviderAccount => [VIEW,USE,MOD,    VPRM,GPRM]}]},
-   LegacyTemplate =>
-     {"Template User"          => [false, {LegacyTemplate     => [VIEW,USE]}],
-      "Template Owner"         => [true,  {LegacyTemplate     => [VIEW,USE,MOD,    VPRM,GPRM]}]},
    SuggestedDeployable =>
      {"SuggestedDeployable User"          => [false, {SuggestedDeployable     => [VIEW,USE]}],
       "SuggestedDeployable Owner"         => [true,  {SuggestedDeployable     => [VIEW,USE,MOD,VPRM,GPRM]}]},
@@ -61,8 +58,6 @@ roles =
                                            PoolFamily   => [VIEW,    MOD,CRE,VPRM,GPRM]}],
       "SuggestedDeployable Administrator" => [false, {SuggestedDeployable => [VIEW,USE,MOD,CRE,VPRM,GPRM]}],
       "SuggestedDeployable Global User"   => [false, {SuggestedDeployable=> [VIEW,USE]}],
-      "Template Administrator" => [false, {LegacyTemplate     => [VIEW,USE,MOD,CRE,VPRM,GPRM]}],
-      "Template Creator"       => [false, {LegacyTemplate     => [VIEW,USE,    CRE]}],
       "Administrator"          => [false, {Provider     => [VIEW,    MOD,CRE,VPRM,GPRM],
                                            ProviderAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM],
                                            HardwareProfile => [      MOD,CRE,VPRM,GPRM],
@@ -73,7 +68,6 @@ roles =
                                            Deployment   => [VIEW,USE,MOD,CRE,VPRM,GPRM],
                                            Quota        => [VIEW,    MOD],
                                            PoolFamily   => [VIEW,    MOD,CRE,VPRM,GPRM],
-                                           LegacyTemplate      => [VIEW,USE,MOD,CRE,VPRM,GPRM],
                                            SuggestedDeployable => [VIEW,USE,MOD,CRE,VPRM,GPRM],
                                            BasePermissionObject => [ MOD,    VPRM,GPRM]}]}}
 Role.transaction do
@@ -103,20 +97,17 @@ default_quota = Quota.create
 
 default_pool = Pool.find_by_name("default_pool")
 default_role = Role.find_by_name("Pool User")
-default_template_role = Role.find_by_name("Template Creator")
 default_suggested_deployable_role = Role.find_by_name("SuggestedDeployable Global User")
 
 settings = {"allow_self_service_logins" => "true",
   "self_service_default_quota" => default_quota,
   "self_service_default_pool" => default_pool,
   "self_service_default_role" => default_role,
-  "self_service_default_template_obj" => BasePermissionObject.general_permission_scope,
-  "self_service_default_template_role" => default_template_role,
   "self_service_default_suggested_deployable_obj" => BasePermissionObject.general_permission_scope,
   "self_service_default_suggested_deployable_role" => default_suggested_deployable_role,
   # perm list in the format:
   #   "[resource1_key, resource1_role], [resource2_key, resource2_role], ..."
-  "self_service_perms_list" => "[self_service_default_pool,self_service_default_role], [self_service_default_template_obj,self_service_default_template_role], [self_service_default_suggested_deployable_obj,self_service_default_suggested_deployable_role]"}
+  "self_service_perms_list" => "[self_service_default_pool,self_service_default_role], [self_service_default_suggested_deployable_obj,self_service_default_suggested_deployable_role]"}
 settings.each_pair do |key, value|
   MetadataObject.set(key, value)
 end
diff --git a/src/features/authentication.feature b/src/features/authentication.feature
index bdf46ed..ee8a465 100644
--- a/src/features/authentication.feature
+++ b/src/features/authentication.feature
@@ -18,7 +18,7 @@ Feature: User authentication
 
   Scenario: Edit profile
     Given I am logged in
-    And I am on the legacy assemblies page
+    And I am on the root page
     When I want to edit my profile
     Then should see "Editing Account"
     When I fill in "E-mail" with "changed@example.com"
@@ -28,7 +28,7 @@ Feature: User authentication
 
   Scenario: log out
     Given I am logged in
-    And I am on the legacy assemblies page
+    And I am on the root page
     When I follow "Log out"
     Then I should be logged out
     And I should see "Username:"
@@ -37,7 +37,7 @@ Feature: User authentication
 
   Scenario: Change user login to one with invalid length
     Given I am logged in
-    And I am on the legacy assemblies page
+    And I am on the root page
     When I want to edit my profile
     Then should see "Editing Account"
     When I enter a string of length "101" into "user[login]"
diff --git a/src/features/instance.feature b/src/features/instance.feature
index d9e830a..02fdf35 100644
--- a/src/features/instance.feature
+++ b/src/features/instance.feature
@@ -95,53 +95,54 @@ Feature: Manage Instances
     And I should see "mock2: stop action was successfully queued"
     And I should see "mock3: stop is an invalid action"
 
-  @tag
-  Scenario: Search for instances
-    Given there are the following instances:
-    | name      | external_key | state   | public_addresses    | private_addresses     |
-    | mockname  | ext_mock     | running | mock.public.address  | mock.private.address  |
-    | test      | ext_test     | pending | test.public.address  | test.private.address  |
-    | other     | ext_other    | stopped | other.public.address | other.private.address |
-    And there is the following instance with a differently-named owning user:
-    | name  | external_key | state   | public_addresses    | private_addresses     |
-    | foo   | ext_foo      | stopped | foo.public.address  | foo.private.address   |
-    And I am on the the instances page
-    When I fill in "q" with "mockname"
-    And I press "Search"
-    Then I should see "mock"
-    And I should not see "test"
-    And I should not see "other"
-    And I should not see "foo"
-    When I fill in "q" with "ext_other"
-    And I press "Search"
-    Then I should not see "mock"
-    And I should not see "test"
-    And I should see "other"
-    And I should not see "foo"
-    When I fill in "q" with "pending"
-    And I press "Search"
-    Then I should not see "mock"
-    And I should see "test"
-    And I should not see "other"
-    And I should not see "foo"
-    When I fill in "q" with "mock.public.address"
-    And I press "Search"
-    Then I should see "mock"
-    And I should not see "test"
-    And I should not see "other"
-    And I should not see "foo"
-    When I fill in "q" with "test.private.address"
-    And I press "Search"
-    Then I should not see "mock"
-    And I should see "test"
-    And I should not see "other"
-    And I should not see "foo"
-    When I fill in "q" with "Doe"
-    And I press "Search"
-    Then I should not see "mock"
-    And I should not see "test"
-    And I should not see "other"
-    And I should see "foo"
+  # not supported in UI now
+  #@tag
+  #Scenario: Search for instances
+  #  Given there are the following instances:
+  #  | name      | external_key | state   | public_addresses    | private_addresses     |
+  #  | mockname  | ext_mock     | running | mock.public.address  | mock.private.address  |
+  #  | test      | ext_test     | pending | test.public.address  | test.private.address  |
+  #  | other     | ext_other    | stopped | other.public.address | other.private.address |
+  #  And there is the following instance with a differently-named owning user:
+  #  | name  | external_key | state   | public_addresses    | private_addresses     |
+  #  | foo   | ext_foo      | stopped | foo.public.address  | foo.private.address   |
+  #  And I am on the the instances page
+  #  When I fill in "q" with "mockname"
+  #  And I press "Search"
+  #  Then I should see "mock"
+  #  And I should not see "test"
+  #  And I should not see "other"
+  #  And I should not see "foo"
+  #  When I fill in "q" with "ext_other"
+  #  And I press "Search"
+  #  Then I should not see "mock"
+  #  And I should not see "test"
+  #  And I should see "other"
+  #  And I should not see "foo"
+  #  When I fill in "q" with "pending"
+  #  And I press "Search"
+  #  Then I should not see "mock"
+  #  And I should see "test"
+  #  And I should not see "other"
+  #  And I should not see "foo"
+  #  When I fill in "q" with "mock.public.address"
+  #  And I press "Search"
+  #  Then I should see "mock"
+  #  And I should not see "test"
+  #  And I should not see "other"
+  #  And I should not see "foo"
+  #  When I fill in "q" with "test.private.address"
+  #  And I press "Search"
+  #  Then I should not see "mock"
+  #  And I should see "test"
+  #  And I should not see "other"
+  #  And I should not see "foo"
+  #  When I fill in "q" with "Doe"
+  #  And I press "Search"
+  #  Then I should not see "mock"
+  #  And I should not see "test"
+  #  And I should not see "other"
+  #  And I should see "foo"
 
 
   Scenario: Instance with correct id is displayed when id is greater than 10
@@ -192,15 +193,16 @@ Feature: Manage Instances
     When I am viewing the mock instance
     Then I should get back a partial
 
-  Scenario: Create an instance and get JSON response
-    Given I accept JSON
-    When I create mock instance
-    Then I should get back instance in JSON format
+  # for now it's not supported to create an instance, only deployment
+  #Scenario: Create an instance and get JSON response
+  #  Given I accept JSON
+  #  When I create mock instance
+  #  Then I should get back instance in JSON format
 
-  Scenario: Create an instance over XHR
-    Given I request XHR
-    When I create mock instance
-    Then I should get back a partial
+  #Scenario: Create an instance over XHR
+  #  Given I request XHR
+  #  When I create mock instance
+  #  Then I should get back a partial
 
   Scenario: Stop an instance
     Given there is a "mock1" running instance
diff --git a/src/features/step_definitions/authentication.rb b/src/features/step_definitions/authentication.rb
index b0aa0ee..cd34149 100644
--- a/src/features/step_definitions/authentication.rb
+++ b/src/features/step_definitions/authentication.rb
@@ -47,7 +47,8 @@ When /^I forget to enter my password$/ do
 end
 
 When /^I want to edit my profile$/ do
-  click_link "#{user.first_name} #{user.last_name}"
+  click_link "My Account"
+  click_link "Edit"
 end
 
 Then /^I should be logged out$/ do
diff --git a/src/features/support/custom.rb b/src/features/support/custom.rb
index 08323f9..97a2c34 100644
--- a/src/features/support/custom.rb
+++ b/src/features/support/custom.rb
@@ -33,22 +33,6 @@ ProviderAccount.class_eval do
 #  end
 end
 
-RepositoryManager.class_eval do
-  def load_config
-    [{
-      'baseurl' => 'http://pulptest',
-      'yumurl'  => 'http://pulptest',
-      'type'    => 'pulp'
-    }]
-  end
-end
-
-LegacyTemplate.class_eval do
-  def upload
-    true
-  end
-end
-
 InstanceKey.class_eval do
   def replace_on_server(addr, new)
     true
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index d69ef13..fc86294 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -77,24 +77,9 @@ module NavigationHelpers
     when /the new permission page/
       url_for new_permission_path
 
-    when /the new template page/
-      url_for new_legacy_template_path
-
-    when /the new template build page/
-      url_for new_build_path
-
-    when /the template builds page/
-      url_for legacy_template_path(@template, :details_tab => 'builds')
-
     when /the pool family provider accounts page/
       url_for pool_family_path(@pool_family, :details_tab => 'provider_accounts')
 
-    when /the templates page/
-      legacy_templates_path
-
-    when /the create template page/
-      url_for create_legacy_template_path
-
     when /the self service settings page/
       url_for :action => 'self_service', :controller => 'settings', :only_path => true
 
@@ -113,15 +98,9 @@ module NavigationHelpers
     when /^(.*)'s provider account page$/
       provider_account_path(ProviderAccount.find_by_label($1))
 
-    when /the deployable deployments page/
-      legacy_deployable_path(@deployable, :details_tab => 'deployments')
-
     when /the operational status of deployment page/
       deployment_path(@deployment, :details_tab => 'operation')
 
-    when /^(.*)'s deployable page$/
-      legacy_deployable_path(LegacyDeployable.find_by_name($1))
-
     when /^(.*)'s edit deployment page$/
       edit_deployment_path(Deployment.find_by_name($1))
 
diff --git a/src/lib/tasks/dc_tasks.rake b/src/lib/tasks/dc_tasks.rake
index 9be5a5d..4f2f9d6 100644
--- a/src/lib/tasks/dc_tasks.rake
+++ b/src/lib/tasks/dc_tasks.rake
@@ -85,27 +85,6 @@ namespace :dc do
     Rake::Task[:'dc:create_admin_user'].invoke
   end
 
-  desc 'Import images'
-  task :import, [:provider, :username, :password, :image] => :environment do |t, args|
-    unless args.provider and args.username and args.password and args.image
-      puts "Usage: rake 'dc:import[provider,username,password,imageid]'"
-      exit(1)
-    end
-    #account = get_account(args.provider, args.account)
-    img = LegacyImage.single_import(args.provider, args.username, args.password, args.image, User.find_by_login('admin'))
-    puts "Imported image with id '#{args.image}'"
-  end
-
-  desc 'Bulk import images'
-  task :bulk_import, [:provider, :username, :password, :yml_file] => :environment do |t, args|
-    unless args.provider and args.username and args.password and args.yml_file
-      puts "Usage: rake 'dc:import[provider,username,password,yml_file]'"
-      exit(1)
-    end
-    list = YAML.load_file(args.yml_file)
-    LegacyImage.bulk_import(args.provider, args.username, args.password, list, User.find_by_login('admin'))
-  end
-
   def get_account(provider_name, account_name)
     unless provider = Provider.find_by_name(provider_name)
       raise "There is no provider with '#{provider_name}' name"
diff --git a/src/script/use-existing-ec2-templates b/src/script/use-existing-ec2-templates
deleted file mode 100755
index 3eb5541..0000000
--- a/src/script/use-existing-ec2-templates
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/ruby
-# Copyright (C) 2010 Red Hat, Inc.
-# Written by Ian Main <imain@redhat.com>
-
-
-$: << File.join(File.dirname(__FILE__), "../dutils")
-
-require 'rubygems'
-require 'dutils'
-require 'optparse'
-
-
-def add_ec2_template(xml_info, summary, ec2_ami)
-
-  provider = Provider.find(:first)
-  if provider == nil || provider.provider_type != ProviderType.find_by_codename("ec2")
-    puts "You need to set up an EC2 provider before you can run this script."
-    exit
-  end
-
-  template = Template.new
-
-  # Incredibly, all the info actually comes from the xml..
-  template.xml = xml_info
-  template.summary = summary
-  template.complete=true
-  template.uploaded=true
-
-  template.save!
-
-  image = Image.new
-  image.name = template.name
-  image.build_id = "1234"
-  image.status = "complete"
-  image.target = "ec2"
-  image.template_id = template.id
-  image.save!
-
-  rep = ProviderImage.new
-  rep.image_id = image.id
-  rep.provider_id = provider.id
-  rep.provider_image_key = ec2_ami
-  rep.uploaded = true
-  rep.registered = true
-  rep.save!
-
-  puts "Saved image #{summary} for use."
-end
-
-add_ec2_template("
-  <?xml version=\"1.0\"?>
-  <image>
-    <name>Amazon public fedora 8 image</name>
-  <repos>
-    <repo>http://download.fedoraproject.org/pub/fedora/linux/releases/8/Fedora/i386/os/</repo>
-  </repos>
-  <os name=\"fedora\" version=\"8\" architecture=\"32-bit\"/>",
-  "Amazon public fedora 8 image",
-  "ami-f51aff9c")
-
-add_ec2_template("
-  <?xml version=\"1.0\"?>
-  <image>
-    <name>Amazon public fedora 8 64 bit image</name>
-  <repos>
-    <repo>http://download.fedoraproject.org/pub/fedora/linux/releases/8/Fedora/x86_64/os/</repo>
-  </repos>
-  <os name=\"fedora\" version=\"8\" architecture=\"64-bit\"/>",
-  "Amazon public fedora 8 64 bit image",
-  "ami-f61dfd9f")
-
-add_ec2_template("
-  <?xml version=\"1.0\"?>
-  <image>
-    <name>Aeolus Conductor demo Fedora 13 64 bit image</name>
-  <repos>
-    <repo>http://download.fedoraproject.org/pub/fedora/linux/releases/13/Fedora/x86_64/os/</repo>
-  </repos>
-  <os name=\"fedora\" version=\"13\" architecture=\"64-bit\"/>",
-  "Aeolus Conductor Fedora 13 64 bit image",
-  "ami-709d6919")
diff --git a/src/spec/controllers/legacy_templates_controller_spec.rb b/src/spec/controllers/legacy_templates_controller_spec.rb
deleted file mode 100644
index fdf2dc5..0000000
--- a/src/spec/controllers/legacy_templates_controller_spec.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'spec_helper'
-
-describe LegacyTemplatesController do
-
-  fixtures :all
-  before(:each) do
-    @admin_permission = Factory :admin_permission
-    @admin = @admin_permission.user
-    @tuser = Factory :tuser
-    activate_authlogic
-  end
-
-  it "should deny access to new legacy_template ui without image modify permission" do
-    UserSession.create(@tuser)
-    get :new
-    response.should_not render_template("new")
-  end
-end
diff --git a/src/spec/factories/build_job.rb b/src/spec/factories/build_job.rb
deleted file mode 100644
index b614f5f..0000000
--- a/src/spec/factories/build_job.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-Factory.define :build_job do |p|
-  hydra = Typhoeus::Hydra.new
-  response = Typhoeus::Response.new(:code => 200, :headers => "", :body => "<?xml version=\"1.0\" encoding=\"UTF-8\"><image><uuid>build-job-stub-uuid</uuid></image>", :time => 0.1)
-  hydra.stub(:post, YAML.load_file("#{RAILS_ROOT}/config/image_factory_console.yml")['buildurl']).and_return(response)
-  p.image_id { Factory.create(:legacy_image).id }
-  p.hydra hydra
-end
diff --git a/src/spec/factories/legacy_assembly.rb b/src/spec/factories/legacy_assembly.rb
deleted file mode 100644
index 6906036..0000000
--- a/src/spec/factories/legacy_assembly.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-Factory.define :legacy_assembly do |a|
-  a.sequence(:name) { |n| "assembly#{n}" }
-  a.architecture 'x86_64'
-  a.association :owner, :factory => :user
-  a.legacy_templates { |t| [t.association(:legacy_template)] }
-end
diff --git a/src/spec/factories/legacy_deployable.rb b/src/spec/factories/legacy_deployable.rb
deleted file mode 100644
index de73e81..0000000
--- a/src/spec/factories/legacy_deployable.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-Factory.define :legacy_deployable do |a|
-  a.sequence(:name) { |n| "deployable#{n}" }
-  a.legacy_assemblies { |t| [t.association(:legacy_assembly)] }
-  a.association :owner, :factory => :user
-end
diff --git a/src/spec/factories/legacy_image.rb b/src/spec/factories/legacy_image.rb
deleted file mode 100644
index eaa49a1..0000000
--- a/src/spec/factories/legacy_image.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# Should have an image factory, that specifies name, key and arch
-# pool_image, and provider_image factories should extend image factory.
-
-Factory.define :legacy_image do |i|
-  i.sequence(:name) { |n| "image#{n}" }
-  i.status 'queued'
-  i.provider_type_id { ProviderType.find_by_codename("ec2").id }
-  i.association(:legacy_template)
-  i.after_build do |img|
-    if img.respond_to?(:stub!)
-      img.stub!(:build).and_return(true)
-      img.stub!(:upload).and_return(true)
-    end
-  end
-end
diff --git a/src/spec/factories/legacy_provider_image.rb b/src/spec/factories/legacy_provider_image.rb
deleted file mode 100644
index d13be9d..0000000
--- a/src/spec/factories/legacy_provider_image.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-Factory.define :legacy_provider_image do |ri|
-  ri.association :legacy_image
-  ri.association :provider
-  ri.sequence(:provider_image_key) { |n| "provider_image_key#(n)" }
-  ri.status "completed"
-  ri.association :icicle
-end
-
-Factory.define :mock_provider_image, :parent => :legacy_provider_image do |i|
-  i.provider { |p| p.association(:mock_provider) }
-end
-
-Factory.define :ec2_provider_image, :parent => :legacy_provider_image do |i|
-  i.provider { |p| p.association(:ec2_provider) }
-end
diff --git a/src/spec/factories/legacy_template.rb b/src/spec/factories/legacy_template.rb
deleted file mode 100644
index 7371a37..0000000
--- a/src/spec/factories/legacy_template.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-Factory.define :legacy_template do |i|
-  i.sequence(:name) { |n| "template#{n}" }
-  i.platform 'fedora13'
-  i.association :owner, :factory => :user
-  i.after_build do |tpl|
-    if tpl.respond_to?(:stub!)
-      tpl.stub!(:upload).and_return(true)
-      tpl.stub!(:delete_in_warehouse).and_return(true)
-    end
-  end
-end
diff --git a/src/spec/factories/push_job.rb b/src/spec/factories/push_job.rb
deleted file mode 100644
index 4bd917c..0000000
--- a/src/spec/factories/push_job.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-Factory.define :push_job do |p|
-  p.legacy_provider_image_id { Factory.create(:legacy_provider_image, :provider => Factory.create(:mock_provider_account).provider).id }
-end
diff --git a/src/spec/models/build_job_spec.rb b/src/spec/models/build_job_spec.rb
deleted file mode 100644
index 0c4ecf8..0000000
--- a/src/spec/models/build_job_spec.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require 'spec_helper'
-
-describe BuildJob do
-  it "should match request and parse stubbed xml" do
-    job = Factory.build(:build_job)
-    uuid = job.perform
-    uuid.should == "build-job-stub-uuid"
-  end
-end
diff --git a/src/spec/models/legacy_assembly_spec.rb b/src/spec/models/legacy_assembly_spec.rb
deleted file mode 100644
index b5a911c..0000000
--- a/src/spec/models/legacy_assembly_spec.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require 'spec_helper'
-
-describe LegacyAssembly do
-
-  it "should have automatically generated uuid after validation" do
-    a = Factory.build(:legacy_assembly)
-    a.uuid = nil
-    a.save
-    a.uuid.should_not be_nil
-  end
-
-  it "should not be valid if legacy_assembly name is too long" do
-    a = Factory.build(:legacy_assembly)
-    a.name = ('a' * 256)
-    a.valid?.should be_false
-    a.errors[:name].should_not be_nil
-    a.errors[:name].should =~ /^is too long.*/
-  end
-
-  it "should have associated legacy_template" do
-    a = Factory.build(:legacy_assembly)
-    a.legacy_templates.size.should eql(1)
-  end
-
-end
diff --git a/src/spec/models/legacy_deployable_spec.rb b/src/spec/models/legacy_deployable_spec.rb
deleted file mode 100644
index 45dda19..0000000
--- a/src/spec/models/legacy_deployable_spec.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-require 'spec_helper'
-
-describe LegacyDeployable do
-
-  it "should have automatically generated uuid after validation" do
-    d = Factory.build(:legacy_deployable)
-    d.uuid = nil
-    d.save
-    d.uuid.should_not be_nil
-  end
-
-  it "should not be valid if deployable name is too long" do
-    d = Factory.build(:legacy_deployable)
-    d.name = ('a' * 256)
-    d.valid?.should be_false
-    d.errors[:name].should_not be_nil
-    d.errors[:name].should =~ /^is too long.*/
-  end
-
-  it "should have associated assembly" do
-    d = Factory.build(:legacy_deployable)
-    d.legacy_assemblies.size.should eql(1)
-  end
-
-  it "should not be destroyable when it has running instances" do
-    deployable = Factory.create(:legacy_deployable)
-    deployment = Factory.create(:deployment, :legacy_deployable_id => deployable.id)
-    assembly = Factory.create(:legacy_assembly)
-
-    instance = Factory.create(:instance, :deployment_id => deployment.id, :legacy_assembly_id => assembly.id, :legacy_template_id => nil)
-    LegacyDeployable.find(deployable).should_not be_destroyable
-
-    instance.state = Instance::STATE_STOPPED
-    instance.save!
-    LegacyDeployable.find(deployable).should be_destroyable
-  end
-
-  it "should not be destroyable when it has stopped stateful instances" do
-    deployable = Factory.build(:legacy_deployable)
-    deployment = Factory.build(:deployment, :legacy_deployable_id => deployable.id)
-    deployable.deployments << deployment
-    assembly = Factory.build(:legacy_assembly)
-
-    instance = Factory.build(:instance, :deployment_id => deployment.id, :legacy_assembly_id => assembly.id, :legacy_template_id => nil)
-    instance.stub!(:restartable?).and_return(true)
-    deployment.instances << instance
-    deployable.should_not be_destroyable
-
-    instance.state = Instance::STATE_STOPPED
-    deployable.should_not be_destroyable
-
-    instance.stub!(:restartable?).and_return(false)
-    deployable.should be_destroyable
-  end
-
-end
diff --git a/src/spec/models/legacy_image_spec.rb b/src/spec/models/legacy_image_spec.rb
deleted file mode 100644
index 4385b21..0000000
--- a/src/spec/models/legacy_image_spec.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-require 'spec_helper'
-
-describe LegacyImage do
-  it "should have a name" do
-    i = Factory.build(:legacy_image, :name => nil)
-    i.should_not be_valid
-
-    i.name = ''
-    i.should_not be_valid
-
-    i.name = "valid name"
-    i.should be_valid
-  end
-
-  it "should not have a name that is too long" do
-    i = Factory.build(:legacy_image)
-    i.name = 'x' * 1025
-    i.should_not be_valid
-
-    i.name = 'x' * 1024
-    i.should be_valid
-  end
-
-  it "should have automatically generated uuid after save" do
-    i = Factory.build(:legacy_image)
-    i.save
-    i.uuid.should_not be_nil
-  end
-
-  it "should have legacy_template_id" do
-    i = Factory.build(:legacy_image, :legacy_template_id => nil)
-    i.should_not be_valid
-
-    i.legacy_template_id = 1
-    i.should be_valid
-  end
-
-  it "should not create and build image if image already exists for specified target" do
-    old = Factory(:legacy_image)
-    lambda {LegacyImage.create_and_build!(old.legacy_template, old.provider_type)}.should raise_error(ImageExistsError)
-  end
-
-  it "should build image if there is provider and cloud account for specified target" do
-    acc = Factory.build(:mock_provider_account)
-    acc.stub!(:valid_credentials?).and_return(true)
-    acc.save!
-    tpl = Factory.build(:legacy_template)
-    tpl.save!
-    img = LegacyImage.create_and_build!(tpl, ProviderType.find_by_codename("mock"))
-    LegacyImage.find(img).should == img
-  end
-
-  it "should import image" do
-    image = OpenStruct.new(:id => 'mock', :name => 'mock', :description => 'imported mock', :architecture => 'i386')
-    client = mock('DeltaCloud', :feature? => false, :image => image)
-    account = Factory.build(:ec2_provider_account)
-    account.stub!(:connect).and_return(client)
-    account.stub!(:valid_credentials?).and_return(true)
-    account.save!
-
-    # Stub the `upload` class method. This saves us from requining
-    # Image Warehouse daemon to be running for the tests.
-    ImageWarehouseObject.send(:define_method, :upload) { nil }
-
-    lambda do
-      lambda do
-        lambda do
-          img = LegacyImage.import(account, 'mock', Factory(:user))
-          img.should_not be_nil
-          img.legacy_template.uploaded.should be_true
-        end.should change(LegacyImage, :count).by(1)
-      end.should change(LegacyTemplate, :count).by(1)
-    end.should change(LegacyProviderImage, :count).by(1)
-  end
-end
diff --git a/src/spec/models/legacy_template_spec.rb b/src/spec/models/legacy_template_spec.rb
deleted file mode 100644
index e1d9e57..0000000
--- a/src/spec/models/legacy_template_spec.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-require 'spec_helper'
-
-describe LegacyTemplate do
-  it "should have automatically generated uuid after validation" do
-    t = Factory.build(:legacy_template)
-    t.uuid = nil
-    t.save
-    t.uuid.should_not be_nil
-  end
-
-  it "should return list of providers who provides images built from this legacy_template" do
-    rimg = Factory.build(:mock_provider_image)
-    rimg.save!
-    rimg.legacy_image.legacy_template.providers.size.should eql(1)
-  end
-
-  it "should not be valid if legacy_template name is too long" do
-    t = Factory.build(:legacy_template)
-    t.name = ('a' * 256)
-    t.valid?.should be_false
-    t.errors[:name].should_not be_nil
-    t.errors[:name].should =~ /^is too long.*/
-  end
-
-  it "should not destroy legacy_template if there are instances created from this legacy_template" do
-    inst = Factory.build(:instance)
-    inst.save!
-    lambda do
-      inst.legacy_template.destroy
-    end.should_not change(LegacyTemplate, :count)
-  end
-
-  it "should update xml when legacy_template is saved" do
-    tpl = Factory.build(:legacy_template)
-    tpl.packages = ['test']
-    tpl.save!
-    tpl2 = LegacyTemplate.find(tpl)
-    tpl2.packages.should == ['test']
-  end
-
-  it "should have warehouse url" do
-    t = Factory.build(:legacy_template)
-    t.uuid = "uuid"
-    t.warehouse_url.should == YAML.load_file("#{RAILS_ROOT}/config/image_warehouse.yml")['baseurl'] + "/templates/" + t.uuid
-  end
-end
diff --git a/src/spec/models/push_job_spec.rb b/src/spec/models/push_job_spec.rb
deleted file mode 100644
index c4fb9e5..0000000
--- a/src/spec/models/push_job_spec.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require 'spec_helper'
-
-describe PushJob do
-  it "should match request and parse stubbed xml" do
-    image_id="6669978e-97a3-4381-92cb-2fbc160b49c7"
-    response = RestClient::Response.create("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<image>\n  <uuid>#{image_id}</uuid>\n</image>\n", 200, {})
-    response.stub(:code).and_return(200)
-    RestClient.stub(:post).and_return(response)
-    job = Factory.build(:push_job)
-    uuid = job.perform
-    uuid.should == image_id
-  end
-end
diff --git a/src/spec/services/registration_service_spec.rb b/src/spec/services/registration_service_spec.rb
index d30c69f..b26b7c6 100644
--- a/src/spec/services/registration_service_spec.rb
+++ b/src/spec/services/registration_service_spec.rb
@@ -17,7 +17,7 @@ describe RegistrationService do
       end
     end
 
-    it "should register a user with default pool/quota/role/template perms when default settings set" do
+    it "should register a user with default pool/quota/role perms when default settings set" do
       @user = Factory :user
       @pool = MetadataObject.lookup("self_service_default_pool")
       @role = MetadataObject.lookup("self_service_default_role")
@@ -33,8 +33,6 @@ describe RegistrationService do
 
       @user.quota.maximum_running_instances.should == @quota.maximum_running_instances
       @user.quota.maximum_total_instances.should == @quota.maximum_total_instances
-      BasePermissionObject.general_permission_scope.has_privilege(@user,Privilege::CREATE, LegacyTemplate).should == true
-      BasePermissionObject.general_permission_scope.has_privilege(@user,Privilege::USE, LegacyTemplate).should == true
     end
 
   end
@@ -53,7 +51,7 @@ describe RegistrationService do
         lambda do
           lambda do
             registration_process.save.should be_true
-          end.should change(Permission, :count).by(3)
+          end.should change(Permission, :count).by(2)
         end.should change(User, :count).by(1)
       end.should change(Quota, :count).by(1)
 
diff --git a/src/spec/utils/repository_manager_spec.rb b/src/spec/utils/repository_manager_spec.rb
deleted file mode 100644
index 7876254..0000000
--- a/src/spec/utils/repository_manager_spec.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-require 'spec_helper'
-
-describe RepositoryManager do
-  before(:all) do
-    @repositories_json = File.read(File.join(File.dirname(__FILE__),
-                                             '../fixtures/repositories.json'))
-    @packagegroups_json = File.read(File.join(File.dirname(__FILE__),
-                                              '../fixtures/packagegroups.json'))
-    @packages_json = File.read(File.join(File.dirname(__FILE__),
-                                         '../fixtures/packages.json'))
-    @packagegroupcategories_json = File.read(File.join(File.dirname(__FILE__),
-                                                       '../fixtures/packagegroupcategories.json'))
-  end
-
-  before(:each) do
-    hydra = Typhoeus::Hydra.hydra
-    hydra.stub(:get, "http://pulptest/repositories/").and_return(
-      Typhoeus::Response.new(:code => 200, :body => @repositories_json))
-    hydra.stub(:get, "http://pulptest/repositories/fedora/packagegroups/").and_return(
-      Typhoeus::Response.new(:code => 200, :body => @packagegroups_json))
-    hydra.stub(:get, "http://pulptest/repositories/fedora/packages/").and_return(
-      Typhoeus::Response.new(:code => 200, :body => @packages_json))
-    hydra.stub(:get, "http://pulptest/repositories/fedora/packagegroupcategories/").and_return(
-      Typhoeus::Response.new(:code => 200, :body => @packagegroupcategories_json))
-
-    @rmanager = RepositoryManager.new(:config => [{
-      'baseurl' => 'http://pulptest',
-      'yumurl' => 'http://pulptest',
-      'type'    => 'pulp',
-    }])
-  end
-
-  it 'should return a list of repositories' do
-    @rmanager.repositories.should have(1).items
-    @rmanager.repositories.first.id.should eql('fedora13')
-  end
-
-  it 'should return a list of packagegroups' do
-    rep = @rmanager.repositories.first
-    rep.groups.first[:id].should == 'system-tools'
-  end
-
-  it 'should return a list of categories' do
-    @rmanager.categories.should have(1).items
-    @rmanager.categories.first[:id].should eql('base-system')
-  end
-
-  it "should return a list of packages" do
-    @rmanager.packages.should have(2).items
-    @rmanager.packages.first[:name].should eql('libdeltacloud')
-  end
-end
-- 
1.7.4.4

