morpheus-cli 3.5.1.3 → 3.5.2
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/lib/morpheus/api/instances_interface.rb +7 -0
 - data/lib/morpheus/api/storage_providers_interface.rb +11 -11
 - data/lib/morpheus/cli/accounts.rb +4 -4
 - data/lib/morpheus/cli/apps.rb +67 -16
 - data/lib/morpheus/cli/boot_scripts_command.rb +5 -5
 - data/lib/morpheus/cli/clouds.rb +8 -8
 - data/lib/morpheus/cli/containers_command.rb +29 -6
 - data/lib/morpheus/cli/dashboard_command.rb +1 -1
 - data/lib/morpheus/cli/deployments.rb +5 -5
 - data/lib/morpheus/cli/hosts.rb +46 -23
 - data/lib/morpheus/cli/image_builder_command.rb +6 -6
 - data/lib/morpheus/cli/instances.rb +243 -82
 - data/lib/morpheus/cli/key_pairs.rb +6 -6
 - data/lib/morpheus/cli/load_balancers.rb +6 -6
 - data/lib/morpheus/cli/login.rb +8 -5
 - data/lib/morpheus/cli/logout.rb +1 -1
 - data/lib/morpheus/cli/monitoring_contacts_command.rb +6 -6
 - data/lib/morpheus/cli/monitoring_incidents_command.rb +8 -8
 - data/lib/morpheus/cli/preseed_scripts_command.rb +5 -5
 - data/lib/morpheus/cli/recent_activity_command.rb +1 -1
 - data/lib/morpheus/cli/remote.rb +1 -1
 - data/lib/morpheus/cli/security_group_rules.rb +4 -4
 - data/lib/morpheus/cli/security_groups.rb +5 -5
 - data/lib/morpheus/cli/shell.rb +1 -1
 - data/lib/morpheus/cli/storage_providers_command.rb +78 -78
 - data/lib/morpheus/cli/tasks.rb +5 -5
 - data/lib/morpheus/cli/version.rb +1 -1
 - data/lib/morpheus/cli/version_command.rb +1 -1
 - data/lib/morpheus/cli/whoami.rb +1 -1
 - data/lib/morpheus/cli/workflows.rb +4 -4
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e69dc73a61a5113eda7600546cc3930dfdd4f47a9a882cd0aa27bb9af12a5f97
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9d47bacf74b477ab1d887f110b055b5cf9d89e0f65fff187b0bf2471a92b8616
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 2187ecea61941471a82f73f0f2a86d555ec739d22bfe4bc30b7aa620fca16aa9b6a3372c9cc0adf21868d4283c83b5bd545cb8fc4cc1a253d1e37accb58e01af
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b39bc39b4b012dabad7c821b55690c1976d92a671abcb660fd57140506c499042b3cf77d80394d0c6e07669e59b3113856f256a5187ac7461929c8fbb4583d19
         
     | 
| 
         @@ -255,4 +255,11 @@ class Morpheus::InstancesInterface < Morpheus::APIClient 
     | 
|
| 
       255 
255 
     | 
    
         
             
                execute(opts)
         
     | 
| 
       256 
256 
     | 
    
         
             
              end
         
     | 
| 
       257 
257 
     | 
    
         | 
| 
      
 258 
     | 
    
         
            +
              def update_notes(id, payload)
         
     | 
| 
      
 259 
     | 
    
         
            +
                url = "#{@base_url}/api/instances/#{id}/notes"
         
     | 
| 
      
 260 
     | 
    
         
            +
                headers = {authorization: "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
         
     | 
| 
      
 261 
     | 
    
         
            +
                opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
         
     | 
| 
      
 262 
     | 
    
         
            +
                execute(opts)
         
     | 
| 
      
 263 
     | 
    
         
            +
              end
         
     | 
| 
      
 264 
     | 
    
         
            +
             
     | 
| 
       258 
265 
     | 
    
         
             
            end
         
     | 
| 
         @@ -11,35 +11,35 @@ class Morpheus::StorageProvidersInterface < Morpheus::APIClient 
     | 
|
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
              def get(id, params={})
         
     | 
| 
       13 
13 
     | 
    
         
             
                raise "#{self.class}.get() passed a blank id!" if id.to_s == ''
         
     | 
| 
       14 
     | 
    
         
            -
                url = "#{@base_url}/api/storage/ 
     | 
| 
      
 14 
     | 
    
         
            +
                url = "#{@base_url}/api/storage/buckets/#{id}"
         
     | 
| 
       15 
15 
     | 
    
         
             
                headers = { params: params, authorization: "Bearer #{@access_token}" }
         
     | 
| 
       16 
16 
     | 
    
         
             
                opts = {method: :get, url: url, headers: headers}
         
     | 
| 
       17 
17 
     | 
    
         
             
                execute(opts)
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
              def list(params={})
         
     | 
| 
       21 
     | 
    
         
            -
                url = "#{@base_url}/api/storage/ 
     | 
| 
      
 21 
     | 
    
         
            +
                url = "#{@base_url}/api/storage/buckets"
         
     | 
| 
       22 
22 
     | 
    
         
             
                headers = { params: params, authorization: "Bearer #{@access_token}" }
         
     | 
| 
       23 
23 
     | 
    
         
             
                opts = {method: :get, url: url, headers: headers}
         
     | 
| 
       24 
24 
     | 
    
         
             
                execute(opts)
         
     | 
| 
       25 
25 
     | 
    
         
             
              end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
              def create(payload)
         
     | 
| 
       28 
     | 
    
         
            -
                url = "#{@base_url}/api/storage/ 
     | 
| 
      
 28 
     | 
    
         
            +
                url = "#{@base_url}/api/storage/buckets"
         
     | 
| 
       29 
29 
     | 
    
         
             
                headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
         
     | 
| 
       30 
30 
     | 
    
         
             
                opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
         
     | 
| 
       31 
31 
     | 
    
         
             
                execute(opts)
         
     | 
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
              def update(id, payload)
         
     | 
| 
       35 
     | 
    
         
            -
                url = "#{@base_url}/api/storage/ 
     | 
| 
      
 35 
     | 
    
         
            +
                url = "#{@base_url}/api/storage/buckets/#{id}"
         
     | 
| 
       36 
36 
     | 
    
         
             
                headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
         
     | 
| 
       37 
37 
     | 
    
         
             
                opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
         
     | 
| 
       38 
38 
     | 
    
         
             
                execute(opts)
         
     | 
| 
       39 
39 
     | 
    
         
             
              end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
              def destroy(id, params={})
         
     | 
| 
       42 
     | 
    
         
            -
                url = "#{@base_url}/api/storage/ 
     | 
| 
      
 42 
     | 
    
         
            +
                url = "#{@base_url}/api/storage/buckets/#{id}"
         
     | 
| 
       43 
43 
     | 
    
         
             
                headers = { :params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
         
     | 
| 
       44 
44 
     | 
    
         
             
                opts = {method: :delete, url: url, timeout: 30, headers: headers}
         
     | 
| 
       45 
45 
     | 
    
         
             
                execute(opts)
         
     | 
| 
         @@ -49,7 +49,7 @@ class Morpheus::StorageProvidersInterface < Morpheus::APIClient 
     | 
|
| 
       49 
49 
     | 
    
         
             
                if file_path.to_s.strip == "/"
         
     | 
| 
       50 
50 
     | 
    
         
             
                  file_path = ""
         
     | 
| 
       51 
51 
     | 
    
         
             
                end
         
     | 
| 
       52 
     | 
    
         
            -
                url = "#{@base_url}/api/storage/ 
     | 
| 
      
 52 
     | 
    
         
            +
                url = "#{@base_url}/api/storage/buckets/#{URI.escape(id.to_s)}" + "/files/#{URI.escape(file_path)}".squeeze('/')
         
     | 
| 
       53 
53 
     | 
    
         
             
                headers = { params: params, authorization: "Bearer #{@access_token}" }
         
     | 
| 
       54 
54 
     | 
    
         
             
                opts = {method: :get, url: url, headers: headers}
         
     | 
| 
       55 
55 
     | 
    
         
             
                execute(opts)
         
     | 
| 
         @@ -74,7 +74,7 @@ class Morpheus::StorageProvidersInterface < Morpheus::APIClient 
     | 
|
| 
       74 
74 
     | 
    
         
             
                # if filename == "" || filename == "/"
         
     | 
| 
       75 
75 
     | 
    
         
             
                #   filename = File.basename(local_file)
         
     | 
| 
       76 
76 
     | 
    
         
             
                # end
         
     | 
| 
       77 
     | 
    
         
            -
                url = "#{@base_url}/api/storage/ 
     | 
| 
      
 77 
     | 
    
         
            +
                url = "#{@base_url}/api/storage/buckets/#{URI.escape(id.to_s)}" + "/files/#{safe_dirname}".squeeze('/')
         
     | 
| 
       78 
78 
     | 
    
         
             
                headers = { :params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/octet-stream'}
         
     | 
| 
       79 
79 
     | 
    
         
             
                headers[:params][:filename] = filename # File.basename(destination)
         
     | 
| 
       80 
80 
     | 
    
         
             
                if !local_file.kind_of?(File)
         
     | 
| 
         @@ -89,7 +89,7 @@ class Morpheus::StorageProvidersInterface < Morpheus::APIClient 
     | 
|
| 
       89 
89 
     | 
    
         
             
                raise "#{self.class}.download_file() passed a blank id!" if id.to_s == ''
         
     | 
| 
       90 
90 
     | 
    
         
             
                raise "#{self.class}.download_file() passed a blank file path!" if file_path.to_s == ''
         
     | 
| 
       91 
91 
     | 
    
         
             
                escaped_file_path = file_path.split("/").collect {|it| URI.escape(it) }.join("/")
         
     | 
| 
       92 
     | 
    
         
            -
                url = "#{@base_url}/api/storage/ 
     | 
| 
      
 92 
     | 
    
         
            +
                url = "#{@base_url}/api/storage/buckets/#{URI.escape(id.to_s)}" + "/download-file/#{escaped_file_path}".squeeze('/')
         
     | 
| 
       93 
93 
     | 
    
         
             
                headers = { params: params, authorization: "Bearer #{@access_token}" }
         
     | 
| 
       94 
94 
     | 
    
         
             
                opts = {method: :get, url: url, headers: headers}
         
     | 
| 
       95 
95 
     | 
    
         
             
                execute(opts, false)
         
     | 
| 
         @@ -99,7 +99,7 @@ class Morpheus::StorageProvidersInterface < Morpheus::APIClient 
     | 
|
| 
       99 
99 
     | 
    
         
             
                raise "#{self.class}.download_file() passed a blank id!" if id.to_s == ''
         
     | 
| 
       100 
100 
     | 
    
         
             
                raise "#{self.class}.download_file() passed a blank file path!" if file_path.to_s == ''
         
     | 
| 
       101 
101 
     | 
    
         
             
                escaped_file_path = file_path.split("/").collect {|it| URI.escape(it) }.join("/")
         
     | 
| 
       102 
     | 
    
         
            -
                url = "#{@base_url}/api/storage/ 
     | 
| 
      
 102 
     | 
    
         
            +
                url = "#{@base_url}/api/storage/buckets/#{URI.escape(id.to_s)}" + "/download-file/#{escaped_file_path}".squeeze('/')
         
     | 
| 
       103 
103 
     | 
    
         
             
                headers = { params: params, authorization: "Bearer #{@access_token}" }
         
     | 
| 
       104 
104 
     | 
    
         
             
                opts = {method: :get, url: url, headers: headers}
         
     | 
| 
       105 
105 
     | 
    
         
             
                # execute(opts, false)
         
     | 
| 
         @@ -128,8 +128,8 @@ class Morpheus::StorageProvidersInterface < Morpheus::APIClient 
     | 
|
| 
       128 
128 
     | 
    
         
             
              end
         
     | 
| 
       129 
129 
     | 
    
         | 
| 
       130 
130 
     | 
    
         
             
              def download_zip_chunked(id, outfile, params={})
         
     | 
| 
       131 
     | 
    
         
            -
                #url = "#{@base_url}/api/storage/ 
     | 
| 
       132 
     | 
    
         
            -
                url = "#{@base_url}/api/storage/ 
     | 
| 
      
 131 
     | 
    
         
            +
                #url = "#{@base_url}/api/storage/buckets/#{URI.escape(id.to_s)}" + ".zip"
         
     | 
| 
      
 132 
     | 
    
         
            +
                url = "#{@base_url}/api/storage/buckets/#{URI.escape(id.to_s)}/download-zip"
         
     | 
| 
       133 
133 
     | 
    
         
             
                headers = { params: params, authorization: "Bearer #{@access_token}" }
         
     | 
| 
       134 
134 
     | 
    
         
             
                opts = {method: :get, url: url, headers: headers}
         
     | 
| 
       135 
135 
     | 
    
         
             
                # execute(opts, false)
         
     | 
| 
         @@ -107,7 +107,7 @@ class Morpheus::Cli::Accounts 
     | 
|
| 
       107 
107 
     | 
    
         | 
| 
       108 
108 
     | 
    
         
             
              def get(args)
         
     | 
| 
       109 
109 
     | 
    
         
             
                options = {}
         
     | 
| 
       110 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 110 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       111 
111 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       112 
112 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :remote, :dry_run])
         
     | 
| 
       113 
113 
     | 
    
         
             
                end
         
     | 
| 
         @@ -166,7 +166,7 @@ class Morpheus::Cli::Accounts 
     | 
|
| 
       166 
166 
     | 
    
         | 
| 
       167 
167 
     | 
    
         
             
              def add(args)
         
     | 
| 
       168 
168 
     | 
    
         
             
                options = {}
         
     | 
| 
       169 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 169 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       170 
170 
     | 
    
         
             
                  opts.banner = subcommand_usage("[options]")
         
     | 
| 
       171 
171 
     | 
    
         
             
                  build_option_type_options(opts, options, add_account_option_types)
         
     | 
| 
       172 
172 
     | 
    
         
             
                  build_common_options(opts, options, [:options, :json, :remote, :dry_run])
         
     | 
| 
         @@ -212,7 +212,7 @@ class Morpheus::Cli::Accounts 
     | 
|
| 
       212 
212 
     | 
    
         | 
| 
       213 
213 
     | 
    
         
             
              def update(args)
         
     | 
| 
       214 
214 
     | 
    
         
             
                options = {}
         
     | 
| 
       215 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 215 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       216 
216 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name] [options]")
         
     | 
| 
       217 
217 
     | 
    
         
             
                  build_option_type_options(opts, options, update_account_option_types)
         
     | 
| 
       218 
218 
     | 
    
         
             
                  build_common_options(opts, options, [:options, :json, :remote, :dry_run])
         
     | 
| 
         @@ -274,7 +274,7 @@ class Morpheus::Cli::Accounts 
     | 
|
| 
       274 
274 
     | 
    
         | 
| 
       275 
275 
     | 
    
         
             
              def remove(args)
         
     | 
| 
       276 
276 
     | 
    
         
             
                options = {}
         
     | 
| 
       277 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 277 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       278 
278 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       279 
279 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :json, :remote, :dry_run])
         
     | 
| 
       280 
280 
     | 
    
         
             
                end
         
     | 
    
        data/lib/morpheus/cli/apps.rb
    CHANGED
    
    | 
         @@ -166,7 +166,7 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       166 
166 
     | 
    
         
             
                      payload['id'] = 'existing'
         
     | 
| 
       167 
167 
     | 
    
         
             
                      payload['templateName'] = 'Existing Instances'
         
     | 
| 
       168 
168 
     | 
    
         
             
                    else
         
     | 
| 
       169 
     | 
    
         
            -
                      found_app_template = get_available_app_templates.find {|it| it['id'].to_s == template_id.to_s }
         
     | 
| 
      
 169 
     | 
    
         
            +
                      found_app_template = get_available_app_templates.find {|it| it['id'].to_s == template_id.to_s || it['name'].to_s == template_id.to_s }
         
     | 
| 
       170 
170 
     | 
    
         
             
                      if found_app_template.nil?
         
     | 
| 
       171 
171 
     | 
    
         
             
                        print_red_alert "App Template not found by id #{template_id}"
         
     | 
| 
       172 
172 
     | 
    
         
             
                        return 1
         
     | 
| 
         @@ -218,6 +218,16 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       218 
218 
     | 
    
         
             
                options = {}
         
     | 
| 
       219 
219 
     | 
    
         
             
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       220 
220 
     | 
    
         
             
                  opts.banner = subcommand_usage("[app]")
         
     | 
| 
      
 221 
     | 
    
         
            +
                  opts.on('--refresh-until [status]', String, "Refresh until status is reached. Default status is running.") do |val|
         
     | 
| 
      
 222 
     | 
    
         
            +
                    if val.to_s.empty?
         
     | 
| 
      
 223 
     | 
    
         
            +
                      options[:refresh_until_status] = "running"
         
     | 
| 
      
 224 
     | 
    
         
            +
                    else
         
     | 
| 
      
 225 
     | 
    
         
            +
                      options[:refresh_until_status] = val.to_s.downcase
         
     | 
| 
      
 226 
     | 
    
         
            +
                    end
         
     | 
| 
      
 227 
     | 
    
         
            +
                  end
         
     | 
| 
      
 228 
     | 
    
         
            +
                  opts.on('--refresh-interval seconds', String, "Refresh interval. Default is 5 seconds.") do |val|
         
     | 
| 
      
 229 
     | 
    
         
            +
                    options[:refresh_interval] = val.to_f
         
     | 
| 
      
 230 
     | 
    
         
            +
                  end
         
     | 
| 
       221 
231 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run])
         
     | 
| 
       222 
232 
     | 
    
         
             
                  opts.footer = "Get details about an app.\n" +
         
     | 
| 
       223 
233 
     | 
    
         
             
                                "[app] is required. This is the name or id of an app."
         
     | 
| 
         @@ -270,7 +280,7 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       270 
280 
     | 
    
         
             
                      if instances.empty?
         
     | 
| 
       271 
281 
     | 
    
         
             
                        puts yellow, "This tier is empty", reset
         
     | 
| 
       272 
282 
     | 
    
         
             
                      else
         
     | 
| 
       273 
     | 
    
         
            -
                         
     | 
| 
      
 283 
     | 
    
         
            +
                        instances_rows = instances.collect do |instance|
         
     | 
| 
       274 
284 
     | 
    
         
             
                          # JD: fix bug here, status is not returned because withStats: false !?
         
     | 
| 
       275 
285 
     | 
    
         
             
                          status_string = instance['status'].to_s
         
     | 
| 
       276 
286 
     | 
    
         
             
                          if status_string == 'running'
         
     | 
| 
         @@ -288,7 +298,10 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       288 
298 
     | 
    
         
             
                          end
         
     | 
| 
       289 
299 
     | 
    
         
             
                          {id: instance['id'], name: instance['name'], connection: connection_string, environment: instance['instanceContext'], nodes: instance['containers'].count, status: status_string, type: instance['instanceType']['name'], group: !instance['group'].nil? ? instance['group']['name'] : nil, cloud: !instance['cloud'].nil? ? instance['cloud']['name'] : nil}
         
     | 
| 
       290 
300 
     | 
    
         
             
                        end
         
     | 
| 
       291 
     | 
    
         
            -
                         
     | 
| 
      
 301 
     | 
    
         
            +
                        instances_rows = instances_rows.sort {|x,y| x[:id] <=> y[:id] } #oldest to newest..
         
     | 
| 
      
 302 
     | 
    
         
            +
                        print cyan
         
     | 
| 
      
 303 
     | 
    
         
            +
                        print as_pretty_table(instances_rows, [:id, :name, :cloud, :type, :environment, :nodes, :connection, :status])
         
     | 
| 
      
 304 
     | 
    
         
            +
                        print reset
         
     | 
| 
       292 
305 
     | 
    
         
             
                      end
         
     | 
| 
       293 
306 
     | 
    
         
             
                    end
         
     | 
| 
       294 
307 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -296,6 +309,19 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       296 
309 
     | 
    
         | 
| 
       297 
310 
     | 
    
         
             
                  print reset,"\n"
         
     | 
| 
       298 
311 
     | 
    
         | 
| 
      
 312 
     | 
    
         
            +
                  # refresh until a status is reached
         
     | 
| 
      
 313 
     | 
    
         
            +
                  if options[:refresh_until_status]
         
     | 
| 
      
 314 
     | 
    
         
            +
                    if options[:refresh_interval].nil? || options[:refresh_interval].to_f < 0
         
     | 
| 
      
 315 
     | 
    
         
            +
                      options[:refresh_interval] = 5
         
     | 
| 
      
 316 
     | 
    
         
            +
                    end
         
     | 
| 
      
 317 
     | 
    
         
            +
                    while app['status'].to_s.downcase != options[:refresh_until_status].to_s.downcase
         
     | 
| 
      
 318 
     | 
    
         
            +
                      print cyan
         
     | 
| 
      
 319 
     | 
    
         
            +
                      print "Refreshing until status #{options[:refresh_until_status]} ..."
         
     | 
| 
      
 320 
     | 
    
         
            +
                      sleep(options[:refresh_interval])
         
     | 
| 
      
 321 
     | 
    
         
            +
                      get(args)
         
     | 
| 
      
 322 
     | 
    
         
            +
                    end
         
     | 
| 
      
 323 
     | 
    
         
            +
                  end
         
     | 
| 
      
 324 
     | 
    
         
            +
             
     | 
| 
       299 
325 
     | 
    
         
             
                rescue RestClient::Exception => e
         
     | 
| 
       300 
326 
     | 
    
         
             
                  print_rest_exception(e, options)
         
     | 
| 
       301 
327 
     | 
    
         
             
                  exit 1
         
     | 
| 
         @@ -429,24 +455,25 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       429 
455 
     | 
    
         | 
| 
       430 
456 
     | 
    
         
             
              def remove(args)
         
     | 
| 
       431 
457 
     | 
    
         
             
                options = {}
         
     | 
| 
       432 
     | 
    
         
            -
                query_params = { 
     | 
| 
      
 458 
     | 
    
         
            +
                query_params = {}
         
     | 
| 
       433 
459 
     | 
    
         
             
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       434 
     | 
    
         
            -
                  opts.banner = subcommand_usage("[app] 
     | 
| 
       435 
     | 
    
         
            -
                   
     | 
| 
       436 
     | 
    
         
            -
             
     | 
| 
      
 460 
     | 
    
         
            +
                  opts.banner = subcommand_usage("[app]")
         
     | 
| 
      
 461 
     | 
    
         
            +
                  #JD: UI defaults to on, but perhaps better to be explicate for now.
         
     | 
| 
      
 462 
     | 
    
         
            +
                  opts.on('--remove-instances [on|off]', ['on','off'], "Remove instances. Default is off.") do |val|
         
     | 
| 
      
 463 
     | 
    
         
            +
                    query_params[:removeInstances] = val
         
     | 
| 
      
 464 
     | 
    
         
            +
                  end
         
     | 
| 
      
 465 
     | 
    
         
            +
                  opts.on('--preserve-volumes [on|off]', ['on','off'], "Preserve Volumes. Default is off. Applies to certain types only.") do |val|
         
     | 
| 
      
 466 
     | 
    
         
            +
                    query_params[:preserveVolumes] = val
         
     | 
| 
       437 
467 
     | 
    
         
             
                  end
         
     | 
| 
       438 
468 
     | 
    
         
             
                  opts.on( '-B', '--keep-backups', "Preserve copy of backups" ) do
         
     | 
| 
       439 
469 
     | 
    
         
             
                    query_params[:keepBackups] = 'on'
         
     | 
| 
       440 
470 
     | 
    
         
             
                  end
         
     | 
| 
       441 
     | 
    
         
            -
                  opts.on('-- 
     | 
| 
       442 
     | 
    
         
            -
                    query_params[:removeInstances] = val
         
     | 
| 
       443 
     | 
    
         
            -
                  end
         
     | 
| 
       444 
     | 
    
         
            -
                  opts.on('--remove-volumes [on|off]', ['on','off'], "Remove Volumes. Default is on. Applies to certain types only.") do |val|
         
     | 
| 
       445 
     | 
    
         
            -
                    query_params[:removeVolumes] = val
         
     | 
| 
       446 
     | 
    
         
            -
                  end
         
     | 
| 
       447 
     | 
    
         
            -
                  opts.on('--releaseEIPs', ['on','off'], "Release EIPs. Default is false. Applies to Amazon only.") do |val|
         
     | 
| 
      
 471 
     | 
    
         
            +
                  opts.on('--releaseEIPs', ['on','off'], "Release EIPs. Default is on. Applies to Amazon only.") do |val|
         
     | 
| 
       448 
472 
     | 
    
         
             
                    query_params[:releaseEIPs] = val
         
     | 
| 
       449 
473 
     | 
    
         
             
                  end
         
     | 
| 
      
 474 
     | 
    
         
            +
                  opts.on( '-f', '--force', "Force Delete" ) do
         
     | 
| 
      
 475 
     | 
    
         
            +
                    query_params[:force] = 'on'
         
     | 
| 
      
 476 
     | 
    
         
            +
                  end
         
     | 
| 
       450 
477 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run, :quiet, :auto_confirm])
         
     | 
| 
       451 
478 
     | 
    
         
             
                  opts.footer = "Delete an app.\n" +
         
     | 
| 
       452 
479 
     | 
    
         
             
                                "[app] is required. This is the name or id of an app."
         
     | 
| 
         @@ -464,6 +491,10 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       464 
491 
     | 
    
         
             
                  unless options[:yes] || ::Morpheus::Cli::OptionTypes::confirm("Are you sure you would like to remove the app '#{app['name']}'?", options)
         
     | 
| 
       465 
492 
     | 
    
         
             
                    return 9
         
     | 
| 
       466 
493 
     | 
    
         
             
                  end
         
     | 
| 
      
 494 
     | 
    
         
            +
                  # JD: removeVolumes to maintain the old behavior with pre-3.5.2 appliances, remove me later
         
     | 
| 
      
 495 
     | 
    
         
            +
                  if query_params[:preserveVolumes].nil?
         
     | 
| 
      
 496 
     | 
    
         
            +
                    query_params[:removeVolumes] = 'on'
         
     | 
| 
      
 497 
     | 
    
         
            +
                  end
         
     | 
| 
       467 
498 
     | 
    
         
             
                  if options[:dry_run]
         
     | 
| 
       468 
499 
     | 
    
         
             
                    print_dry_run @apps_interface.dry.destroy(app['id'], query_params)
         
     | 
| 
       469 
500 
     | 
    
         
             
                    return
         
     | 
| 
         @@ -474,7 +505,7 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       474 
505 
     | 
    
         
             
                    print "\n"
         
     | 
| 
       475 
506 
     | 
    
         
             
                  elsif !options[:quiet]
         
     | 
| 
       476 
507 
     | 
    
         
             
                    print_green_success "Removed app #{app['name']}"
         
     | 
| 
       477 
     | 
    
         
            -
                    list([])
         
     | 
| 
      
 508 
     | 
    
         
            +
                    #list([])
         
     | 
| 
       478 
509 
     | 
    
         
             
                  end
         
     | 
| 
       479 
510 
     | 
    
         
             
                rescue RestClient::Exception => e
         
     | 
| 
       480 
511 
     | 
    
         
             
                  print_rest_exception(e, options)
         
     | 
| 
         @@ -527,7 +558,7 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       527 
558 
     | 
    
         
             
                    print "\n"
         
     | 
| 
       528 
559 
     | 
    
         
             
                  else
         
     | 
| 
       529 
560 
     | 
    
         
             
                    print_green_success "Removed instance #{instance['name']} from app #{app['name']}"
         
     | 
| 
       530 
     | 
    
         
            -
                    list([])
         
     | 
| 
      
 561 
     | 
    
         
            +
                    #list([])
         
     | 
| 
       531 
562 
     | 
    
         
             
                    # details_options = [app['name']]
         
     | 
| 
       532 
563 
     | 
    
         
             
                    # details(details_options)
         
     | 
| 
       533 
564 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -883,6 +914,7 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       883 
914 
     | 
    
         | 
| 
       884 
915 
     | 
    
         
             
                table_color = opts[:color] || cyan
         
     | 
| 
       885 
916 
     | 
    
         
             
                rows = apps.collect do |app|
         
     | 
| 
      
 917 
     | 
    
         
            +
                  tiers_str = format_app_tiers(app)
         
     | 
| 
       886 
918 
     | 
    
         
             
                  instances_str = (app['instanceCount'].to_i == 1) ? "1 Instance" : "#{app['instanceCount']} Instances"
         
     | 
| 
       887 
919 
     | 
    
         
             
                  containers_str = (app['containerCount'].to_i == 1) ? "1 Container" : "#{app['containerCount']} Containers"
         
     | 
| 
       888 
920 
     | 
    
         
             
                  stats = app['stats']
         
     | 
| 
         @@ -893,6 +925,7 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       893 
925 
     | 
    
         
             
                  {
         
     | 
| 
       894 
926 
     | 
    
         
             
                    id: app['id'],
         
     | 
| 
       895 
927 
     | 
    
         
             
                    name: app['name'],
         
     | 
| 
      
 928 
     | 
    
         
            +
                    tiers: tiers_str,
         
     | 
| 
       896 
929 
     | 
    
         
             
                    instances: instances_str,
         
     | 
| 
       897 
930 
     | 
    
         
             
                    containers: containers_str,
         
     | 
| 
       898 
931 
     | 
    
         
             
                    account: app['account'] ? app['account']['name'] : nil,
         
     | 
| 
         @@ -907,6 +940,7 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       907 
940 
     | 
    
         
             
                columns = [
         
     | 
| 
       908 
941 
     | 
    
         
             
                  :id,
         
     | 
| 
       909 
942 
     | 
    
         
             
                  :name,
         
     | 
| 
      
 943 
     | 
    
         
            +
                  :tiers,
         
     | 
| 
       910 
944 
     | 
    
         
             
                  :instances,
         
     | 
| 
       911 
945 
     | 
    
         
             
                  :containers,
         
     | 
| 
       912 
946 
     | 
    
         
             
                  #:account,
         
     | 
| 
         @@ -948,6 +982,23 @@ class Morpheus::Cli::Apps 
     | 
|
| 
       948 
982 
     | 
    
         
             
                out
         
     | 
| 
       949 
983 
     | 
    
         
             
              end
         
     | 
| 
       950 
984 
     | 
    
         | 
| 
      
 985 
     | 
    
         
            +
              def format_app_tiers(app)
         
     | 
| 
      
 986 
     | 
    
         
            +
                out = ""
         
     | 
| 
      
 987 
     | 
    
         
            +
                begin
         
     | 
| 
      
 988 
     | 
    
         
            +
                  app_tiers = app['appTiers']
         
     | 
| 
      
 989 
     | 
    
         
            +
                  if app_tiers
         
     | 
| 
      
 990 
     | 
    
         
            +
                    app_tier_names = app_tiers.collect { |app_tier| app_tier['tier']['name'] }
         
     | 
| 
      
 991 
     | 
    
         
            +
                    out << app_tier_names.join(", ")
         
     | 
| 
      
 992 
     | 
    
         
            +
                  end
         
     | 
| 
      
 993 
     | 
    
         
            +
                  if out.empty?
         
     | 
| 
      
 994 
     | 
    
         
            +
                    #out = "(Empty)"
         
     | 
| 
      
 995 
     | 
    
         
            +
                  end
         
     | 
| 
      
 996 
     | 
    
         
            +
                rescue => ex
         
     | 
| 
      
 997 
     | 
    
         
            +
                  Morpheus::Logging::DarkPrinter.puts "A formatting exception occured: #{ex}" if Morpheus::Logging.debug?
         
     | 
| 
      
 998 
     | 
    
         
            +
                end
         
     | 
| 
      
 999 
     | 
    
         
            +
                out
         
     | 
| 
      
 1000 
     | 
    
         
            +
              end
         
     | 
| 
      
 1001 
     | 
    
         
            +
             
     | 
| 
       951 
1002 
     | 
    
         
             
              def get_available_app_templates(refresh=false)
         
     | 
| 
       952 
1003 
     | 
    
         
             
                if !@available_app_templates || refresh
         
     | 
| 
       953 
1004 
     | 
    
         
             
                  results = @options_interface.options_for_source('appTemplates',{})
         
     | 
| 
         @@ -35,7 +35,7 @@ class Morpheus::Cli::BootScriptsCommand 
     | 
|
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
              def list(args)
         
     | 
| 
       37 
37 
     | 
    
         
             
                options = {}
         
     | 
| 
       38 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 38 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       39 
39 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       40 
40 
     | 
    
         
             
                  build_common_options(opts, options, [:list, :json, :dry_run])
         
     | 
| 
       41 
41 
     | 
    
         
             
                end
         
     | 
| 
         @@ -93,7 +93,7 @@ class Morpheus::Cli::BootScriptsCommand 
     | 
|
| 
       93 
93 
     | 
    
         | 
| 
       94 
94 
     | 
    
         
             
              def get(args)
         
     | 
| 
       95 
95 
     | 
    
         
             
                options = {}
         
     | 
| 
       96 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 96 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       97 
97 
     | 
    
         
             
                  opts.banner = subcommand_usage("[boot-script]")
         
     | 
| 
       98 
98 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run])
         
     | 
| 
       99 
99 
     | 
    
         
             
                end
         
     | 
| 
         @@ -147,7 +147,7 @@ class Morpheus::Cli::BootScriptsCommand 
     | 
|
| 
       147 
147 
     | 
    
         | 
| 
       148 
148 
     | 
    
         
             
              def add(args)
         
     | 
| 
       149 
149 
     | 
    
         
             
                options = {}
         
     | 
| 
       150 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 150 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       151 
151 
     | 
    
         
             
                  opts.banner = subcommand_usage("[fileName]")
         
     | 
| 
       152 
152 
     | 
    
         
             
                  build_option_type_options(opts, options, add_boot_script_option_types(false))
         
     | 
| 
       153 
153 
     | 
    
         
             
                  build_common_options(opts, options, [:options, :json, :dry_run, :quiet])
         
     | 
| 
         @@ -206,7 +206,7 @@ class Morpheus::Cli::BootScriptsCommand 
     | 
|
| 
       206 
206 
     | 
    
         | 
| 
       207 
207 
     | 
    
         
             
              def update(args)
         
     | 
| 
       208 
208 
     | 
    
         
             
                options = {}
         
     | 
| 
       209 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 209 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       210 
210 
     | 
    
         
             
                  opts.banner = subcommand_usage("[boot-script] [options]")
         
     | 
| 
       211 
211 
     | 
    
         
             
                  build_option_type_options(opts, options, update_boot_script_option_types(false))
         
     | 
| 
       212 
212 
     | 
    
         
             
                  build_common_options(opts, options, [:options, :json, :dry_run])
         
     | 
| 
         @@ -276,7 +276,7 @@ class Morpheus::Cli::BootScriptsCommand 
     | 
|
| 
       276 
276 
     | 
    
         | 
| 
       277 
277 
     | 
    
         
             
              def remove(args)
         
     | 
| 
       278 
278 
     | 
    
         
             
                options = {}
         
     | 
| 
       279 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 279 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       280 
280 
     | 
    
         
             
                  opts.banner = subcommand_usage("[boot-script]")
         
     | 
| 
       281 
281 
     | 
    
         
             
                  build_common_options(opts, options, [:account, :auto_confirm, :json, :dry_run])
         
     | 
| 
       282 
282 
     | 
    
         
             
                end
         
     | 
    
        data/lib/morpheus/cli/clouds.rb
    CHANGED
    
    | 
         @@ -226,7 +226,7 @@ class Morpheus::Cli::Clouds 
     | 
|
| 
       226 
226 
     | 
    
         
             
              def add(args)
         
     | 
| 
       227 
227 
     | 
    
         
             
                options = {}
         
     | 
| 
       228 
228 
     | 
    
         
             
                params = {}
         
     | 
| 
       229 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 229 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       230 
230 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name] --group GROUP --type TYPE")
         
     | 
| 
       231 
231 
     | 
    
         
             
                  opts.on( '-g', '--group GROUP', "Group Name" ) do |val|
         
     | 
| 
       232 
232 
     | 
    
         
             
                    params[:group] = val
         
     | 
| 
         @@ -345,7 +345,7 @@ class Morpheus::Cli::Clouds 
     | 
|
| 
       345 
345 
     | 
    
         
             
              def update(args)
         
     | 
| 
       346 
346 
     | 
    
         
             
                options = {}
         
     | 
| 
       347 
347 
     | 
    
         
             
                params = {}
         
     | 
| 
       348 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 348 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       349 
349 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name] [options]")
         
     | 
| 
       350 
350 
     | 
    
         
             
                  # opts.on( '-g', '--group GROUP', "Group Name" ) do |val|
         
     | 
| 
       351 
351 
     | 
    
         
             
                  #   params[:group] = val
         
     | 
| 
         @@ -415,7 +415,7 @@ class Morpheus::Cli::Clouds 
     | 
|
| 
       415 
415 
     | 
    
         
             
              def remove(args)
         
     | 
| 
       416 
416 
     | 
    
         
             
                options = {}
         
     | 
| 
       417 
417 
     | 
    
         
             
                query_params = {}
         
     | 
| 
       418 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 418 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       419 
419 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       420 
420 
     | 
    
         
             
                  opts.on( '-f', '--force', "Force Remove" ) do
         
     | 
| 
       421 
421 
     | 
    
         
             
                    query_params[:force] = 'on'
         
     | 
| 
         @@ -450,7 +450,7 @@ class Morpheus::Cli::Clouds 
     | 
|
| 
       450 
450 
     | 
    
         
             
              def firewall_disable(args)
         
     | 
| 
       451 
451 
     | 
    
         
             
                options = {}
         
     | 
| 
       452 
452 
     | 
    
         
             
                clear_or_secgroups_specified = false
         
     | 
| 
       453 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 453 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       454 
454 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       455 
455 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run, :remote])
         
     | 
| 
       456 
456 
     | 
    
         
             
                end
         
     | 
| 
         @@ -482,7 +482,7 @@ class Morpheus::Cli::Clouds 
     | 
|
| 
       482 
482 
     | 
    
         
             
              def firewall_enable(args)
         
     | 
| 
       483 
483 
     | 
    
         
             
                options = {}
         
     | 
| 
       484 
484 
     | 
    
         
             
                clear_or_secgroups_specified = false
         
     | 
| 
       485 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 485 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       486 
486 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       487 
487 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run, :remote])
         
     | 
| 
       488 
488 
     | 
    
         
             
                end
         
     | 
| 
         @@ -514,7 +514,7 @@ class Morpheus::Cli::Clouds 
     | 
|
| 
       514 
514 
     | 
    
         
             
              def security_groups(args)
         
     | 
| 
       515 
515 
     | 
    
         
             
                options = {}
         
     | 
| 
       516 
516 
     | 
    
         
             
                clear_or_secgroups_specified = false
         
     | 
| 
       517 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 517 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       518 
518 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       519 
519 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run, :remote])
         
     | 
| 
       520 
520 
     | 
    
         
             
                end
         
     | 
| 
         @@ -560,7 +560,7 @@ class Morpheus::Cli::Clouds 
     | 
|
| 
       560 
560 
     | 
    
         
             
              def apply_security_groups(args)
         
     | 
| 
       561 
561 
     | 
    
         
             
                options = {}
         
     | 
| 
       562 
562 
     | 
    
         
             
                clear_or_secgroups_specified = false
         
     | 
| 
       563 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 563 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       564 
564 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name] [-s] [--clear]")
         
     | 
| 
       565 
565 
     | 
    
         
             
                  opts.on( '-c', '--clear', "Clear all security groups" ) do
         
     | 
| 
       566 
566 
     | 
    
         
             
                    options[:securityGroupIds] = []
         
     | 
| 
         @@ -600,7 +600,7 @@ class Morpheus::Cli::Clouds 
     | 
|
| 
       600 
600 
     | 
    
         
             
              def list_cloud_types(args)
         
     | 
| 
       601 
601 
     | 
    
         
             
                options={}
         
     | 
| 
       602 
602 
     | 
    
         
             
                params = {}
         
     | 
| 
       603 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 603 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       604 
604 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       605 
605 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run, :remote])
         
     | 
| 
       606 
606 
     | 
    
         
             
                end
         
     | 
| 
         @@ -26,11 +26,21 @@ class Morpheus::Cli::ContainersCommand 
     | 
|
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
              def get(args)
         
     | 
| 
       28 
28 
     | 
    
         
             
                options = {}
         
     | 
| 
       29 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 29 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       30 
30 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       31 
31 
     | 
    
         
             
                  opts.on( nil, '--actions', "Display Available Actions" ) do
         
     | 
| 
       32 
32 
     | 
    
         
             
                    options[:include_available_actions] = true
         
     | 
| 
       33 
33 
     | 
    
         
             
                  end
         
     | 
| 
      
 34 
     | 
    
         
            +
                  opts.on('--refresh-until [status]', String, "Refresh until status is reached. Default status is running.") do |val|
         
     | 
| 
      
 35 
     | 
    
         
            +
                    if val.to_s.empty?
         
     | 
| 
      
 36 
     | 
    
         
            +
                      options[:refresh_until_status] = "running"
         
     | 
| 
      
 37 
     | 
    
         
            +
                    else
         
     | 
| 
      
 38 
     | 
    
         
            +
                      options[:refresh_until_status] = val.to_s.downcase
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  opts.on('--refresh-interval seconds', String, "Refresh interval. Default is 5 seconds.") do |val|
         
     | 
| 
      
 42 
     | 
    
         
            +
                    options[:refresh_interval] = val.to_f
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
       34 
44 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :yaml, :csv, :fields, :dry_run, :remote])
         
     | 
| 
       35 
45 
     | 
    
         
             
                end
         
     | 
| 
       36 
46 
     | 
    
         
             
                optparse.parse!(args)
         
     | 
| 
         @@ -120,6 +130,19 @@ class Morpheus::Cli::ContainersCommand 
     | 
|
| 
       120 
130 
     | 
    
         | 
| 
       121 
131 
     | 
    
         
             
                  print reset, "\n"
         
     | 
| 
       122 
132 
     | 
    
         | 
| 
      
 133 
     | 
    
         
            +
                  # refresh until a status is reached
         
     | 
| 
      
 134 
     | 
    
         
            +
                  if options[:refresh_until_status]
         
     | 
| 
      
 135 
     | 
    
         
            +
                    if options[:refresh_interval].nil? || options[:refresh_interval].to_f < 0
         
     | 
| 
      
 136 
     | 
    
         
            +
                      options[:refresh_interval] = 5
         
     | 
| 
      
 137 
     | 
    
         
            +
                    end
         
     | 
| 
      
 138 
     | 
    
         
            +
                    while container['status'].to_s.downcase != options[:refresh_until_status].to_s.downcase
         
     | 
| 
      
 139 
     | 
    
         
            +
                      print cyan
         
     | 
| 
      
 140 
     | 
    
         
            +
                      print "Refreshing until status #{options[:refresh_until_status]} ..."
         
     | 
| 
      
 141 
     | 
    
         
            +
                      sleep(options[:refresh_interval])
         
     | 
| 
      
 142 
     | 
    
         
            +
                      _get(arg, options)
         
     | 
| 
      
 143 
     | 
    
         
            +
                    end
         
     | 
| 
      
 144 
     | 
    
         
            +
                  end
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
       123 
146 
     | 
    
         
             
                  return 0
         
     | 
| 
       124 
147 
     | 
    
         
             
                rescue RestClient::Exception => e
         
     | 
| 
       125 
148 
     | 
    
         
             
                  print_rest_exception(e, options)
         
     | 
| 
         @@ -130,7 +153,7 @@ class Morpheus::Cli::ContainersCommand 
     | 
|
| 
       130 
153 
     | 
    
         | 
| 
       131 
154 
     | 
    
         
             
              def stop(args)
         
     | 
| 
       132 
155 
     | 
    
         
             
                options = {}
         
     | 
| 
       133 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 156 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       134 
157 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id list]")
         
     | 
| 
       135 
158 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :quiet, :remote])
         
     | 
| 
       136 
159 
     | 
    
         
             
                end
         
     | 
| 
         @@ -169,7 +192,7 @@ class Morpheus::Cli::ContainersCommand 
     | 
|
| 
       169 
192 
     | 
    
         | 
| 
       170 
193 
     | 
    
         
             
              def start(args)
         
     | 
| 
       171 
194 
     | 
    
         
             
                options = {}
         
     | 
| 
       172 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 195 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       173 
196 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id list]")
         
     | 
| 
       174 
197 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :quiet, :remote])
         
     | 
| 
       175 
198 
     | 
    
         
             
                end
         
     | 
| 
         @@ -208,7 +231,7 @@ class Morpheus::Cli::ContainersCommand 
     | 
|
| 
       208 
231 
     | 
    
         | 
| 
       209 
232 
     | 
    
         
             
              def restart(args)
         
     | 
| 
       210 
233 
     | 
    
         
             
                options = {}
         
     | 
| 
       211 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 234 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       212 
235 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id list]")
         
     | 
| 
       213 
236 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :quiet, :remote])
         
     | 
| 
       214 
237 
     | 
    
         
             
                end
         
     | 
| 
         @@ -247,7 +270,7 @@ class Morpheus::Cli::ContainersCommand 
     | 
|
| 
       247 
270 
     | 
    
         | 
| 
       248 
271 
     | 
    
         
             
              def suspend(args)
         
     | 
| 
       249 
272 
     | 
    
         
             
                options = {}
         
     | 
| 
       250 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 273 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       251 
274 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id list]")
         
     | 
| 
       252 
275 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :quiet, :remote])
         
     | 
| 
       253 
276 
     | 
    
         
             
                end
         
     | 
| 
         @@ -286,7 +309,7 @@ class Morpheus::Cli::ContainersCommand 
     | 
|
| 
       286 
309 
     | 
    
         | 
| 
       287 
310 
     | 
    
         
             
              def eject(args)
         
     | 
| 
       288 
311 
     | 
    
         
             
                options = {}
         
     | 
| 
       289 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 312 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       290 
313 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id list]")
         
     | 
| 
       291 
314 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :quiet, :remote])
         
     | 
| 
       292 
315 
     | 
    
         
             
                end
         
     |