Skip to content

Commit

Permalink
Merge pull request #235 from SUSE/import-asm
Browse files Browse the repository at this point in the history
Import migration_extra attribute from SCC API
  • Loading branch information
Sergeykot committed Oct 30, 2018
2 parents 3079ec7 + d2c2d5f commit d2e2964
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
@@ -0,0 +1,5 @@
class AddMigrationExtraToProductsExtensions < ActiveRecord::Migration[5.1]
def change
add_column :products_extensions, :migration_extra, :boolean, default: false
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180420145408) do
ActiveRecord::Schema.define(version: 20181030125058) do

create_table "activations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.bigint "service_id", null: false
Expand Down Expand Up @@ -75,6 +75,7 @@
t.bigint "extension_id", null: false
t.boolean "recommended"
t.bigint "root_product_id", null: false
t.boolean "migration_extra", default: false
t.index ["extension_id"], name: "index_products_extensions_on_extension_id"
t.index ["product_id", "extension_id", "root_product_id"], name: "index_products_extensions_on_product_extension_root", unique: true
t.index ["product_id"], name: "index_products_extensions_on_product_id"
Expand Down
7 changes: 4 additions & 3 deletions lib/rmt/scc.rb
Expand Up @@ -109,7 +109,7 @@ def get_product(id)
Product.find_or_create_by(id: id)
end

def create_product(item, root_product_id = nil, base_product = nil, recommended = false)
def create_product(item, root_product_id = nil, base_product = nil, recommended = false, migration_extra = false)
@logger.debug("Adding product #{item[:identifier]}/#{item[:version]}#{(item[:arch]) ? '/' + item[:arch] : ''}")

product = get_product(item[:id])
Expand All @@ -123,15 +123,16 @@ def create_product(item, root_product_id = nil, base_product = nil, recommended
product_id: base_product,
extension_id: product.id,
root_product_id: root_product_id,
recommended: recommended
recommended: recommended,
migration_extra: migration_extra
)
else
root_product_id = product.id
ProductsExtensionsAssociation.where(root_product_id: root_product_id).destroy_all
end

item[:extensions].each do |ext_item|
create_product(ext_item, root_product_id, product.id, ext_item[:recommended])
create_product(ext_item, root_product_id, product.id, ext_item[:recommended], ext_item[:migration_extra])
end
end

Expand Down
5 changes: 5 additions & 0 deletions package/rmt-server.changes
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Oct 30 15:35:17 UTC 2018 - skotov@suse.com

- Import migration_extra attribute from SCC API

-------------------------------------------------------------------
Thu Sep 27 15:35:29 UTC 2018 - ikapelyukhin@suse.com

Expand Down

0 comments on commit d2e2964

Please sign in to comment.