MuranoCLI 3.2.0.beta.5 → 3.2.0.beta.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.ignore +22 -11
  3. data/dockers/Dockerfile.2.2.9 +2 -2
  4. data/dockers/Dockerfile.2.3.6 +2 -2
  5. data/dockers/Dockerfile.2.4.3 +2 -2
  6. data/dockers/Dockerfile.2.5.0 +2 -2
  7. data/dockers/Dockerfile.GemRelease +6 -6
  8. data/dockers/Dockerfile.m4 +4 -4
  9. data/dockers/README.rst +87 -19
  10. data/dockers/RELEASE.rst +1 -1
  11. data/dockers/docker-test.sh +4 -1
  12. data/{.trustme.plugin → docs/ci/.trustme.plugin} +5 -2
  13. data/{.trustme.sh → docs/ci/.trustme.sh} +64 -16
  14. data/lib/MrMurano/Business.rb +73 -0
  15. data/lib/MrMurano/Config.rb +4 -3
  16. data/lib/MrMurano/Keystore.rb +4 -0
  17. data/lib/MrMurano/ReCommander.rb +23 -0
  18. data/lib/MrMurano/Solution.rb +10 -0
  19. data/lib/MrMurano/SyncUpDown-Core.rb +94 -56
  20. data/lib/MrMurano/SyncUpDown-Item.rb +2 -0
  21. data/lib/MrMurano/Webservice-Endpoint.rb +8 -7
  22. data/lib/MrMurano/commands/business.rb +60 -0
  23. data/lib/MrMurano/commands/content.rb +7 -1
  24. data/lib/MrMurano/commands/cors.rb +1 -0
  25. data/lib/MrMurano/commands/devices.rb +1 -1
  26. data/lib/MrMurano/commands/element.rb +40 -14
  27. data/lib/MrMurano/commands/keystore.rb +8 -0
  28. data/lib/MrMurano/commands/logs.rb +1 -0
  29. data/lib/MrMurano/commands/network.rb +120 -0
  30. data/lib/MrMurano/commands/postgresql.rb +2 -0
  31. data/lib/MrMurano/commands/service.rb +5 -0
  32. data/lib/MrMurano/commands/settings.rb +3 -0
  33. data/lib/MrMurano/commands/show.rb +1 -0
  34. data/lib/MrMurano/commands/status.rb +1 -0
  35. data/lib/MrMurano/commands/sync.rb +2 -0
  36. data/lib/MrMurano/commands/timeseries.rb +9 -0
  37. data/lib/MrMurano/commands/tsdb.rb +4 -0
  38. data/lib/MrMurano/commands.rb +1 -0
  39. data/lib/MrMurano/variegated/ruby_dig.rb +11 -0
  40. data/lib/MrMurano/version.rb +1 -1
  41. data/spec/cmd_element_spec.rb +2 -2
  42. data/spec/fixtures/dumped_config +1 -0
  43. metadata +6 -5
  44. /data/{.trustme.vim → docs/ci/.trustme.vim} +0 -0
@@ -0,0 +1,120 @@
1
+ # Copyright © 2016-2017 Exosite LLC. All Rights Reserved
2
+ # License: PROPRIETARY. See LICENSE.txt.
3
+ # frozen_string_literal: true
4
+
5
+ # vim:tw=0:ts=2:sw=2:et:ai
6
+ # Unauthorized copying of this file is strictly prohibited.
7
+
8
+ require 'MrMurano/ReCommander'
9
+
10
+ # *** Base network command help
11
+ # ------------------------------
12
+ command :network do |c|
13
+ c.syntax = %(murano network)
14
+ c.summary = %(About network)
15
+ c.description = %(Commands for working with enterprise business networks.)
16
+ c.project_not_required = true
17
+ c.subcmdgrouphelp = true
18
+ c.action do |_args, _options|
19
+ ::Commander::UI.enable_paging unless $cfg['tool.no-page']
20
+ say MrMurano::SubCmdGroupHelp.new(c).get_help
21
+ end
22
+ end
23
+
24
+ # View a business network
25
+ command 'network view' do |c|
26
+ c.syntax = %(murano network view)
27
+ c.summary = %(View an enterprise business network)
28
+ c.description = %(
29
+ View business network belonging to an enterprise parent business.
30
+ ).strip
31
+ c.example %('View a business network using the config file's business.id),
32
+ %('murano network view')
33
+ c.example %('View a business network using a passed in business.id),
34
+ %('murano network view -c business.id=<BUSINESS_ID>')
35
+ c.project_not_required = true
36
+ c.action do |_args, _options|
37
+ view_business_network
38
+ end
39
+ end
40
+
41
+ def view_business_network
42
+ biz = MrMurano::Business.new
43
+ biz.must_business_id!
44
+ MrMurano::Verbose.whirly_start(
45
+ 'Checking for configured business network...'
46
+ )
47
+ business_network = biz.get_business_network(biz.bid)
48
+ MrMurano::Verbose.whirly_stop
49
+
50
+ must_business_network!(business_network)
51
+ table = Terminal::Table.new
52
+ table.add_row [
53
+ 'Network Name',
54
+ 'Child Business Tier',
55
+ 'Child Business Price',
56
+ ]
57
+ table.add_separator
58
+ table.add_row [
59
+ business_network[:name],
60
+ business_network[:tier][:id],
61
+ business_network[:tier][:price],
62
+ ]
63
+ puts table
64
+ end
65
+
66
+ def must_business_network!(business_network)
67
+ return if !business_network.nil? && !business_network[:name].nil?
68
+ if business_network.nil?
69
+ MrMurano::Verbose.error(
70
+ 'Error getting business network.'
71
+ )
72
+ elsif business_network[:name].nil?
73
+ MrMurano::Verbose.error(
74
+ 'Business network is not configured.'
75
+ )
76
+ else
77
+ MrMurano::Verbose.error(
78
+ 'Error with business network.'
79
+ )
80
+ end
81
+ exit(1)
82
+ end
83
+
84
+ # Configure/Update a business network
85
+ command 'network configure' do |c|
86
+ c.syntax = %(murano network configure <NETWORK_NAME>)
87
+ c.summary = %(Configure enterprise business network name)
88
+ c.description = %(
89
+ Configure or update the name of an enterprise business network.
90
+ ).strip
91
+ c.example %('Configure a business network using the config file's business.id),
92
+ %('murano network configure <NETWORK_NAME>')
93
+ c.example %('Configure a business network using a passed in business.id),
94
+ %('murano network configure <NETWORK_NAME> -c business.id=<BUSINESS_ID>')
95
+ c.project_not_required = true
96
+
97
+ c.action do |args, _options|
98
+ if args.empty?
99
+ MrMurano::Verbose.error('Please include a network name.')
100
+ exit 1
101
+ end
102
+ configure_business_network(args)
103
+ end
104
+
105
+ def configure_business_network(args)
106
+ network_name = args[0]
107
+ biz = MrMurano::Business.new
108
+ biz.must_business_id!
109
+ MrMurano::Verbose.whirly_start 'Configuring/updating business network...'
110
+ response = biz.configure_business_network(biz.bid, network_name)
111
+ MrMurano::Verbose.whirly_stop
112
+ return unless response.nil?
113
+ MrMurano::Verbose.error('Error configuring business network.')
114
+ exit(1)
115
+ end
116
+ end
117
+
118
+ # TODO: Network child business commands:
119
+ # - View, create, delete child businesses.
120
+ # - Add member to business network child.
@@ -39,6 +39,7 @@ Query the relational database.
39
39
 
40
40
  Queries can include $# escapes that are filled from the --param option.
41
41
  ).strip
42
+ c.must_not_be_managed = true
42
43
 
43
44
  c.option '--param LIST', Array, %(Values to fill $# with)
44
45
  c.option '-f', '--file FILE', %(File of SQL commands)
@@ -122,6 +123,7 @@ format. Each file is a series of Postgres SQL commands.
122
123
  The current version of the migrations (last <level> ran) will be stored in an
123
124
  extra table in your database. (__murano_cli__.migrate_version)
124
125
  ).strip
126
+ c.must_not_be_managed = true
125
127
 
126
128
  c.option '--dir DIR', %(Directory where migrations live)
127
129
 
@@ -201,6 +201,7 @@ class ServiceCmd
201
201
  Commands for working with Solution Services.
202
202
  ).strip
203
203
  cmd.project_not_required = true
204
+ cmd.must_not_be_managed = true
204
205
  cmd.subcmdgrouphelp = true
205
206
 
206
207
  cmd.action do |_args, _options|
@@ -218,6 +219,7 @@ class ServiceCmd
218
219
  Add a service to a solution.
219
220
  ).strip
220
221
  cmd.project_not_required = true
222
+ cmd.must_not_be_managed = true
221
223
 
222
224
  # FIXME/2018-03-21: See comment under command_service_delete:
223
225
  # We need to add multi-solution support so by default this
@@ -290,6 +292,7 @@ class ServiceCmd
290
292
  Delete service from solution.
291
293
  ).strip
292
294
  cmd.project_not_required = true
295
+ cmd.must_not_be_managed = true
293
296
 
294
297
  # Add flag: --type [application|product|all].
295
298
  # FIXME/2018-03-21: The way the CLI works, it chooses all solutions
@@ -359,6 +362,7 @@ class ServiceCmd
359
362
  Get information about an added service.
360
363
  ).strip
361
364
  cmd.project_not_required = true
365
+ cmd.must_not_be_managed = true
362
366
 
363
367
  # Add flag: --type [application|product|all].
364
368
  cmd_add_solntype_pickers(cmd)
@@ -499,6 +503,7 @@ class ServiceCmd
499
503
  List all services previously added to a solution.
500
504
  ).strip
501
505
  cmd.project_not_required = true
506
+ cmd.must_not_be_managed = true
502
507
 
503
508
  # Add flag: --type [application|product|all].
504
509
  cmd_add_solntype_pickers(cmd)
@@ -33,6 +33,7 @@ command 'setting list' do |c|
33
33
  List which services and settings are available.
34
34
  ).strip
35
35
  c.project_not_required = true
36
+ c.must_not_be_managed = true
36
37
 
37
38
  c.action do |args, _options|
38
39
  c.verify_arg_count!(args)
@@ -55,6 +56,7 @@ command 'setting read' do |c|
55
56
  c.description = %(
56
57
  Read a setting on a Service.
57
58
  ).strip
59
+ c.must_not_be_managed = true
58
60
 
59
61
  c.option '-o', '--output FILE', String, %(File to save output to)
60
62
 
@@ -89,6 +91,7 @@ This always does a read-modify-write.
89
91
 
90
92
  If a sub-key doesn't exist, that entire path will be created as dicts.
91
93
  ).strip
94
+ c.must_not_be_managed = true
92
95
 
93
96
  c.option '--bool', %(Set Value type to boolean)
94
97
  c.option '--num', %(Set Value type to number)
@@ -122,6 +122,7 @@ command 'show location' do |c|
122
122
  Show readable information about the current configuration.
123
123
  ).strip
124
124
  c.project_not_required = true
125
+ c.must_not_be_managed = true
125
126
 
126
127
  c.action do |args, _options|
127
128
  c.verify_arg_count!(args)
@@ -74,6 +74,7 @@ Each item type also supports specific filters. These always start with #.
74
74
  cmd.syntax = %(murano status [--options] [filters])
75
75
  cmd.summary = %(Get the status of files)
76
76
  cmd.description = STATUS_CMD_DESCRIPTION
77
+ cmd.must_not_be_managed = true
77
78
 
78
79
  # Add flag: --type [application|product|all].
79
80
  cmd_add_solntype_pickers(cmd)
@@ -35,6 +35,7 @@ command :syncdown do |cmd|
35
35
  cmd.description = %(
36
36
  Sync project down from Murano.
37
37
  ).strip
38
+ cmd.must_not_be_managed = true
38
39
 
39
40
  # Add flag: --type [application|product|all].
40
41
  cmd_add_solntype_pickers(cmd)
@@ -90,6 +91,7 @@ command :syncup do |cmd|
90
91
  cmd.description = %(
91
92
  Sync project up into Murano.
92
93
  ).strip
94
+ cmd.must_not_be_managed = true
93
95
 
94
96
  # Add flag: --type [application|product|all].
95
97
  cmd_add_solntype_pickers(cmd)
@@ -43,6 +43,7 @@ instance in a solution. This allows for easier debugging, being able to
43
43
  quickly try out different queries or write test data.
44
44
  ).strip
45
45
  c.subcmdgrouphelp = true
46
+ c.must_not_be_managed = true
46
47
 
47
48
  c.action do |_args, _options|
48
49
  ::Commander::UI.enable_paging unless $cfg['tool.no-page']
@@ -58,6 +59,8 @@ This command is deprecated.
58
59
 
59
60
  Query the timeseries database.
60
61
  ).strip
62
+ c.must_not_be_managed = true
63
+
61
64
  c.option '-o', '--output FILE', %(Download to file instead of STDOUT)
62
65
  c.option '--[no-]json', %(Display results as raw json)
63
66
  c.option '--[no-]csv', %(Display results as CSV)
@@ -99,7 +102,10 @@ This command is deprecated.
99
102
 
100
103
  Write data into the timeseries database.
101
104
  ).strip
105
+ c.must_not_be_managed = true
106
+
102
107
  c.option '--[no-]json', %(Display results as raw json)
108
+
103
109
  c.action do |args, options|
104
110
  c.verify_arg_count!(args)
105
111
  options.defalts(json: false)
@@ -119,7 +125,10 @@ This command is deprecated.
119
125
 
120
126
  Execute a non-query command in the database.
121
127
  ).strip
128
+ c.must_not_be_managed = true
129
+
122
130
  c.option '--[no-]json', %(Display results as raw json)
131
+
123
132
  c.action do |args, options|
124
133
  # SKIP: c.verify_arg_count!(args)
125
134
  options.defalts(json: false)
@@ -77,6 +77,7 @@ Units are u (microseconds), ms (milliseconds), s (seconds)
77
77
 
78
78
  Also, many date-time formats can be parsed and will be converted to microseconds
79
79
  ).strip
80
+ c.must_not_be_managed = true
80
81
 
81
82
  c.option '--when TIMESTAMP', %(When this data happened (default: now))
82
83
  # TODO: add option to take data from STDIN.
@@ -131,6 +132,7 @@ Units are u (microseconds), ms (milliseconds), s (seconds)
131
132
 
132
133
  Also, many date-time formats can be parsed and will be converted to microseconds
133
134
  ).strip
135
+ c.must_not_be_managed = true
134
136
 
135
137
  c.option '--start_time TIMESTAMP', %(Start time range)
136
138
  c.option '--end_time TIMESTAMP', %(End time range; defaults to now)
@@ -321,6 +323,7 @@ command 'tsdb list tags' do |c|
321
323
  c.description = %(
322
324
  List tags.
323
325
  ).strip
326
+ c.must_not_be_managed = true
324
327
 
325
328
  c.option '--values', %(Include the known tag values)
326
329
 
@@ -354,6 +357,7 @@ command 'tsdb list metrics' do |c|
354
357
  c.description = %(
355
358
  List metrics.
356
359
  ).strip
360
+ c.must_not_be_managed = true
357
361
 
358
362
  c.action do |args, _options|
359
363
  c.verify_arg_count!(args)
@@ -26,6 +26,7 @@ require 'MrMurano/commands/link'
26
26
  require 'MrMurano/commands/login'
27
27
  require 'MrMurano/commands/logs'
28
28
  require 'MrMurano/commands/mock'
29
+ require 'MrMurano/commands/network'
29
30
  require 'MrMurano/commands/postgresql'
30
31
  require 'MrMurano/commands/password'
31
32
  require 'MrMurano/commands/settings'
@@ -60,5 +60,16 @@ class HashDiggable < DumbDelegator
60
60
  value.dig_safe(*rest)
61
61
  end
62
62
  end
63
+
64
+ def deep_delete(key, *rest)
65
+ if rest.empty?
66
+ delete(key)
67
+ else
68
+ keys = [key] + rest[0..-2]
69
+ target = rest[-1]
70
+ value = dig_safe(*keys)
71
+ value.delete(target) if value.is_a? ::Hash
72
+ end
73
+ end
63
74
  end
64
75
 
@@ -26,7 +26,7 @@ module MrMurano
26
26
  # '3.0.0-beta.2' is changed to '3.0.0.pre.beta.2'
27
27
  # which breaks our build (which expects the version to match herein).
28
28
  # So stick to using the '.pre.X' syntax, which ruby/gems knows.
29
- VERSION = '3.2.0.beta.5'
29
+ VERSION = '3.2.0.beta.8'
30
30
  EXE_NAME = File.basename($PROGRAM_NAME)
31
31
  SIGN_UP_URL = 'https://exosite.com/signup/'
32
32
  end
@@ -237,11 +237,11 @@ RSpec.describe 'murano element', :cmd, :needs_password do
237
237
 
238
238
  it 'as edit with too many fields specified' do
239
239
  stdout, stderr = murano_command_exits(
240
- 'element edit', '-e', "contact=#{rname}", '-e', 'markdown', 'MUR-6407'
240
+ 'element edit', '-e', 'contact', '-e', 'markdown', 'MUR-6407'
241
241
  )
242
242
  expect(stdout).to eq('')
243
243
  expect(stderr).to eq(
244
- %(Please specify at most one field when not specifing all field values.\n)
244
+ %(Please specify at most one field without a value.\n)
245
245
  )
246
246
  end
247
247
 
@@ -12,6 +12,7 @@ curlfancy = false
12
12
  no-page = false
13
13
  no-progress = false
14
14
  show-password = false
15
+ skip-managed = false
15
16
 
16
17
  [net]
17
18
  host = bizapi.hosted.exosite.io
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MuranoCLI
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0.beta.5
4
+ version: 3.2.0.beta.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Conrad Tadpol Tilstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-01 00:00:00.000000000 Z
11
+ date: 2018-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: certified
@@ -466,9 +466,6 @@ files:
466
466
  - ".rspec"
467
467
  - ".rubocop.yml"
468
468
  - ".travis.yml"
469
- - ".trustme.plugin"
470
- - ".trustme.sh"
471
- - ".trustme.vim"
472
469
  - Gemfile
473
470
  - LICENSE.txt
474
471
  - MuranoCLI.gemspec
@@ -488,6 +485,9 @@ files:
488
485
  - dockers/docker-test.sh
489
486
  - dockers/gem-release.sh
490
487
  - docs/basic_example.rst
488
+ - docs/ci/.trustme.plugin
489
+ - docs/ci/.trustme.sh
490
+ - docs/ci/.trustme.vim
491
491
  - docs/completions/murano_completion-bash
492
492
  - docs/demo.md
493
493
  - docs/develop.rst
@@ -546,6 +546,7 @@ files:
546
546
  - lib/MrMurano/commands/login.rb
547
547
  - lib/MrMurano/commands/logs.rb
548
548
  - lib/MrMurano/commands/mock.rb
549
+ - lib/MrMurano/commands/network.rb
549
550
  - lib/MrMurano/commands/password.rb
550
551
  - lib/MrMurano/commands/postgresql.rb
551
552
  - lib/MrMurano/commands/service.rb
File without changes