morpheus-cli 3.3.2.6 → 3.3.2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.gitignore +1 -0
 - data/lib/morpheus/api/api_client.rb +4 -0
 - data/lib/morpheus/api/library_packages_interface.rb +50 -0
 - data/lib/morpheus/cli.rb +1 -0
 - data/lib/morpheus/cli/library_packages_command.rb +203 -0
 - data/lib/morpheus/cli/version.rb +1 -1
 - metadata +4 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a1b8cab856aa48299dcdee9d248286e84e82d98d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: dcbedabff74562525087fe4412607288915bab98
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 69bbcebda49f660d9560374d18b12824035e519927a259293e72edb38442a1a9d00e4ea7c90a0af7e47d161d302aa490bfa960d6dd55b09fa4583aa46a543667
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a40841aa668a7721989aefa9f9b9d49bb0b033d4eef4acff9a7363e143a5bd1df5e805eb3456c4effac78930c286880da8b22aea5ef509bec1716232fc577605
         
     | 
    
        data/.gitignore
    CHANGED
    
    
| 
         @@ -283,4 +283,8 @@ class Morpheus::APIClient 
     | 
|
| 
       283 
283 
     | 
    
         
             
                Morpheus::LibraryContainerTemplatesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
         
     | 
| 
       284 
284 
     | 
    
         
             
              end
         
     | 
| 
       285 
285 
     | 
    
         | 
| 
      
 286 
     | 
    
         
            +
              def library_packages
         
     | 
| 
      
 287 
     | 
    
         
            +
                Morpheus::LibraryPackagesInterface.new(@access_token, @refresh_token, @expires_at, @base_url)
         
     | 
| 
      
 288 
     | 
    
         
            +
              end
         
     | 
| 
      
 289 
     | 
    
         
            +
             
     | 
| 
       286 
290 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,50 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'morpheus/api/api_client'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class Morpheus::LibraryPackagesInterface < Morpheus::APIClient
         
     | 
| 
      
 4 
     | 
    
         
            +
              def initialize(access_token, refresh_token,expires_at = nil, base_url=nil) 
         
     | 
| 
      
 5 
     | 
    
         
            +
                @access_token = access_token
         
     | 
| 
      
 6 
     | 
    
         
            +
                @refresh_token = refresh_token
         
     | 
| 
      
 7 
     | 
    
         
            +
                @base_url = base_url
         
     | 
| 
      
 8 
     | 
    
         
            +
                @expires_at = expires_at
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              def download(params, outfile)
         
     | 
| 
      
 12 
     | 
    
         
            +
                url = "#{@base_url}/api/library/packages/download"
         
     | 
| 
      
 13 
     | 
    
         
            +
                headers = { params: params, authorization: "Bearer #{@access_token}" }
         
     | 
| 
      
 14 
     | 
    
         
            +
                opts = {method: :get, url: url, headers: headers}
         
     | 
| 
      
 15 
     | 
    
         
            +
                # execute(opts, false)
         
     | 
| 
      
 16 
     | 
    
         
            +
                if Dir.exists?(outfile)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  raise "outfile is invalid. It is the name of an existing directory: #{outfile}"
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
                # if @verify_ssl == false
         
     | 
| 
      
 20 
     | 
    
         
            +
                #   opts[:verify_ssl] = OpenSSL::SSL::VERIFY_NONE
         
     | 
| 
      
 21 
     | 
    
         
            +
                # end
         
     | 
| 
      
 22 
     | 
    
         
            +
                if @dry_run
         
     | 
| 
      
 23 
     | 
    
         
            +
                  return opts
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
                http_response = nil
         
     | 
| 
      
 26 
     | 
    
         
            +
                bad_body = nil
         
     | 
| 
      
 27 
     | 
    
         
            +
                File.open(outfile, 'w') {|f|
         
     | 
| 
      
 28 
     | 
    
         
            +
                  block = proc { |response|
         
     | 
| 
      
 29 
     | 
    
         
            +
                    if response.code.to_i == 200
         
     | 
| 
      
 30 
     | 
    
         
            +
                      response.read_body do |chunk|
         
     | 
| 
      
 31 
     | 
    
         
            +
                          #puts "writing to #{outfile} ..."
         
     | 
| 
      
 32 
     | 
    
         
            +
                          f.write chunk
         
     | 
| 
      
 33 
     | 
    
         
            +
                      end
         
     | 
| 
      
 34 
     | 
    
         
            +
                    else
         
     | 
| 
      
 35 
     | 
    
         
            +
                      # puts_error (#{response.inspect}) #{chunk} ..."
         
     | 
| 
      
 36 
     | 
    
         
            +
                      bad_body = response.body.to_s
         
     | 
| 
      
 37 
     | 
    
         
            +
                    end
         
     | 
| 
      
 38 
     | 
    
         
            +
                  }
         
     | 
| 
      
 39 
     | 
    
         
            +
                  opts[:block_response] = block
         
     | 
| 
      
 40 
     | 
    
         
            +
                  http_response = RestClient::Request.new(opts).execute
         
     | 
| 
      
 41 
     | 
    
         
            +
                  # RestClient::Request.execute(opts)
         
     | 
| 
      
 42 
     | 
    
         
            +
                }
         
     | 
| 
      
 43 
     | 
    
         
            +
                return http_response, bad_body
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
              def upload(file, params={})
         
     | 
| 
      
 47 
     | 
    
         
            +
                raise "implement this"
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/morpheus/cli.rb
    CHANGED
    
    | 
         @@ -115,6 +115,7 @@ module Morpheus 
     | 
|
| 
       115 
115 
     | 
    
         
             
                  load 'morpheus/cli/library_container_templates_command.rb'
         
     | 
| 
       116 
116 
     | 
    
         
             
                  load 'morpheus/cli/library_option_types_command.rb'
         
     | 
| 
       117 
117 
     | 
    
         
             
                  load 'morpheus/cli/library_option_lists_command.rb'
         
     | 
| 
      
 118 
     | 
    
         
            +
                  load 'morpheus/cli/library_packages_command.rb'
         
     | 
| 
       118 
119 
     | 
    
         | 
| 
       119 
120 
     | 
    
         
             
                  load 'morpheus/cli/version_command.rb'
         
     | 
| 
       120 
121 
     | 
    
         
             
                  load 'morpheus/cli/alias_command.rb'
         
     | 
| 
         @@ -0,0 +1,203 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'fileutils'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'morpheus/cli/cli_command'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'morpheus/cli/mixins/library_helper'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class Morpheus::Cli::LibraryPackagesCommand
         
     | 
| 
      
 6 
     | 
    
         
            +
              include Morpheus::Cli::CliCommand
         
     | 
| 
      
 7 
     | 
    
         
            +
              include Morpheus::Cli::LibraryHelper
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              set_command_name :'library-packages'
         
     | 
| 
      
 10 
     | 
    
         
            +
              register_subcommands :download
         
     | 
| 
      
 11 
     | 
    
         
            +
              # register_subcommands :upload
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              # hide until this is released
         
     | 
| 
      
 14 
     | 
    
         
            +
              set_command_hidden
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              def initialize()
         
     | 
| 
      
 17 
     | 
    
         
            +
                # @appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              def connect(opts)
         
     | 
| 
      
 21 
     | 
    
         
            +
                @api_client = establish_remote_appliance_connection(opts)
         
     | 
| 
      
 22 
     | 
    
         
            +
                @library_packages_interface = @api_client.library_packages
         
     | 
| 
      
 23 
     | 
    
         
            +
                @library_instance_types_interface = @api_client.library_instance_types
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              def handle(args)
         
     | 
| 
      
 27 
     | 
    
         
            +
                handle_subcommand(args)
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              # generate a new .morpkg file
         
     | 
| 
      
 31 
     | 
    
         
            +
              def download(args)
         
     | 
| 
      
 32 
     | 
    
         
            +
                full_command_string = "#{command_name} download #{args.join(' ')}".strip
         
     | 
| 
      
 33 
     | 
    
         
            +
                options = {}
         
     | 
| 
      
 34 
     | 
    
         
            +
                params = {}
         
     | 
| 
      
 35 
     | 
    
         
            +
                instance_type_codes = nil
         
     | 
| 
      
 36 
     | 
    
         
            +
                outfile = nil
         
     | 
| 
      
 37 
     | 
    
         
            +
                do_overwrite = false
         
     | 
| 
      
 38 
     | 
    
         
            +
                do_mkdir = false
         
     | 
| 
      
 39 
     | 
    
         
            +
                unzip_and_open = false
         
     | 
| 
      
 40 
     | 
    
         
            +
                open_prog = nil
         
     | 
| 
      
 41 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
      
 42 
     | 
    
         
            +
                  opts.banner = subcommand_usage("[instance-type]")
         
     | 
| 
      
 43 
     | 
    
         
            +
                  opts.on('--file FILE', String, "Destination filepath for the downloaded .morpkg file.") do |val|
         
     | 
| 
      
 44 
     | 
    
         
            +
                    outfile = val
         
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
                  opts.on('--instance-types LIST', String, "Can be used to export multiple instance types in a single package.") do |val|
         
     | 
| 
      
 47 
     | 
    
         
            +
                    instance_type_codes = []
         
     | 
| 
      
 48 
     | 
    
         
            +
                    val.split(',').collect do |it|
         
     | 
| 
      
 49 
     | 
    
         
            +
                      if !it.strip.empty?
         
     | 
| 
      
 50 
     | 
    
         
            +
                        instance_type_codes << it.strip
         
     | 
| 
      
 51 
     | 
    
         
            +
                      end
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
                  opts.on('--all', String, "Export entire library instead of specific instance type(s).") do
         
     | 
| 
      
 55 
     | 
    
         
            +
                    params['all'] = true
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end
         
     | 
| 
      
 57 
     | 
    
         
            +
                  opts.on('--all-system', String, "Export all system instance types instead of specific instance type(s).") do
         
     | 
| 
      
 58 
     | 
    
         
            +
                    params['all'] = true
         
     | 
| 
      
 59 
     | 
    
         
            +
                    params['systemOnly'] = true
         
     | 
| 
      
 60 
     | 
    
         
            +
                  end
         
     | 
| 
      
 61 
     | 
    
         
            +
                  opts.on('--all-custom', String, "Export all custom instance types instead of specific instance type(s).") do
         
     | 
| 
      
 62 
     | 
    
         
            +
                    params['all'] = true
         
     | 
| 
      
 63 
     | 
    
         
            +
                    params['customOnly'] = true
         
     | 
| 
      
 64 
     | 
    
         
            +
                  end
         
     | 
| 
      
 65 
     | 
    
         
            +
                  opts.on( '-p', '--mkdir', "Create missing directories for [filename] if they do not exist." ) do
         
     | 
| 
      
 66 
     | 
    
         
            +
                    do_mkdir = true
         
     | 
| 
      
 67 
     | 
    
         
            +
                  end
         
     | 
| 
      
 68 
     | 
    
         
            +
                  opts.on( '-f', '--force', "Overwrite existing [filename] if it exists. Also creates missing directories." ) do
         
     | 
| 
      
 69 
     | 
    
         
            +
                    do_overwrite = true
         
     | 
| 
      
 70 
     | 
    
         
            +
                    do_mkdir = true
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
      
 72 
     | 
    
         
            +
                  opts.on( '--open PROG', String, "Unzip the package and open the expanded directory with the specified program." ) do |val|
         
     | 
| 
      
 73 
     | 
    
         
            +
                    unzip_and_open = true
         
     | 
| 
      
 74 
     | 
    
         
            +
                    open_prog = val.to_s
         
     | 
| 
      
 75 
     | 
    
         
            +
                  end
         
     | 
| 
      
 76 
     | 
    
         
            +
                  build_common_options(opts, options, [:dry_run, :quiet])
         
     | 
| 
      
 77 
     | 
    
         
            +
                  opts.footer = "Download one or many instance types as a morpheus library package (.morpkg) file.\n" + 
         
     | 
| 
      
 78 
     | 
    
         
            +
                                "[instance-type] is required. This is the instance type code." +
         
     | 
| 
      
 79 
     | 
    
         
            +
                                "--instance-types can bv. This is a list of instance type codes."
         
     | 
| 
      
 80 
     | 
    
         
            +
                end
         
     | 
| 
      
 81 
     | 
    
         
            +
                optparse.parse!(args)
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                if args.count != 1 && !instance_type_codes && !params['all']
         
     | 
| 
      
 84 
     | 
    
         
            +
                  print_error Morpheus::Terminal.angry_prompt
         
     | 
| 
      
 85 
     | 
    
         
            +
                  puts_error  "#{command_name} download expects 1 argument and received #{args.count}: #{args.join(' ')}\n#{optparse}"
         
     | 
| 
      
 86 
     | 
    
         
            +
                  return 1
         
     | 
| 
      
 87 
     | 
    
         
            +
                end
         
     | 
| 
      
 88 
     | 
    
         
            +
                connect(options)
         
     | 
| 
      
 89 
     | 
    
         
            +
                begin
         
     | 
| 
      
 90 
     | 
    
         
            +
                  # construct payload
         
     | 
| 
      
 91 
     | 
    
         
            +
                  if !params['all']
         
     | 
| 
      
 92 
     | 
    
         
            +
                    if args[0] && !instance_type_codes
         
     | 
| 
      
 93 
     | 
    
         
            +
                      instance_type_codes = [args[0]]
         
     | 
| 
      
 94 
     | 
    
         
            +
                    end
         
     | 
| 
      
 95 
     | 
    
         
            +
                    params['instanceType'] = instance_type_codes
         
     | 
| 
      
 96 
     | 
    
         
            +
                  end
         
     | 
| 
      
 97 
     | 
    
         
            +
                  # determine outfile
         
     | 
| 
      
 98 
     | 
    
         
            +
                  if !outfile
         
     | 
| 
      
 99 
     | 
    
         
            +
                    # use a default location
         
     | 
| 
      
 100 
     | 
    
         
            +
                    do_mkdir = true
         
     | 
| 
      
 101 
     | 
    
         
            +
                    if instance_type_codes && instance_type_codes.size == 1
         
     | 
| 
      
 102 
     | 
    
         
            +
                      outfile = File.join(Morpheus::Cli.home_directory, "tmp", "morpheus-packages", "#{instance_type_codes[0]}.morpkg")
         
     | 
| 
      
 103 
     | 
    
         
            +
                    else
         
     | 
| 
      
 104 
     | 
    
         
            +
                      outfile = File.join(Morpheus::Cli.home_directory, "tmp", "morpheus-packages", "download.morpkg")
         
     | 
| 
      
 105 
     | 
    
         
            +
                    end
         
     | 
| 
      
 106 
     | 
    
         
            +
                  end
         
     | 
| 
      
 107 
     | 
    
         
            +
                  outfile = File.expand_path(outfile)
         
     | 
| 
      
 108 
     | 
    
         
            +
                  if Dir.exists?(outfile)
         
     | 
| 
      
 109 
     | 
    
         
            +
                    puts_error "#{Morpheus::Terminal.angry_prompt}--file is invalid. It is the name of an existing directory: #{outfile}"
         
     | 
| 
      
 110 
     | 
    
         
            +
                    return 1
         
     | 
| 
      
 111 
     | 
    
         
            +
                  end
         
     | 
| 
      
 112 
     | 
    
         
            +
                  # always a .morpkg
         
     | 
| 
      
 113 
     | 
    
         
            +
                  if outfile[-7..-1] != ".morpkg"
         
     | 
| 
      
 114 
     | 
    
         
            +
                    outfile << ".morpkg"
         
     | 
| 
      
 115 
     | 
    
         
            +
                  end
         
     | 
| 
      
 116 
     | 
    
         
            +
                  destination_dir = File.dirname(outfile)
         
     | 
| 
      
 117 
     | 
    
         
            +
                  if !Dir.exists?(destination_dir)
         
     | 
| 
      
 118 
     | 
    
         
            +
                    if do_mkdir
         
     | 
| 
      
 119 
     | 
    
         
            +
                      print cyan,"Creating local directory #{destination_dir}",reset,"\n"
         
     | 
| 
      
 120 
     | 
    
         
            +
                      FileUtils.mkdir_p(destination_dir)
         
     | 
| 
      
 121 
     | 
    
         
            +
                    else
         
     | 
| 
      
 122 
     | 
    
         
            +
                      puts_error "#{Morpheus::Terminal.angry_prompt}[filename] is invalid. Directory not found: #{destination_dir}  Use -p to create the missing directory."
         
     | 
| 
      
 123 
     | 
    
         
            +
                      return 1
         
     | 
| 
      
 124 
     | 
    
         
            +
                    end
         
     | 
| 
      
 125 
     | 
    
         
            +
                  end
         
     | 
| 
      
 126 
     | 
    
         
            +
                  if File.exists?(outfile)
         
     | 
| 
      
 127 
     | 
    
         
            +
                    if do_overwrite
         
     | 
| 
      
 128 
     | 
    
         
            +
                      # uhh need to be careful wih the passed filepath here..
         
     | 
| 
      
 129 
     | 
    
         
            +
                      # don't delete, just overwrite.
         
     | 
| 
      
 130 
     | 
    
         
            +
                      # File.delete(outfile)
         
     | 
| 
      
 131 
     | 
    
         
            +
                    else
         
     | 
| 
      
 132 
     | 
    
         
            +
                      print_error Morpheus::Terminal.angry_prompt
         
     | 
| 
      
 133 
     | 
    
         
            +
                      puts_error "[filename] is invalid. File already exists: #{outfile}", "Use -f to overwrite the existing file."
         
     | 
| 
      
 134 
     | 
    
         
            +
                      # puts_error optparse
         
     | 
| 
      
 135 
     | 
    
         
            +
                      return 1
         
     | 
| 
      
 136 
     | 
    
         
            +
                    end
         
     | 
| 
      
 137 
     | 
    
         
            +
                  end
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                  if options[:dry_run]
         
     | 
| 
      
 140 
     | 
    
         
            +
                    print_dry_run @library_packages_interface.dry.download(params, outfile), full_command_string
         
     | 
| 
      
 141 
     | 
    
         
            +
                    return 1
         
     | 
| 
      
 142 
     | 
    
         
            +
                  end
         
     | 
| 
      
 143 
     | 
    
         
            +
                  if !options[:quiet]
         
     | 
| 
      
 144 
     | 
    
         
            +
                    print cyan + "Downloading morpheus package file #{outfile} ... "
         
     | 
| 
      
 145 
     | 
    
         
            +
                  end
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                  http_response, bad_body = @library_packages_interface.download(params, outfile)
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
                  # FileUtils.chmod(0600, outfile)
         
     | 
| 
      
 150 
     | 
    
         
            +
                  success = http_response.code.to_i == 200
         
     | 
| 
      
 151 
     | 
    
         
            +
                  if success
         
     | 
| 
      
 152 
     | 
    
         
            +
                    if !options[:quiet]
         
     | 
| 
      
 153 
     | 
    
         
            +
                      print green + "SUCCESS" + reset + "\n"
         
     | 
| 
      
 154 
     | 
    
         
            +
                    end
         
     | 
| 
      
 155 
     | 
    
         
            +
             
     | 
| 
      
 156 
     | 
    
         
            +
                    if unzip_and_open
         
     | 
| 
      
 157 
     | 
    
         
            +
                      package_dir = File.join(File.dirname(outfile), File.basename(outfile).sub(/\.morpkg\Z/, ''))
         
     | 
| 
      
 158 
     | 
    
         
            +
                      if File.exists?(package_dir)
         
     | 
| 
      
 159 
     | 
    
         
            +
                        print cyan,"Deleting existing directory #{package_dir}",reset,"\n"
         
     | 
| 
      
 160 
     | 
    
         
            +
                        FileUtils.rm_rf(package_dir)
         
     | 
| 
      
 161 
     | 
    
         
            +
                      end
         
     | 
| 
      
 162 
     | 
    
         
            +
                      print cyan,"Unzipping to #{package_dir}",reset,"\n"
         
     | 
| 
      
 163 
     | 
    
         
            +
                      system("unzip '#{outfile}' -d '#{package_dir}' > /dev/null 2>&1")
         
     | 
| 
      
 164 
     | 
    
         
            +
                      system("#{open_prog} '#{package_dir}'")
         
     | 
| 
      
 165 
     | 
    
         
            +
                    end
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
                    return 0
         
     | 
| 
      
 168 
     | 
    
         
            +
                  else
         
     | 
| 
      
 169 
     | 
    
         
            +
                    if !options[:quiet]
         
     | 
| 
      
 170 
     | 
    
         
            +
                      print red + "ERROR" + reset + " HTTP #{http_response.code}" + "\n"
         
     | 
| 
      
 171 
     | 
    
         
            +
                      if bad_body
         
     | 
| 
      
 172 
     | 
    
         
            +
                        puts red + bad_body
         
     | 
| 
      
 173 
     | 
    
         
            +
                      end
         
     | 
| 
      
 174 
     | 
    
         
            +
                      #response_body = (http_response.body.kind_of?(Net::ReadAdapter) ? "" : http_response.body)
         
     | 
| 
      
 175 
     | 
    
         
            +
                    end
         
     | 
| 
      
 176 
     | 
    
         
            +
                    # F it, just remove a bad result
         
     | 
| 
      
 177 
     | 
    
         
            +
                    if File.exists?(outfile) && File.file?(outfile)
         
     | 
| 
      
 178 
     | 
    
         
            +
                      Morpheus::Logging::DarkPrinter.puts "Deleting bad file download: #{outfile}" if Morpheus::Logging.debug?
         
     | 
| 
      
 179 
     | 
    
         
            +
                      File.delete(outfile)
         
     | 
| 
      
 180 
     | 
    
         
            +
                    end
         
     | 
| 
      
 181 
     | 
    
         
            +
                    if options[:debug]
         
     | 
| 
      
 182 
     | 
    
         
            +
                      puts_error http_response.inspect
         
     | 
| 
      
 183 
     | 
    
         
            +
                    end
         
     | 
| 
      
 184 
     | 
    
         
            +
                    return 1
         
     | 
| 
      
 185 
     | 
    
         
            +
                  end
         
     | 
| 
      
 186 
     | 
    
         
            +
                  
         
     | 
| 
      
 187 
     | 
    
         
            +
                rescue RestClient::Exception => e
         
     | 
| 
      
 188 
     | 
    
         
            +
                  print_rest_exception(e, options)
         
     | 
| 
      
 189 
     | 
    
         
            +
                  return 1
         
     | 
| 
      
 190 
     | 
    
         
            +
                end
         
     | 
| 
      
 191 
     | 
    
         
            +
              end
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
             
     | 
| 
      
 194 
     | 
    
         
            +
              def upload
         
     | 
| 
      
 195 
     | 
    
         
            +
                raise "not yet implemented"
         
     | 
| 
      
 196 
     | 
    
         
            +
              end
         
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
      
 199 
     | 
    
         
            +
              private
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
              
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/morpheus/cli/version.rb
    CHANGED
    
    
    
        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: 3.3.2.6
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.3.2.6.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - David Estes
         
     | 
| 
         @@ -11,7 +11,7 @@ authors: 
     | 
|
| 
       11 
11 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       13 
13 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       14 
     | 
    
         
            -
            date: 2018-05 
     | 
| 
      
 14 
     | 
    
         
            +
            date: 2018-06-05 00:00:00.000000000 Z
         
     | 
| 
       15 
15 
     | 
    
         
             
            dependencies:
         
     | 
| 
       16 
16 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       17 
17 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -171,6 +171,7 @@ files: 
     | 
|
| 
       171 
171 
     | 
    
         
             
            - lib/morpheus/api/library_container_upgrades_interface.rb
         
     | 
| 
       172 
172 
     | 
    
         
             
            - lib/morpheus/api/library_instance_types_interface.rb
         
     | 
| 
       173 
173 
     | 
    
         
             
            - lib/morpheus/api/library_layouts_interface.rb
         
     | 
| 
      
 174 
     | 
    
         
            +
            - lib/morpheus/api/library_packages_interface.rb
         
     | 
| 
       174 
175 
     | 
    
         
             
            - lib/morpheus/api/license_interface.rb
         
     | 
| 
       175 
176 
     | 
    
         
             
            - lib/morpheus/api/load_balancers_interface.rb
         
     | 
| 
       176 
177 
     | 
    
         
             
            - lib/morpheus/api/logs_interface.rb
         
     | 
| 
         @@ -245,6 +246,7 @@ files: 
     | 
|
| 
       245 
246 
     | 
    
         
             
            - lib/morpheus/cli/library_layouts_command.rb
         
     | 
| 
       246 
247 
     | 
    
         
             
            - lib/morpheus/cli/library_option_lists_command.rb
         
     | 
| 
       247 
248 
     | 
    
         
             
            - lib/morpheus/cli/library_option_types_command.rb
         
     | 
| 
      
 249 
     | 
    
         
            +
            - lib/morpheus/cli/library_packages_command.rb
         
     | 
| 
       248 
250 
     | 
    
         
             
            - lib/morpheus/cli/library_upgrades_command.rb
         
     | 
| 
       249 
251 
     | 
    
         
             
            - lib/morpheus/cli/license.rb
         
     | 
| 
       250 
252 
     | 
    
         
             
            - lib/morpheus/cli/load_balancers.rb
         
     |