Sha256: 8b521adc65bd06deee1a8928b342b41cb73ad2f826edcaf78ebf9b544f17246d

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

Execute.define_task do
desc "get-token", "Fetches current api token from rhoconnect"
  def get_token
    invoke :config
    password = ''
    login = ask "admin login: "
    begin
      system "stty -echo"
      password = ask "\nadmin password: "
      system "stty echo"
    rescue NoMethodError, Interrupt
      system "stty echo"
      exit
    end
    puts ''
    begin
      $token = RhoconnectApi.get_token($url,login,password)
    rescue
      puts "Login failed."
      exit
    end
    File.open($token_file,'w') {|f| f.write $token}
    puts "Token is saved in: #{$token_file}"
  end #get_token
end #do

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rhoconnect-3.2.0.beta1 commands/commands/rhoconnect/get_token.rb