Skip to content

Commit

Permalink
Merge pull request #76 from yast/registered_status
Browse files Browse the repository at this point in the history
remember registered extensions
  • Loading branch information
lslezak committed May 12, 2014
2 parents ad18fd4 + d2965ca commit 3abe48f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
5 changes: 4 additions & 1 deletion package/yast2-registration.changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
-------------------------------------------------------------------
Wed May 7 15:09:58 UTC 2014 - lslezak@suse.cz
Fri May 9 12:27:20 UTC 2014 - lslezak@suse.cz

- remember registered extensions, do not register them again
and disable the checkboxes (extensions cannot be "unregistered")
- display registered status in the main dialog
- use "extension" term consistently (bnc#875199)
- allow registering extensions in installed system without
re-registering the base product (bnc#876328)
Expand Down
31 changes: 27 additions & 4 deletions src/clients/inst_scc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ def scc_credentials_dialog
info += _("If you skip the registration now be sure to do so in the installed system.")
end

registered = ::Registration::Registration.is_registered?

VBox(
Mode.installation ?
Right(PushButton(Id(:network), _("Network Configuration..."))) :
Expand All @@ -197,7 +199,9 @@ def scc_credentials_dialog
VSpacing(1),
Left(Heading(::Registration::SwMgmt.base_product_label(base_product))),
VSpacing(1),
Label(info)
registered ?
Heading(_("The system is already registered.")) :
Label(info)
)
),
VSpacing(UI.TextMode ? 1 : 2),
Expand All @@ -209,7 +213,7 @@ def scc_credentials_dialog
)
),
VSpacing(UI.TextMode ? 1 : 3),
Mode.normal ? Empty() : PushButton(Id(:skip), _("&Skip Registration")),
registered ? Empty() : PushButton(Id(:skip), _("&Skip Registration")),
VStretch()
)
end
Expand Down Expand Up @@ -273,8 +277,10 @@ def addon_selection_items(addons)
label = addon.short_name
label << " (#{addon.long_name})" if addon.long_name && !addon.long_name.empty?

box.params << Left(CheckBox(Id(addon.product_ident), Opt(:notify),
addon.short_name, @selected_addons.include?(addon)))
box.params << Left(CheckBox(Id(addon.product_ident),
Opt(:notify),
addon.short_name,
@selected_addons.include?(addon) || registered_addons.include?(addon.product_ident)))

# add extra spacing when there are just few addons, in GUI always
box.params << VSpacing(0.7) if add_extra_spacing
Expand Down Expand Up @@ -398,6 +404,9 @@ def handle_addon_selection_dialog(addons)
when :next
selected = addons.select{|a| UI.QueryWidget(Id(a.product_ident), :Value)}

# ignore already registered addons
selected.reject!{|a| registered_addons.include?(a.product_ident) }

if !supported_addon_count(selected)
ret = nil
next
Expand Down Expand Up @@ -442,6 +451,11 @@ def select_addons
GetInstArgs.enable_next || Mode.normal
)

# disable already registered addons in UI
registered_addons.each do |addon|
UI.ChangeWidget(Id(addon), :Enabled, false)
end

handle_addon_selection_dialog(addons)
end

Expand Down Expand Up @@ -581,6 +595,10 @@ def register_selected_addons

# select repositories to use in installation (e.g. enable/disable Updates)
select_repositories(product_service) if Mode.installation

# move from selected to registered
registered_addons << product.product_ident
@selected_addons.reject!{|selected| selected.product_ident == product.product_ident}
end
end

Expand Down Expand Up @@ -747,6 +765,11 @@ def init_registration
end
end

# helper method for accessing the registered addons
def registered_addons
::Registration::Storage::Cache.instance.registered_addons
end

end unless defined?(InstSccClient)
end

Expand Down
11 changes: 9 additions & 2 deletions src/lib/registration/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,19 @@ def initialize
end
end

class Cache < Struct.new(:available_addons, :reg_url, :reg_url_cached)
class Cache < Struct.new(:available_addons, :registered_addons,
:reg_url, :reg_url_cached)

include Singleton

def initialize
# TODO: handle registered addons in installed system
self.registered_addons = []
end
end

# remember the details about SSL verification failure
# the attributes are read from
# the attributes are read from the SSL error context
class SSLErrors < Struct.new(:ssl_error_code, :ssl_error_msg, :ssl_failed_cert)
include Singleton

Expand Down

0 comments on commit 3abe48f

Please sign in to comment.