morpheus-cli 3.3.2.6.2 → 3.3.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/morpheus/api/api_client.rb +4 -0
  3. data/lib/morpheus/api/cloud_datastores_interface.rb +47 -0
  4. data/lib/morpheus/api/virtual_images_interface.rb +2 -2
  5. data/lib/morpheus/cli.rb +1 -0
  6. data/lib/morpheus/cli/app_templates.rb +5 -15
  7. data/lib/morpheus/cli/cli_command.rb +5 -1
  8. data/lib/morpheus/cli/cloud_datastores_command.rb +399 -0
  9. data/lib/morpheus/cli/containers_command.rb +2 -8
  10. data/lib/morpheus/cli/hosts.rb +10 -21
  11. data/lib/morpheus/cli/instance_types.rb +4 -10
  12. data/lib/morpheus/cli/instances.rb +14 -34
  13. data/lib/morpheus/cli/library_container_scripts_command.rb +5 -12
  14. data/lib/morpheus/cli/library_container_templates_command.rb +4 -10
  15. data/lib/morpheus/cli/library_container_types_command.rb +4 -10
  16. data/lib/morpheus/cli/library_instance_types_command.rb +4 -10
  17. data/lib/morpheus/cli/library_layouts_command.rb +4 -10
  18. data/lib/morpheus/cli/library_option_types_command.rb +2 -5
  19. data/lib/morpheus/cli/library_upgrades_command.rb +4 -10
  20. data/lib/morpheus/cli/load_balancers.rb +4 -16
  21. data/lib/morpheus/cli/monitoring_apps_command.rb +5 -14
  22. data/lib/morpheus/cli/monitoring_checks_command.rb +13 -33
  23. data/lib/morpheus/cli/monitoring_contacts_command.rb +10 -11
  24. data/lib/morpheus/cli/monitoring_groups_command.rb +19 -38
  25. data/lib/morpheus/cli/monitoring_incidents_command.rb +37 -66
  26. data/lib/morpheus/cli/network_domains_command.rb +7 -16
  27. data/lib/morpheus/cli/network_groups_command.rb +6 -16
  28. data/lib/morpheus/cli/network_pool_servers_command.rb +6 -16
  29. data/lib/morpheus/cli/network_pools_command.rb +6 -16
  30. data/lib/morpheus/cli/network_proxies_command.rb +6 -16
  31. data/lib/morpheus/cli/network_services_command.rb +4 -11
  32. data/lib/morpheus/cli/networks_command.rb +6 -16
  33. data/lib/morpheus/cli/packages_command.rb +148 -13
  34. data/lib/morpheus/cli/policies_command.rb +6 -16
  35. data/lib/morpheus/cli/power_scheduling_command.rb +6 -24
  36. data/lib/morpheus/cli/recent_activity_command.rb +19 -19
  37. data/lib/morpheus/cli/remote.rb +7 -8
  38. data/lib/morpheus/cli/storage_providers_command.rb +6 -16
  39. data/lib/morpheus/cli/tasks.rb +4 -12
  40. data/lib/morpheus/cli/user_groups_command.rb +7 -25
  41. data/lib/morpheus/cli/user_sources_command.rb +9 -21
  42. data/lib/morpheus/cli/users.rb +6 -17
  43. data/lib/morpheus/cli/version.rb +1 -1
  44. data/lib/morpheus/cli/workflows.rb +4 -12
  45. metadata +4 -2
@@ -41,23 +41,18 @@ class Morpheus::Cli::NetworkDomainsCommand
41
41
  optparse.parse!(args)
42
42
  connect(options)
43
43
  begin
44
- [:phrase, :offset, :max, :sort, :direction].each do |k|
45
- params[k] = options[k] unless options[k].nil?
46
- end
44
+ params.merge!(parse_list_options(options))
47
45
  if options[:dry_run]
48
46
  print_dry_run @network_domains_interface.dry.list(params)
49
47
  return
50
48
  end
51
49
  json_response = @network_domains_interface.list(params)
52
50
  network_domains = json_response["networkDomains"]
53
- if options[:include_fields]
54
- json_response = {"networkDomains" => filter_data(network_domains, options[:include_fields]) }
55
- end
56
51
  if options[:json]
57
- puts as_json(json_response, options)
52
+ puts as_json(json_response, options, "networkDomains")
58
53
  return 0
59
54
  elsif options[:yaml]
60
- puts as_yaml(json_response, options)
55
+ puts as_yaml(json_response, options, "networkDomains")
61
56
  return 0
62
57
  elsif options[:csv]
63
58
  puts records_as_csv(network_domains, options)
@@ -65,9 +60,7 @@ class Morpheus::Cli::NetworkDomainsCommand
65
60
  end
66
61
  title = "Morpheus Network Domains"
67
62
  subtitles = []
68
- if params[:phrase]
69
- subtitles << "Search: #{params[:phrase]}".strip
70
- end
63
+ subtitles += parse_list_subtitles(options)
71
64
  print_h1 title, subtitles
72
65
  if network_domains.empty?
73
66
  print cyan,"No network domains found.",reset,"\n"
@@ -132,14 +125,12 @@ class Morpheus::Cli::NetworkDomainsCommand
132
125
  json_response = {'networkDomain' => network_domain} # skip redundant request
133
126
  # json_response = @network_domains_interface.get(network_domain['id'])
134
127
  network_domain = json_response['networkDomain']
135
- if options[:include_fields]
136
- json_response = {'networkDomain' => filter_data(network_domain, options[:include_fields]) }
137
- end
128
+
138
129
  if options[:json]
139
- puts as_json(json_response, options)
130
+ puts as_json(json_response, options, 'networkDomain')
140
131
  return 0
141
132
  elsif options[:yaml]
142
- puts as_yaml(json_response, options)
133
+ puts as_yaml(json_response, options, 'networkDomain')
143
134
  return 0
144
135
  elsif options[:csv]
145
136
  puts records_as_csv([network_domain], options)
@@ -41,23 +41,18 @@ class Morpheus::Cli::NetworkGroupsCommand
41
41
  optparse.parse!(args)
42
42
  connect(options)
43
43
  begin
44
- [:phrase, :offset, :max, :sort, :direction].each do |k|
45
- params[k] = options[k] unless options[k].nil?
46
- end
44
+ params.merge!(parse_list_options(options))
47
45
  if options[:dry_run]
48
46
  print_dry_run @network_groups_interface.dry.list(params)
49
47
  return
50
48
  end
51
49
  json_response = @network_groups_interface.list(params)
52
50
  network_groups = json_response["networkGroups"]
53
- if options[:include_fields]
54
- json_response = {"networkGroups" => filter_data(network_groups, options[:include_fields]) }
55
- end
56
51
  if options[:json]
57
- puts as_json(json_response, options)
52
+ puts as_json(json_response, options, "networkGroups")
58
53
  return 0
59
54
  elsif options[:yaml]
60
- puts as_yaml(json_response, options)
55
+ puts as_yaml(json_response, options, "networkGroups")
61
56
  return 0
62
57
  elsif options[:csv]
63
58
  puts records_as_csv(network_groups, options)
@@ -65,9 +60,7 @@ class Morpheus::Cli::NetworkGroupsCommand
65
60
  end
66
61
  title = "Morpheus Network Groups"
67
62
  subtitles = []
68
- if params[:phrase]
69
- subtitles << "Search: #{params[:phrase]}".strip
70
- end
63
+ subtitles += parse_list_subtitles(options)
71
64
  print_h1 title, subtitles
72
65
  if network_groups.empty?
73
66
  print cyan,"No network groups found.",reset,"\n"
@@ -130,14 +123,11 @@ class Morpheus::Cli::NetworkGroupsCommand
130
123
  json_response = {'networkGroup' => network_group} # skip redundant request
131
124
  # json_response = @network_groups_interface.get(network_group['id'])
132
125
  network_group = json_response['networkGroup']
133
- if options[:include_fields]
134
- json_response = {'networkGroup' => filter_data(network_group, options[:include_fields]) }
135
- end
136
126
  if options[:json]
137
- puts as_json(json_response, options)
127
+ puts as_json(json_response, options, "networkGroup")
138
128
  return 0
139
129
  elsif options[:yaml]
140
- puts as_yaml(json_response, options)
130
+ puts as_yaml(json_response, options, "networkGroup")
141
131
  return 0
142
132
  elsif options[:csv]
143
133
  puts records_as_csv([network_group], options)
@@ -41,23 +41,18 @@ class Morpheus::Cli::NetworkPoolServersCommand
41
41
  optparse.parse!(args)
42
42
  connect(options)
43
43
  begin
44
- [:phrase, :offset, :max, :sort, :direction].each do |k|
45
- params[k] = options[k] unless options[k].nil?
46
- end
44
+ params.merge!(parse_list_options(options))
47
45
  if options[:dry_run]
48
46
  print_dry_run @network_pool_servers_interface.dry.list(params)
49
47
  return
50
48
  end
51
49
  json_response = @network_pool_servers_interface.list(params)
52
50
  network_pool_servers = json_response["networkPoolServers"]
53
- if options[:include_fields]
54
- json_response = {"networkPoolServers" => filter_data(network_pool_servers, options[:include_fields]) }
55
- end
56
51
  if options[:json]
57
- puts as_json(json_response, options)
52
+ puts as_json(json_response, options, "networkPoolServers")
58
53
  return 0
59
54
  elsif options[:yaml]
60
- puts as_yaml(json_response, options)
55
+ puts as_yaml(json_response, options, "networkPoolServers")
61
56
  return 0
62
57
  elsif options[:csv]
63
58
  puts records_as_csv(network_pool_servers, options)
@@ -65,9 +60,7 @@ class Morpheus::Cli::NetworkPoolServersCommand
65
60
  end
66
61
  title = "Morpheus Network Pool Servers"
67
62
  subtitles = []
68
- if params[:phrase]
69
- subtitles << "Search: #{params[:phrase]}".strip
70
- end
63
+ subtitles += parse_list_subtitles(options)
71
64
  print_h1 title, subtitles
72
65
  if network_pool_servers.empty?
73
66
  print cyan,"No network pool servers found.",reset,"\n"
@@ -128,14 +121,11 @@ class Morpheus::Cli::NetworkPoolServersCommand
128
121
  json_response = {'networkPoolServer' => network_pool_server} # skip redundant request
129
122
  # json_response = @network_pool_servers_interface.get(network_pool_server['id'])
130
123
  network_pool_server = json_response['networkPoolServer']
131
- if options[:include_fields]
132
- json_response = {'networkPoolServer' => filter_data(network_pool_server, options[:include_fields]) }
133
- end
134
124
  if options[:json]
135
- puts as_json(json_response, options)
125
+ puts as_json(json_response, options, 'networkPoolServer')
136
126
  return 0
137
127
  elsif options[:yaml]
138
- puts as_yaml(json_response, options)
128
+ puts as_yaml(json_response, options, 'networkPoolServer')
139
129
  return 0
140
130
  elsif options[:csv]
141
131
  puts records_as_csv([network_pool_server], options)
@@ -41,23 +41,18 @@ class Morpheus::Cli::NetworkPoolsCommand
41
41
  optparse.parse!(args)
42
42
  connect(options)
43
43
  begin
44
- [:phrase, :offset, :max, :sort, :direction].each do |k|
45
- params[k] = options[k] unless options[k].nil?
46
- end
44
+ params.merge!(parse_list_options(options))
47
45
  if options[:dry_run]
48
46
  print_dry_run @network_pools_interface.dry.list(params)
49
47
  return
50
48
  end
51
49
  json_response = @network_pools_interface.list(params)
52
50
  network_pools = json_response["networkPools"]
53
- if options[:include_fields]
54
- json_response = {"networkPools" => filter_data(network_pools, options[:include_fields]) }
55
- end
56
51
  if options[:json]
57
- puts as_json(json_response, options)
52
+ puts as_json(json_response, options, "networkPools")
58
53
  return 0
59
54
  elsif options[:yaml]
60
- puts as_yaml(json_response, options)
55
+ puts as_yaml(json_response, options, "networkPools")
61
56
  return 0
62
57
  elsif options[:csv]
63
58
  puts records_as_csv(network_pools, options)
@@ -65,9 +60,7 @@ class Morpheus::Cli::NetworkPoolsCommand
65
60
  end
66
61
  title = "Morpheus Network Pools"
67
62
  subtitles = []
68
- if params[:phrase]
69
- subtitles << "Search: #{params[:phrase]}".strip
70
- end
63
+ subtitles += parse_list_subtitles(options)
71
64
  print_h1 title, subtitles
72
65
  if network_pools.empty?
73
66
  print cyan,"No network pools found.",reset,"\n"
@@ -131,14 +124,11 @@ class Morpheus::Cli::NetworkPoolsCommand
131
124
  json_response = {'networkPool' => network_pool} # skip redundant request
132
125
  # json_response = @network_pools_interface.get(network_pool['id'])
133
126
  network_pool = json_response['networkPool']
134
- if options[:include_fields]
135
- json_response = {'networkPool' => filter_data(network_pool, options[:include_fields]) }
136
- end
137
127
  if options[:json]
138
- puts as_json(json_response, options)
128
+ puts as_json(json_response, options, "networkPool")
139
129
  return 0
140
130
  elsif options[:yaml]
141
- puts as_yaml(json_response, options)
131
+ puts as_yaml(json_response, options, "networkPool")
142
132
  return 0
143
133
  elsif options[:csv]
144
134
  puts records_as_csv([network_pool], options)
@@ -41,23 +41,18 @@ class Morpheus::Cli::NetworkProxiesCommand
41
41
  optparse.parse!(args)
42
42
  connect(options)
43
43
  begin
44
- [:phrase, :offset, :max, :sort, :direction].each do |k|
45
- params[k] = options[k] unless options[k].nil?
46
- end
44
+ params.merge!(parse_list_options(options))
47
45
  if options[:dry_run]
48
46
  print_dry_run @network_proxies_interface.dry.list(params)
49
47
  return
50
48
  end
51
49
  json_response = @network_proxies_interface.list(params)
52
50
  network_proxies = json_response["networkProxies"]
53
- if options[:include_fields]
54
- json_response = {"networkProxies" => filter_data(network_proxies, options[:include_fields]) }
55
- end
56
51
  if options[:json]
57
- puts as_json(json_response, options)
52
+ puts as_json(json_response, options, "networkProxies")
58
53
  return 0
59
54
  elsif options[:yaml]
60
- puts as_yaml(json_response, options)
55
+ puts as_yaml(json_response, options, "networkProxies")
61
56
  return 0
62
57
  elsif options[:csv]
63
58
  puts records_as_csv(network_proxies, options)
@@ -65,9 +60,7 @@ class Morpheus::Cli::NetworkProxiesCommand
65
60
  end
66
61
  title = "Morpheus Network Proxies"
67
62
  subtitles = []
68
- if params[:phrase]
69
- subtitles << "Search: #{params[:phrase]}".strip
70
- end
63
+ subtitles += parse_list_subtitles(options)
71
64
  print_h1 title, subtitles
72
65
  if network_proxies.empty?
73
66
  print cyan,"No network proxies found.",reset,"\n"
@@ -130,14 +123,11 @@ class Morpheus::Cli::NetworkProxiesCommand
130
123
  json_response = {'networkProxy' => network_proxy} # skip redundant request
131
124
  # json_response = @network_proxies_interface.get(network_proxy['id'])
132
125
  network_proxy = json_response['networkProxy']
133
- if options[:include_fields]
134
- json_response = {'networkProxy' => filter_data(network_proxy, options[:include_fields]) }
135
- end
136
126
  if options[:json]
137
- puts as_json(json_response, options)
127
+ puts as_json(json_response, options, "networkProxy")
138
128
  return 0
139
129
  elsif options[:yaml]
140
- puts as_yaml(json_response, options)
130
+ puts as_yaml(json_response, options, "networkProxy")
141
131
  return 0
142
132
  elsif options[:csv]
143
133
  puts records_as_csv([network_proxy], options)
@@ -42,23 +42,18 @@ class Morpheus::Cli::NetworkServicesCommand
42
42
  optparse.parse!(args)
43
43
  connect(options)
44
44
  begin
45
- [:phrase, :offset, :max, :sort, :direction].each do |k|
46
- params[k] = options[k] unless options[k].nil?
47
- end
45
+ params.merge!(parse_list_options(options))
48
46
  if options[:dry_run]
49
47
  print_dry_run @network_services_interface.dry.list(params)
50
48
  return
51
49
  end
52
50
  json_response = @network_services_interface.list(params)
53
51
  network_services = json_response["networkServices"]
54
- if options[:include_fields]
55
- json_response = {"networkServices" => filter_data(network_services, options[:include_fields]) }
56
- end
57
52
  if options[:json]
58
- puts as_json(json_response, options)
53
+ puts as_json(json_response, options, "networkServices")
59
54
  return 0
60
55
  elsif options[:yaml]
61
- puts as_yaml(json_response, options)
56
+ puts as_yaml(json_response, options, "networkServices")
62
57
  return 0
63
58
  elsif options[:csv]
64
59
  puts records_as_csv(network_services, options)
@@ -66,9 +61,7 @@ class Morpheus::Cli::NetworkServicesCommand
66
61
  end
67
62
  title = "Morpheus Network Services"
68
63
  subtitles = []
69
- if params[:phrase]
70
- subtitles << "Search: #{params[:phrase]}".strip
71
- end
64
+ subtitles += parse_list_subtitles(options)
72
65
  print_h1 title, subtitles
73
66
  if network_services.empty?
74
67
  print cyan,"No network services found.",reset,"\n"
@@ -44,23 +44,18 @@ class Morpheus::Cli::NetworksCommand
44
44
  optparse.parse!(args)
45
45
  connect(options)
46
46
  begin
47
- [:phrase, :offset, :max, :sort, :direction].each do |k|
48
- params[k] = options[k] unless options[k].nil?
49
- end
47
+ params.merge!(parse_list_options(options))
50
48
  if options[:dry_run]
51
49
  print_dry_run @networks_interface.dry.list(params)
52
50
  return
53
51
  end
54
52
  json_response = @networks_interface.list(params)
55
53
  networks = json_response["networks"]
56
- if options[:include_fields]
57
- json_response = {"networks" => filter_data(networks, options[:include_fields]) }
58
- end
59
54
  if options[:json]
60
- puts as_json(json_response, options)
55
+ puts as_json(json_response, options, "networks")
61
56
  return 0
62
57
  elsif options[:yaml]
63
- puts as_yaml(json_response, options)
58
+ puts as_yaml(json_response, options, "networks")
64
59
  return 0
65
60
  elsif options[:csv]
66
61
  puts records_as_csv(networks, options)
@@ -68,9 +63,7 @@ class Morpheus::Cli::NetworksCommand
68
63
  end
69
64
  title = "Morpheus Networks"
70
65
  subtitles = []
71
- if params[:phrase]
72
- subtitles << "Search: #{params[:phrase]}".strip
73
- end
66
+ subtitles += parse_list_subtitles(options)
74
67
  print_h1 title, subtitles
75
68
  if networks.empty?
76
69
  print cyan,"No networks found.",reset,"\n"
@@ -135,14 +128,11 @@ class Morpheus::Cli::NetworksCommand
135
128
  json_response = {'network' => network} # skip redundant request
136
129
  # json_response = @networks_interface.get(network['id'])
137
130
  network = json_response['network']
138
- if options[:include_fields]
139
- json_response = {'network' => filter_data(network, options[:include_fields]) }
140
- end
141
131
  if options[:json]
142
- puts as_json(json_response, options)
132
+ puts as_json(json_response, options, "network")
143
133
  return 0
144
134
  elsif options[:yaml]
145
- puts as_yaml(json_response, options)
135
+ puts as_yaml(json_response, options, "network")
146
136
  return 0
147
137
  elsif options[:csv]
148
138
  puts records_as_csv([network], options)
@@ -8,7 +8,7 @@ class Morpheus::Cli::LibraryPackagesCommand
8
8
 
9
9
  set_command_name :'packages'
10
10
  # register_subcommands :list, :get, :install, :update, :remove, :export
11
- register_subcommands :export
11
+ register_subcommands :list, :search, :export
12
12
 
13
13
  # hide until this is released
14
14
  set_command_hidden
@@ -27,7 +27,125 @@ class Morpheus::Cli::LibraryPackagesCommand
27
27
  end
28
28
 
29
29
  def list(args)
30
- raise "not yet implemented"
30
+ options = {}
31
+ params = {}
32
+ optparse = Morpheus::Cli::OptionParser.new do |opts|
33
+ opts.banner = subcommand_usage()
34
+ build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
35
+ opts.footer = "List installed packages."
36
+ end
37
+ optparse.parse!(args)
38
+ connect(options)
39
+ begin
40
+ params.merge!(parse_list_options(options))
41
+
42
+ if options[:dry_run]
43
+ print_dry_run @packages_interface.dry.list(params)
44
+ return
45
+ end
46
+ json_response = @packages_interface.list(params)
47
+ if options[:json]
48
+ puts as_json(json_response, options, "packages")
49
+ return 0
50
+ elsif options[:yaml]
51
+ puts as_yaml(json_response, options, "packages")
52
+ return 0
53
+ elsif options[:csv]
54
+ puts records_as_csv(json_response["packages"], options)
55
+ else
56
+ installed_packages = json_response["packages"]
57
+ title = "Installed Packages"
58
+ subtitles = []
59
+ subtitles += parse_list_subtitles(options)
60
+ print_h1 title, subtitles
61
+ if installed_packages.empty?
62
+ print cyan,"No installed packages found",reset,"\n"
63
+ else
64
+ rows = installed_packages.collect {|package|
65
+ {
66
+ code: package['code'],
67
+ name: package['name'],
68
+ version: package['version'],
69
+ description: package['description'],
70
+ }
71
+ }
72
+ columns = [:code, :name, {:description => {:max_width => 50}}]
73
+ # custom pretty table columns ...
74
+ if options[:include_fields]
75
+ columns = options[:include_fields]
76
+ end
77
+ print cyan
78
+ print as_pretty_table(rows, columns, options)
79
+ print reset
80
+ print_results_pagination(json_response)
81
+ end
82
+ print reset,"\n"
83
+ end
84
+ rescue RestClient::Exception => e
85
+ print_rest_exception(e, options)
86
+ exit 1
87
+ end
88
+ end
89
+
90
+ def search(args)
91
+ options = {}
92
+ params = {}
93
+ optparse = Morpheus::Cli::OptionParser.new do |opts|
94
+ opts.banner = subcommand_usage()
95
+ build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
96
+ opts.footer = "Search the marketplace for available packages."
97
+ end
98
+ optparse.parse!(args)
99
+ connect(options)
100
+ begin
101
+ params.merge!(parse_list_options(options))
102
+
103
+ if options[:dry_run]
104
+ print_dry_run @packages_interface.dry.search(params)
105
+ return
106
+ end
107
+ json_response = @packages_interface.search(params)
108
+ if options[:json]
109
+ puts as_json(json_response, options, "packages")
110
+ return 0
111
+ elsif options[:yaml]
112
+ puts as_yaml(json_response, options, "packages")
113
+ return 0
114
+ elsif options[:csv]
115
+ puts records_as_csv(json_response["packages"], options)
116
+ else
117
+ available_packages = json_response["packages"]
118
+ title = "Available Packages"
119
+ subtitles = []
120
+ subtitles += parse_list_subtitles(options)
121
+ print_h1 title, subtitles
122
+ if available_packages.empty?
123
+ print cyan,"No packages found",reset,"\n"
124
+ else
125
+ rows = available_packages.collect {|package|
126
+ {
127
+ code: package['code'],
128
+ name: package['name'],
129
+ version: package['version'],
130
+ description: package['description']
131
+ }
132
+ }
133
+ columns = [:code, :name, {:description => {:max_width => 50}}]
134
+ # custom pretty table columns ...
135
+ if options[:include_fields]
136
+ columns = options[:include_fields]
137
+ end
138
+ print cyan
139
+ print as_pretty_table(rows, columns, options)
140
+ print reset
141
+ print_results_pagination(json_response)
142
+ end
143
+ print reset,"\n"
144
+ end
145
+ rescue RestClient::Exception => e
146
+ print_rest_exception(e, options)
147
+ exit 1
148
+ end
31
149
  end
32
150
 
33
151
  def get(args)
@@ -62,7 +180,22 @@ class Morpheus::Cli::LibraryPackagesCommand
62
180
  opts.on('--file FILE', String, "Destination filepath for the downloaded .morpkg file.") do |val|
63
181
  outfile = val
64
182
  end
65
- opts.on('--instance-types LIST', String, "Can be used to export multiple instance types in a single package.") do |val|
183
+ opts.on('--package-version VALUE', String, "Version number for package.") do |val|
184
+ params['version'] = val
185
+ end
186
+ opts.on('--organization NAME', String, "Organization for package.") do |val|
187
+ params['organization'] = val
188
+ end
189
+ opts.on('--code VALUE', String, "Code for package. Default comes from instance type.") do |val|
190
+ params['code'] = val
191
+ end
192
+ opts.on('--name VALUE', String, "Name for package. Default comes from the instance type name") do |val|
193
+ params['name'] = val
194
+ end
195
+ opts.on('--description VALUE', String, "Description of package.") do |val|
196
+ params['description'] = val
197
+ end
198
+ opts.on('--instance-types LIST', String, "Can be used to export multiple instance types as a single package.") do |val|
66
199
  instance_type_codes = []
67
200
  val.split(',').collect do |it|
68
201
  if !it.strip.empty?
@@ -90,20 +223,19 @@ class Morpheus::Cli::LibraryPackagesCommand
90
223
  end
91
224
  opts.on( '--open [PROG]', String, "Unzip the package and open the expanded directory with the specified program." ) do |val|
92
225
  unzip_and_open = true
93
- if val.to_s.empty?
226
+ if !val.to_s.empty?
94
227
  open_prog = val.to_s
95
228
  else
96
- open_prog = val.to_s
97
- end
98
- if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
99
- open_prog = "start"
100
- elsif RbConfig::CONFIG['host_os'] =~ /darwin/
101
- open_prog = "open"
102
- elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
103
- open_prog = "xdg-open"
229
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
230
+ open_prog = "start"
231
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin/
232
+ open_prog = "open"
233
+ elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
234
+ open_prog = "xdg-open"
235
+ end
104
236
  end
105
237
  end
106
- build_common_options(opts, options, [:dry_run, :quiet])
238
+ build_common_options(opts, options, [:options, :dry_run, :quiet])
107
239
  opts.footer = "Export one or many instance types as a morpheus library package (.morpkg) file.\n" +
108
240
  "[instance-type] is required. This is the instance type code." +
109
241
  "--instance-types can bv. This is a list of instance type codes."
@@ -166,6 +298,9 @@ class Morpheus::Cli::LibraryPackagesCommand
166
298
  end
167
299
  end
168
300
 
301
+ # merge -O options into normally parsed options
302
+ params.deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) }) if options[:options]
303
+
169
304
  if options[:dry_run]
170
305
  print_dry_run @packages_interface.dry.export(params, outfile), full_command_string
171
306
  return 1