Class: Morpheus::Cli::SslVerificationCommand
- Inherits:
-
Object
- Object
- Morpheus::Cli::SslVerificationCommand
- Includes:
- CliCommand
- Defined in:
- lib/morpheus/cli/ssl_verification_command.rb
Overview
This is for use in dotfile scripts
Instance Attribute Summary
Attributes included from CliCommand
Instance Method Summary collapse
Methods included from CliCommand
#build_common_options, #build_option_type_options, #command_name, #default_subcommand, #establish_remote_appliance_connection, #handle_subcommand, included, #interactive?, #noninteractive, #print_usage, #subcommand_aliases, #subcommand_usage, #subcommands, #verify_access_token!
Instance Method Details
#handle(args) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/morpheus/cli/ssl_verification_command.rb', line 20 def handle(args) = {} optparse = Morpheus::Cli::OptionParser.new do|opts| opts. = usage #build_common_options(opts, options, []) opts.on('-h', '--help', "Prints this help" ) do puts opts exit end end optparse.parse!(args) if args.count == 0 puts Morpheus::RestClient.ssl_verification_enabled? ? "on" : "off" return true end if args.count > 1 puts optparse return false end if ["on", "enabled", "true", "1"].include?(args[0].to_s.strip.downcase) Morpheus::RestClient.enable_ssl_verification = true elsif ["off", "disabled", "false", "0"].include?(args[0].to_s.strip.downcase) Morpheus::RestClient.enable_ssl_verification = false else puts optparse return false end return true end |
#usage ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/morpheus/cli/ssl_verification_command.rb', line 11 def usage <<-EOT Usage: morpheus #{command_name} [on|off] \tThis is intended for use in your morpheus scripts. \t"Enable [on] or Disable [off] SSL Verification for all your api requests." \tThe default is on. EOT end |