class DTK::Client::Operation::Account::AddSshKey
Public Class Methods
execute(args = Args.new)
click to toggle source
# File lib/client/operation/account/add_ssh_key.rb, line 21 def self.execute(args = Args.new) path_to_key = args[:directory_path] unless args[:directory_path].nil? path_to_key ||= SSHUtil.default_rsa_pub_key_path() opts = { :name => args[:name] } response, matched, matched_username = Account.add_key(path_to_key, opts) if matched OsUtil.print("Provided SSH pub key has already been added.", :yellow) elsif matched_username OsUtil.print("User ('#{matched_username}') already exists.", :yellow) else Configurator.add_current_user_to_direct_access() if response.ok? end if response.ok? && response.data(:repoman_registration_error) OsUtil.print("Warning: We were not able to register your key with remote catalog! #{response.data(:repoman_registration_error)}", :yellow) end response.ok? ? nil : response end