Skip to content

Commit

Permalink
clients/inst_scc.rb - find the selected base product
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladislav Slezak authored and lslezak committed Jan 7, 2014
1 parent 05f12a9 commit 0b2097f
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/clients/inst_scc.rb
Expand Up @@ -22,10 +22,13 @@
# Summary: Ask user for the SCC credentials
#

require "installation/scc_client.rb"

module Yast
class InstSccClient < Client
def main
Yast.import "UI"
Yast.import "Pkg"

textdomain "installation"

Expand Down Expand Up @@ -63,8 +66,17 @@ def main
if ret == :next && email && reg_code
Popup.ShowFeedback(_("Sending Data"), _("Contacting the SUSE Customer Center server..."))

# load the package manager in the test mode
# in real installation it is already initialized
if @test_mode
Pkg.TargetInitialize("/")
Pkg.SourceStartCache(true)
end

base_products = selected_base_products

# TODO: connect to the SCC server here
sleep(7)
sleep(2)

Popup.ClearFeedback
end
Expand Down Expand Up @@ -103,6 +115,20 @@ def show_scc_credentials_dialog
GetInstArgs.enable_next || @test_mode
)
end

def selected_base_products
# source 0 is the base installation repo, the repos added later are considered as add-ons
# although they can also contain a different base product
products = Pkg.ResolvableProperties("", :product, "").find_all{|p| p["source"] == 0 && p["status"] == :selected}
.map{|p| { "name" => p["name"], "arch" => p["arch"], "version" => p["version"]}}

Builtins.y2internal("Found selected base products: #{products}")

products
end

def contact_scc(token)
end
end
end

Expand Down

0 comments on commit 0b2097f

Please sign in to comment.