morpheus-cli 4.2.10 → 4.2.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 306e4f72ea1678c854091571261b455432291cb6b2d724ccfdca97f704c89329
4
- data.tar.gz: 43a8b4a1e73a40a65c9d8e732f7f370145c539db165b63a620385768d3ed3b0a
3
+ metadata.gz: c05a0d047f94e91857345c03ab934d64eef1b23620acf24b38057eba3d92cbcb
4
+ data.tar.gz: 17a33813d17587e8686ef3ad1cbec018ef1e18049be40184aa76573d60eba469
5
5
  SHA512:
6
- metadata.gz: d314342d0bb820cd1c787c7aa9f9738f1cd2febeae2942c2be8001d428857f266a4b2be0cab29c8020233e100c2caccc07bdd544f09a93c3e1514d016beff1cc
7
- data.tar.gz: c487245071a039afa9ae99e1ba7d50a1ebf241a4a6e67a91cc8af7ffdbf44db930ebe7242fd26af477939a0605a7808ab7c972d02da40c5424cbc122c8d9f1d1
6
+ metadata.gz: 8450675f6ce45f28e42b3919ac5e6c65f210fde6deb14671a78eef72b0b7d6f0d0d008a108fc0af56a45af3e4485788bd6d91697ab544e868974df73d9ea4c54
7
+ data.tar.gz: b0f5a5f626de331115ca8863b8e60305ec66ba34bfd6762697778f084bf7553618e37613e755c4ddc8cea425d8241faece71bbcf6a2a9483b94a7b1c0712c495
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  FROM ruby:2.5.1
2
2
 
3
- RUN gem install morpheus-cli -v 4.2.10
3
+ RUN gem install morpheus-cli -v 4.2.11
4
4
 
5
5
  ENTRYPOINT ["morpheus"]
@@ -83,7 +83,7 @@ EOT
83
83
  rescue RestClient::Exception => e
84
84
  # api_exception = e
85
85
  # fallback to older /api/setup/check, which is also public and looks just about the same
86
- if e.response.code == 404
86
+ if e.response && (e.response.code == 404 || e.response.code == 401)
87
87
  start_time = Time.now
88
88
  begin
89
89
  json_response = @setup_interface.check(params)
@@ -366,18 +366,11 @@ EOT
366
366
  end
367
367
 
368
368
  # setup fresh appliance?
369
- if appliance[:status] == 'fresh' # || appliance[:setup_needed] == true
370
- if !appliance[:active]
371
- if ::Morpheus::Cli::OptionTypes::confirm("Would you like to switch to using this remote now?", options.merge({default: true}))
372
- use([appliance[:name]])
373
- appliance[:active] = true # just in case, could reload instead with load_active_remote()
374
- end
375
- end
376
-
369
+ if appliance[:status] == 'fresh'
377
370
  print cyan
378
371
  puts "It looks like this appliance needs to be setup. Starting setup ..."
379
- return setup([new_appliance_name])
380
- # no need to login, setup() handles that
372
+ #return setup([new_appliance_name] + [Morpheus::Logging.debug? ? ["--debug"] : []])
373
+ return Morpheus::Cli::Setup.new.handle(["-r", new_appliance_name] + (Morpheus::Logging.debug? ? ["--debug"] : []))
381
374
  end
382
375
 
383
376
  # only login if you are using this remote
@@ -1211,7 +1204,7 @@ EOT
1211
1204
 
1212
1205
  # This moved to the SetupCommand
1213
1206
  def setup(args)
1214
- print_error yellow,"[DEPRECATED] The command `remote setup [name]` is deprecated. It has been replaced by `setup init`.",reset,"\n"
1207
+ print_error yellow,"[DEPRECATED] The command `remote setup` is deprecated. It has been replaced by `setup`.",reset,"\n"
1215
1208
  options = {}
1216
1209
  optparse = Morpheus::Cli::OptionParser.new do|opts|
1217
1210
  opts.banner = subcommand_usage()
@@ -1230,7 +1223,7 @@ and it may only be executed successfully one time.
1230
1223
  EOT
1231
1224
  end
1232
1225
  optparse.parse!(args)
1233
- verify_args!(args:args, max:1, optparse:optparse)
1226
+ verify_args!(args:args, optparse:optparse, max:1)
1234
1227
  # just invoke the setup command.
1235
1228
  # for this to work, the argument [remote] must be the first argument.
1236
1229
  cmd_args = []
@@ -1240,7 +1233,7 @@ EOT
1240
1233
  # cmd_args = cmd_args + ["-r",remote_name, args]
1241
1234
  cmd_args = args + ["-r",remote_name, args]
1242
1235
  end
1243
- return Morpheus::Cli::Setup.new.init(cmd_args)
1236
+ return Morpheus::Cli::Setup.new.handle(cmd_args)
1244
1237
  end
1245
1238
 
1246
1239
  def load_remote_by_name(appliance_name, allow_current=true)
@@ -60,15 +60,20 @@ EOT
60
60
  else
61
61
  payload.deep_merge!(parse_passed_options(options))
62
62
 
63
+ # JD: This should just do a Remote.check_appliance() first... needs to work with --remote-url though.
63
64
  # @setup_interface = Morpheus::SetupInterface.new({url:@appliance_url,access_token:@access_token})
64
65
  appliance_status_json = nil
65
66
  begin
66
67
  appliance_status_json = @setup_interface.get()
68
+ rescue RestClient::SSLCertificateNotVerified => e
69
+ @remote_appliance[:status] = 'ssl-error'
70
+ @remote_appliance[:last_check] ||= {}
71
+ @remote_appliance[:last_check][:error] = e.message
67
72
  rescue RestClient::Exception => e
68
73
  # pre 4.2.1 api would return HTTP 400 here, but with setupNeeded=false
69
74
  # so fallback to the old /api/setup/check
70
75
  # this could be in the interface itself..
71
- if e.response.code == 400
76
+ if e.response && (e.response.code == 400 || e.response.code == 404 || e.response.code == 401)
72
77
  Morpheus::Logging::DarkPrinter.puts "HTTP 400 from /api/setup, falling back to older /api/setup/check" if Morpheus::Logging.debug?
73
78
  begin
74
79
  appliance_status_json = @setup_interface.check()
@@ -81,20 +86,33 @@ EOT
81
86
  end
82
87
  end
83
88
  end
89
+ if appliance_status_json.nil?
90
+ @remote_appliance[:status] = 'http-error'
91
+ @remote_appliance[:last_check] ||= {}
92
+ @remote_appliance[:last_check][:error] = e.message
93
+ end
84
94
  end
85
95
 
86
96
  # my_terminal.execute("setup needed?")
87
97
  # theres a bug here with --remote-url :status == "unknown"
88
98
  # but hey, we got json back, so set status to "ready"
99
+ if appliance_status_json && appliance_status_json['setupNeeded'] == false
100
+ @remote_appliance[:status] == 'ready'
101
+ end
89
102
  remote_status_string = format_appliance_status(@remote_appliance, cyan)
90
103
  if appliance_status_json && appliance_status_json['setupNeeded'] == true
91
104
  # ok, setupNeeded
92
105
  # print_error cyan,"Setup is needed, status is #{remote_status_string}",reset,"\n"
93
106
  else
107
+ if @remote_appliance[:status] == 'ssl-error'
108
+ print_error cyan,"Setup unavailable, status is #{remote_status_string}","\n"
109
+ print_error "Try passing the --insecure option.",reset,"\n"
110
+ return 1, "setup unavailable"
111
+ end
94
112
  if options[:force] != true
95
113
  print_error cyan,"Setup unavailable, status is #{remote_status_string}",reset,"\n"
96
114
  #print_error red, "#{appliance_status_json['msg']}\n", reset
97
- return 1, "already setup"
115
+ return 1, "setup unavailable"
98
116
  end
99
117
  end
100
118
 
@@ -133,7 +151,7 @@ EOT
133
151
  puts "This is done to retrieve and install the license key for your appliance."
134
152
  puts "You have several options for how to proceed:"
135
153
  hub_action_dropdown.each_with_index do |hub_action, idx|
136
- puts "#{idx+1}. #{hub_action['name']} [#{hub_action['value']}]"
154
+ puts "* #{hub_action['name']} [#{hub_action['value']}]"
137
155
  end
138
156
  print "\n", reset
139
157
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "4.2.10"
4
+ VERSION = "4.2.11"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morpheus-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.10
4
+ version: 4.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Estes