Skip to content

Commit

Permalink
display base product name
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Apr 4, 2014
1 parent 4e828c1 commit 31fc923
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 18 deletions.
33 changes: 22 additions & 11 deletions src/clients/inst_scc.rb
Expand Up @@ -145,22 +145,33 @@ def register_base_system

# content for the main registration dialog
def scc_credentials_dialog
base_product = ::Registration::SwMgmt.find_base_product
base_product_name = base_product["display_name"] ||
base_product["short_name"] ||
base_product["name"] ||
_("Unknown product")

base_product_name << " " << ::Registration::SwMgmt.base_version(base_product["version"])

VBox(
Mode.installation ?
Right(PushButton(Id(:network), _("Network Configuration..."))) :
Empty(),
VStretch(),
HBox(
Frame(_("SUSE Customer Center Credentials"),
MarginBox(1, 0.5,
HSquash(
VBox(
MinWidth(33, InputField(Id(:email), _("&Email"))),
VSpacing(0.5),
MinWidth(33, InputField(Id(:reg_code), _("Registration &Code")))
)
)
)
HSquash(
VBox(
Left(Heading(base_product_name)),
VSpacing(1),
# TODO FIXME: replace by a real text describing the Email and the reg.code
Label("Lorem ipsum dolor sit amet, consectetur adipiscing elit pulvinar vel nunc.
Phasellus fermentum eros eget auctor tincidunt. Maecenas tempus sapien id
orci pellentesque vestibulum. Ut tellus enim, vestibulum eget consequat id,
scelerisque a justo. Maecenas bibendum, mauris ut cursus pharetra, mi nibh
ehicula massa, eu luctus turpis eros eu arcu. Suspendisse iaculis nunc eu."),
VSpacing(1),
MinWidth(33, InputField(Id(:email), _("&Email"))),
VSpacing(0.5),
MinWidth(33, InputField(Id(:reg_code), _("Registration &Code")))
)
),
VSpacing(3),
Expand Down
32 changes: 25 additions & 7 deletions src/lib/registration/sw_mgmt.rb
Expand Up @@ -69,10 +69,13 @@ def self.zypp_config_writable!
`mount -o bind #{tmpdir}/zypp #{ZYPP_DIR}`
end

def self.base_products_to_register
# just for debugging:
# return [{"name" => "SLES", "arch" => "x86_64", "version" => "12-1.47"}]
# "12-1.87" => "12"
# "12.1-1.87" => "12.1"
def self.base_version(version)
version.split("-", 2).first
end

def self.find_base_product
# during installation the products are :selected,
# on a running system the products are :installed
# during upgrade use the newer selected product (same as in installation)
Expand All @@ -87,12 +90,27 @@ def self.base_products_to_register
end
end

log.debug "Found base products: #{products}"
log.info "Found base products: #{products.map{|p| p["name"]}}"
log.warn "More than one base product found!" if products.size > 1

products.first
end

def self.base_product_to_register
# just for debugging:
# return {"name" => "SLES", "arch" => "x86_64", "version" => "12-1.47"}

base_product = find_base_product

# filter out not needed data
product_info = products.map do |p|
{ "name" => p["name"], "arch" => p["arch"], "version" => p["version"]}
end
product_info = {
"name" => base_product["name"],
"arch" => base_product["arch"],
"version" => base_product["version"]
}

log.info("Base products to register: #{product_info}")
log.info("Base product to register: #{product_info}")

product_info
end
Expand Down

0 comments on commit 31fc923

Please sign in to comment.