Skip to content

Commit

Permalink
Display the "Search Online" option for unregistered systems
Browse files Browse the repository at this point in the history
* It is available only in systems that can be registered.
  • Loading branch information
imobachgs committed Feb 5, 2020
1 parent 3ac9137 commit 0095c9b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/clients/sw_single.rb
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def GetPackagerOptions
end
end
repo_management = Mode.normal if repo_management.nil?
online_search = Mode.normal && registered?
online_search = Mode.normal && online_search_available?

ret = {
"mode" => mode, "enable_repo_mgr" => repo_management,
Expand Down Expand Up @@ -804,14 +804,14 @@ def StartSWSingle

private

# Determines whether the running system is registered or not
# Determines whether the online search can be used in the running system
#
# @return [Booolean] true if the system is registered; false otherwise
def registered?
require "registration/registration"
::Registration::Registration.is_registered?
rescue LoadError
false
# @note The online search feature is available in those systems that
# can be installed. For the time being, we rely on the online_search
# client being available (from `yast2-registration`).
# @return [Boolean]
def online_search_available?
Yast::WFM.ClientExists("online_search")
end
end
end
Expand Down

0 comments on commit 0095c9b

Please sign in to comment.