Class: Morpheus::Cli::Logout
- Inherits:
-
Object
- Object
- Morpheus::Cli::Logout
show all
- Includes:
- CliCommand
- Defined in:
- lib/morpheus/cli/logout.rb
Instance Method Summary
collapse
Methods included from CliCommand
#build_common_options, included
Constructor Details
#initialize ⇒ Logout
include Morpheus::Cli::WhoamiHelper
include Morpheus::Cli::AccountsHelper
Instance Method Details
#connect(opts) ⇒ Object
19
20
21
22
|
# File 'lib/morpheus/cli/logout.rb', line 19
def connect(opts)
end
|
#handle(args) ⇒ Object
28
29
30
|
# File 'lib/morpheus/cli/logout.rb', line 28
def handle(args)
logout(args)
end
|
#logout(args) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/morpheus/cli/logout.rb', line 32
def logout(args)
options = {}
optparse = OptionParser.new do|opts|
opts.banner = usage
build_common_options(opts, options, []) end
optparse.parse(args)
connect(options)
begin
creds = Morpheus::Cli::Credentials.new(@appliance_name, @appliance_url).load_saved_credentials()
if !creds
print yellow,"\nYou are not logged in to #{@appliance_name} - #{@appliance_url}.\n\n",reset
else
Morpheus::Cli::Credentials.new(@appliance_name, @appliance_url).logout()
end
rescue RestClient::Exception => e
print_rest_exception(e, options)
exit 1
end
end
|
#usage ⇒ Object
24
25
26
|
# File 'lib/morpheus/cli/logout.rb', line 24
def usage
"Usage: morpheus login"
end
|