diff --git a/service/lib/agama/software/product_builder.rb b/service/lib/agama/software/product_builder.rb index 465e2107fd..243d9bb66b 100644 --- a/service/lib/agama/software/product_builder.rb +++ b/service/lib/agama/software/product_builder.rb @@ -20,23 +20,28 @@ # find current contact information at www.suse.com. require "agama/software/product" +require "agama/cmdline_args" +require "logger" module Agama module Software # Builds products from the information of a config file. class ProductBuilder # @param config [Agama::Config] - def initialize(config) + def initialize(config, logger: Logger.new($stdout)) @config = config + @logger = logger end # Builds the products. # # @return [Array] def build + cmdline_args = CmdlineArgs.read_from("/proc/cmdline") + @logger.info cmdline_args config.products.map do |id, attrs| data = product_data_from_config(id) - create_product(id, data, attrs) + create_product(id, data, attrs, cmdline_args) end end @@ -45,13 +50,19 @@ def build # @return [Agama::Config] attr_reader :config - def create_product(id, data, attrs) + def create_product(id, data, attrs, cmdline_args) Agama::Software::Product.new(id).tap do |product| product.display_name = attrs["name"] product.description = attrs["description"] product.name = data[:name] product.version = data[:version] - product.repositories = data[:repositories] + # Issue#1474 Use agama.install_url=https://path-to-repodata + if cmdline_args.data.has_key?("install_url") + @logger.info "Overriding default installation as args.install_url boot param is set to " + cmdline_args.data["install_url"] + product.repositories = [cmdline_args.data["install_url"],] + else + product.repositories = data[:repositories] + end product.labels = data[:labels] product.mandatory_packages = data[:mandatory_packages] product.optional_packages = data[:optional_packages]