Skip to content

Commit

Permalink
use suse-connect gem instead of scc_api
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Apr 10, 2014
1 parent b38020a commit fda0e9c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
20 changes: 13 additions & 7 deletions src/lib/registration/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# ------------------------------------------------------------------------------
#

require "scc_api"
require "yast"
require "suse/connect"

require "registration/helpers"
require "registration/sw_mgmt"
Expand All @@ -30,7 +30,7 @@ module Registration
class Registration
include Yast::Logger

SCC_CREDENTIALS = SccApi::Credentials::DEFAULT_CREDENTIALS_DIR + "/SCCCredentials"
SCC_CREDENTIALS = SUSE::Connect::Credentials::GLOBAL_CREDENTIALS_FILE

attr_accessor :url

Expand All @@ -39,18 +39,24 @@ def initialize(url = nil)
end

def register(email, reg_code)
@scc = SccApi::Connection.new(email, reg_code)
settings = {
:token => reg_code,
:verbose => ENV["Y2DEBUG"] == "1"
# TODO FIXME: how to pass email?: "email" => email
}

# set the current language to receive translated error messages
@scc.language = ::Registration::Helpers.language
# TODO FIXME: @scc.language = ::Registration::Helpers.language

if @url
log.info "Using custom registration URL: #{@url.inspect}"
@scc.url = @url
settings[:url] = @url
end

# announce (register the system) first
@credentials = @scc.announce
login, password = SUSE::Connect::YaST.announce_system(settings)
@credentials = SUSE::Connect::Credentials.new(login, password, SCC_CREDENTIALS)

log.info "Global SCC credentials: #{@credentials}"

# ensure the zypp config directories are writable in inst-sys
::Registration::SwMgmt.zypp_config_writable!
Expand Down
6 changes: 3 additions & 3 deletions src/lib/yast/scc_api.rb → src/lib/yast/suse_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#
# ***************************************************************************
#
# Summary: SCC API initialization
# Summary: SUSE Connect API initialization
#

require "scc_api"
require "suse/connect"
require "yast/logger"

SccApi::GlobalLogger.instance.log = Yast::Y2Logger.instance
SUSE::Connect::GlobalLogger.instance.log = Yast::Y2Logger.instance

0 comments on commit fda0e9c

Please sign in to comment.