MuranoCLI 3.2.0.beta.9 → 3.2.1.pre.beta.3

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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/Rakefile +5 -0
  4. data/dockers/README.rst +7 -0
  5. data/dockers/RELEASE.rst +6 -3
  6. data/dockers/docker-test.sh +45 -17
  7. data/docs/completions/murano_completion-bash +211 -86
  8. data/lib/MrMurano/Account.rb +72 -4
  9. data/lib/MrMurano/Business.rb +163 -2
  10. data/lib/MrMurano/Commander-Entry.rb +1 -2
  11. data/lib/MrMurano/Config.rb +19 -18
  12. data/lib/MrMurano/Content.rb +26 -19
  13. data/lib/MrMurano/Gateway.rb +51 -10
  14. data/lib/MrMurano/ReCommander.rb +1 -1
  15. data/lib/MrMurano/Solution-Services.rb +80 -35
  16. data/lib/MrMurano/Solution-Users.rb +1 -0
  17. data/lib/MrMurano/SyncRoot.rb +10 -3
  18. data/lib/MrMurano/SyncUpDown-Core.rb +47 -36
  19. data/lib/MrMurano/SyncUpDown-Item.rb +46 -14
  20. data/lib/MrMurano/SyncUpDown.rb +22 -20
  21. data/lib/MrMurano/Webservice-Endpoint.rb +20 -18
  22. data/lib/MrMurano/Webservice-File.rb +63 -20
  23. data/lib/MrMurano/commands/business.rb +14 -1
  24. data/lib/MrMurano/commands/child.rb +148 -0
  25. data/lib/MrMurano/commands/devices.rb +298 -149
  26. data/lib/MrMurano/commands/element.rb +2 -1
  27. data/lib/MrMurano/commands/globals.rb +3 -0
  28. data/lib/MrMurano/commands/network.rb +152 -33
  29. data/lib/MrMurano/commands/sync.rb +2 -2
  30. data/lib/MrMurano/commands.rb +1 -0
  31. data/lib/MrMurano/verbosing.rb +13 -2
  32. data/lib/MrMurano/version.rb +1 -1
  33. data/spec/Account_spec.rb +43 -11
  34. data/spec/Content_spec.rb +5 -3
  35. data/spec/GatewayBase_spec.rb +1 -1
  36. data/spec/GatewayDevice_spec.rb +47 -8
  37. data/spec/GatewayResource_spec.rb +1 -1
  38. data/spec/GatewaySettings_spec.rb +1 -1
  39. data/spec/HttpAuthed_spec.rb +17 -3
  40. data/spec/ProjectFile_spec.rb +59 -23
  41. data/spec/Setting_spec.rb +2 -1
  42. data/spec/Solution-ServiceConfig_spec.rb +1 -1
  43. data/spec/Solution-ServiceEventHandler_spec.rb +27 -20
  44. data/spec/Solution-ServiceModules_spec.rb +7 -5
  45. data/spec/Solution-UsersRoles_spec.rb +7 -1
  46. data/spec/Solution_spec.rb +9 -1
  47. data/spec/SyncRoot_spec.rb +5 -5
  48. data/spec/SyncUpDown_spec.rb +262 -211
  49. data/spec/Verbosing_spec.rb +49 -8
  50. data/spec/Webservice-Cors_spec.rb +10 -1
  51. data/spec/Webservice-Endpoint_spec.rb +84 -65
  52. data/spec/Webservice-File_spec.rb +16 -11
  53. data/spec/Webservice-Setting_spec.rb +7 -1
  54. data/spec/_workspace.rb +9 -0
  55. data/spec/cmd_business_spec.rb +5 -10
  56. data/spec/cmd_common.rb +67 -32
  57. data/spec/cmd_config_spec.rb +9 -14
  58. data/spec/cmd_content_spec.rb +15 -26
  59. data/spec/cmd_cors_spec.rb +9 -12
  60. data/spec/cmd_device_spec.rb +31 -45
  61. data/spec/cmd_domain_spec.rb +12 -10
  62. data/spec/cmd_element_spec.rb +18 -17
  63. data/spec/cmd_exchange_spec.rb +1 -4
  64. data/spec/cmd_init_spec.rb +56 -72
  65. data/spec/cmd_keystore_spec.rb +17 -26
  66. data/spec/cmd_link_spec.rb +13 -17
  67. data/spec/cmd_password_spec.rb +9 -10
  68. data/spec/cmd_setting_application_spec.rb +95 -68
  69. data/spec/cmd_setting_product_spec.rb +59 -37
  70. data/spec/cmd_status_spec.rb +46 -84
  71. data/spec/cmd_syncdown_application_spec.rb +28 -50
  72. data/spec/cmd_syncdown_both_spec.rb +44 -93
  73. data/spec/cmd_syncdown_unit_spec.rb +858 -0
  74. data/spec/cmd_syncup_spec.rb +21 -56
  75. data/spec/cmd_token_spec.rb +0 -3
  76. data/spec/cmd_usage_spec.rb +15 -10
  77. data/spec/dry_run_formatter.rb +1 -0
  78. data/spec/fixtures/dumped_config +4 -4
  79. data/spec/spec_helper.rb +3 -0
  80. metadata +4 -2
@@ -17,43 +17,41 @@ RSpec.describe 'murano keystore', :cmd, :needs_password do
17
17
  murano_solutions_expunge_yes
18
18
 
19
19
  @product_name = rname('keystoreTest')
20
- out, err, status = Open3.capture3(capcmd('murano', 'application', 'create', @product_name, '--save'))
20
+ out, err = murano_command_run(
21
+ 'solution create', '--type', 'application', @product_name, '--save',
22
+ )
21
23
  expect(err).to eq('')
22
24
  expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
23
- expect(status.exitstatus).to eq(0)
24
25
 
25
- out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'set', 'bob', 'built'))
26
+ out, err = murano_command_run(
27
+ 'keystore set', 'bob', 'built',
28
+ )
26
29
  expect(out.chomp).to eq('')
27
30
  expect(err).to eq('')
28
- expect(status.exitstatus).to eq(0)
29
31
  end
30
32
 
31
33
  after(:example) do
32
- out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @product_name, '-y'))
34
+ out, err = murano_command_run('solution delete', @product_name, '-y')
33
35
  expect(out).to eq('')
34
36
  expect(err).to eq('')
35
- expect(status.exitstatus).to eq(0)
36
37
  end
37
38
 
38
39
  it 'gets' do
39
- out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'get', 'bob'))
40
+ out, err = murano_command_run('keystore get', 'bob')
40
41
  expect(out.chomp).to eq('built')
41
42
  expect(err).to eq('')
42
- expect(status.exitstatus).to eq(0)
43
43
  end
44
44
 
45
45
  it 'lists' do
46
- out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'list'))
46
+ out, err = murano_command_run('keystore list')
47
47
  expect(out.chomp).to eq('bob')
48
48
  expect(err).to eq('')
49
- expect(status.exitstatus).to eq(0)
50
49
  end
51
50
 
52
51
  it 'infos' do
53
- out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'info', '-c', 'outformat=json'))
52
+ out, err = murano_command_run('keystore info', '-c', 'outformat=json')
54
53
  expect { out = JSON.parse(out) }.to_not raise_error
55
54
  expect(err).to eq('')
56
- expect(status.exitstatus).to eq(0)
57
55
  expect(out).to match(
58
56
  'quota' => { 'keys' => a_kind_of(Integer) },
59
57
  'usage' => { 'keys' => 1, 'size' => a_kind_of(Integer) },
@@ -61,44 +59,37 @@ RSpec.describe 'murano keystore', :cmd, :needs_password do
61
59
  end
62
60
 
63
61
  it 'deletes', :club_10s do
64
- out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'delete', 'bob'))
62
+ out, err = murano_command_run('keystore delete', 'bob')
65
63
  expect(out.chomp).to eq('')
66
64
  expect(err).to eq('')
67
- expect(status.exitstatus).to eq(0)
68
65
 
69
- out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'list'))
66
+ out, err = murano_command_run('keystore list')
70
67
  expect(out.chomp).to eq('')
71
68
  expect(err).to eq('')
72
- expect(status.exitstatus).to eq(0)
73
69
  end
74
70
 
75
71
  it 'clearAll', :club_10s do
76
- out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'set', 'another', 'value'))
72
+ out, err = murano_command_run('keystore set', 'another', 'value')
77
73
  expect(out.chomp).to eq('')
78
74
  expect(err).to eq('')
79
- expect(status.exitstatus).to eq(0)
80
75
 
81
- out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'clearAll'))
76
+ out, err = murano_command_run('keystore clearAll')
82
77
  expect(out.chomp).to eq('')
83
78
  expect(err).to eq('')
84
- expect(status.exitstatus).to eq(0)
85
79
 
86
- out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'list'))
80
+ out, err = murano_command_run('keystore list')
87
81
  expect(out.chomp).to eq('')
88
82
  expect(err).to eq('')
89
- expect(status.exitstatus).to eq(0)
90
83
  end
91
84
 
92
85
  it 'can call other commands', :club_10s do
93
- out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'command', 'lpush', 'another', 'value'))
86
+ out, err = murano_command_run('keystore command', 'lpush', 'another', 'value')
94
87
  expect(out.chomp).to eq('1')
95
88
  expect(err).to eq('')
96
- expect(status.exitstatus).to eq(0)
97
89
 
98
- out, err, status = Open3.capture3(capcmd('murano', 'keystore', 'command', 'rpop', 'another'))
90
+ out, err = murano_command_run('keystore command', 'rpop', 'another')
99
91
  expect(out.chomp).to eq('value')
100
92
  expect(err).to eq('')
101
- expect(status.exitstatus).to eq(0)
102
93
  end
103
94
  end
104
95
 
@@ -38,12 +38,9 @@ RSpec.describe 'murano link', :cmd, :needs_password do
38
38
  it 'will not list' do
39
39
  # Because we run from the context of the rspec command, the :env
40
40
  # config file will have loaded, so business.id will not be set.
41
- stdout, stderr = murano_command_run('link list')
42
- expect(stdout).to eq(
43
- %(Please change to a project directory, or run `murano init` to create a new project.\n)
44
- )
41
+ _stdout, stderr = murano_command_exits('link list')
45
42
  expect(stderr).to eq(
46
- %(The "link list" command only works in a Murano project.\n)
43
+ %(No applications found\nNo service links found\n)
47
44
  )
48
45
  end
49
46
  end
@@ -51,33 +48,34 @@ RSpec.describe 'murano link', :cmd, :needs_password do
51
48
  end
52
49
 
53
50
  context 'with project' do
54
- before(:example) { project_up(skip_link: true) }
55
- after(:example) { project_down }
51
+ before(:example) do
52
+ project_up(skip_link: true)
53
+ end
54
+
55
+ after(:example) do
56
+ project_down
57
+ end
56
58
 
57
59
  it 'links and lists', :club_20s, :club_10s do
58
- out, err, status = Open3.capture3(capcmd('murano', 'assign', 'set'))
60
+ out, err = murano_command_run('assign set')
59
61
  olines = out.lines
60
-
61
62
  expect(strip_fancy(olines[0])).to eq(
62
63
  "Linked '#{@proj_name_prod}' to '#{@proj_name_appy}'\n"
63
64
  )
64
-
65
65
  expect(olines[1]).to eq("Created default event handler\n")
66
66
  expect(err).to eq('')
67
- expect(status.exitstatus).to eq(0)
68
67
 
69
- out, err, status = Open3.capture3(capcmd('murano', 'assign', 'list'))
68
+ out, err = murano_command_run('assign list')
70
69
  expect(err).to eq('')
71
70
  olines = out.lines
72
71
  expect(olines[0]).to match(/^(\+-+){3}\+$/)
73
72
  expect(olines[1]).to match(/^\| name\s+\| script_key\s+\| service\s+\|$/)
74
73
  expect(olines[2]).to match(/^(\+-+){3}\+$/)
75
74
  expect(olines[-1]).to match(/^(\+-+){3}\+$/)
76
- expect(status.exitstatus).to eq(0)
77
75
  end
78
76
 
79
77
  it 'unlinks', :club_20s, :club_10s do
80
- out, err, status = Open3.capture3(capcmd('murano', 'assign', 'set'))
78
+ out, err = murano_command_run('assign set')
81
79
  #expect(out).to a_string_starting_with("Linked product #{@solz_name}")
82
80
  olines = out.lines
83
81
  expect(strip_fancy(olines[0])).to eq(
@@ -85,9 +83,8 @@ RSpec.describe 'murano link', :cmd, :needs_password do
85
83
  )
86
84
  expect(olines[1]).to eq("Created default event handler\n")
87
85
  expect(err).to eq('')
88
- expect(status.exitstatus).to eq(0)
89
86
 
90
- out, err, status = Open3.capture3(capcmd('murano', 'link', 'unset'))
87
+ out, err = murano_command_run('link unset')
91
88
  #expect(out).to a_string_starting_with("Unlinked #{@solz_name}")
92
89
  # E.g.,
93
90
  # Unlinked ‘linktest3e7def1b86a1d680’ from ‘linktest3e7def1b86a1d680’\n
@@ -102,7 +99,6 @@ RSpec.describe 'murano link', :cmd, :needs_password do
102
99
  /^Removed '[_a-z0-9]*' from '#{@proj_name_appy}'\n$/
103
100
  )
104
101
  expect(err).to eq('')
105
- expect(status.exitstatus).to eq(0)
106
102
  end
107
103
  end
108
104
  end
@@ -13,22 +13,22 @@ RSpec.describe 'murano password', :cmd do
13
13
  include_context 'CI_CMD'
14
14
 
15
15
  it 'Lists when no file' do
16
- out, err, status = Open3.capture3(capcmd('murano', 'password', 'list'))
16
+ out, err = murano_command_run('password list')
17
17
  expect(err).to eq('')
18
18
  olines = out.lines
19
19
  expect(olines[0]).to match(/^(\+-+){2}\+$/)
20
20
  expect(olines[1]).to match(/^\| Host\s+\| Username\s+\|$/)
21
21
  expect(olines[2]).to match(/^(\+-+){2}\+$/)
22
- expect(status.exitstatus).to eq(0)
23
22
  end
24
23
 
25
24
  it 'sets a password' do
26
- out, err, status = Open3.capture3(capcmd('murano', 'password', 'set', 'bob@bob.bob', 'an.API.host.i', '--password', 'bad'))
25
+ out, err = murano_command_run(
26
+ 'password set', 'bob@bob.bob', 'an.API.host.i', '--password', 'bad',
27
+ )
27
28
  expect(err).to eq('')
28
29
  expect(out).to eq('')
29
- expect(status.exitstatus).to eq(0)
30
30
 
31
- out, err, status = Open3.capture3(capcmd('murano', 'password', 'list'))
31
+ out, err = murano_command_run('password list')
32
32
  expect(err).to eq('')
33
33
  olines = out.lines
34
34
  expect(olines[0]).to match(/^(\+-+){2}\+$/)
@@ -36,7 +36,6 @@ RSpec.describe 'murano password', :cmd do
36
36
  expect(olines[2]).to match(/^(\+-+){2}\+$/)
37
37
  expect(olines[3]).to match(/^\| an.API.host.i\s+\| bob@bob\.bob\s+\|$/)
38
38
  expect(olines[4]).to match(/^(\+-+){2}\+$/)
39
- expect(status.exitstatus).to eq(0)
40
39
  end
41
40
 
42
41
  it 'deletes a password' do
@@ -46,12 +45,13 @@ RSpec.describe 'murano password', :cmd do
46
45
  io << " bob@bob.bob: badpassword\n"
47
46
  io << " rich@er.u: notbetter\n"
48
47
  end
49
- out, err, status = Open3.capture3(capcmd('murano', 'password', 'delete', 'rich@er.u', 'an.API.host.i', '-y'))
48
+ out, err = murano_command_run(
49
+ 'password delete', 'rich@er.u', 'an.API.host.i', '-y',
50
+ )
50
51
  expect(err).to eq('')
51
52
  expect(out).to eq('')
52
- expect(status.exitstatus).to eq(0)
53
53
 
54
- out, err, status = Open3.capture3(capcmd('murano', 'password', 'list'))
54
+ out, err = murano_command_run('password list')
55
55
  expect(err).to eq('')
56
56
  olines = out.lines
57
57
  expect(olines[0]).to match(/^(\+-+){2}\+$/)
@@ -59,7 +59,6 @@ RSpec.describe 'murano password', :cmd do
59
59
  expect(olines[2]).to match(/^(\+-+){2}\+$/)
60
60
  expect(olines[3]).to match(/^\| an.API.host.i\s+\| bob@bob\.bob\s+\|$/)
61
61
  expect(olines[4]).to match(/^(\+-+){2}\+$/)
62
- expect(status.exitstatus).to eq(0)
63
62
  end
64
63
  end
65
64
 
@@ -18,40 +18,43 @@ RSpec.describe 'murano application setting', :cmd, :needs_password do
18
18
  murano_solutions_expunge_yes
19
19
 
20
20
  @product_name = rname('settingtest')
21
- out, err, status = Open3.capture3(capcmd('murano', 'application', 'create', @product_name, '--save'))
21
+ out, err = murano_command_run(
22
+ 'solution create', '--type', 'application', @product_name, '--save',
23
+ )
22
24
  expect(err).to eq('')
23
25
  expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
24
- expect(status.exitstatus).to eq(0)
25
26
  end
26
27
 
27
28
  after(:example) do
28
- out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @product_name, '-y'))
29
+ out, err = murano_command_run('solution delete', @product_name, '-y')
29
30
  expect(out).to eq('')
30
31
  expect(err).to eq('')
31
- expect(status.exitstatus).to eq(0)
32
32
  end
33
33
 
34
34
  it 'reads Webservice.cors' do
35
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
35
+ out, err = murano_command_run(
36
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
37
+ )
36
38
  expect { JSON.parse(out) }.to_not raise_error
37
39
  expect(err).to eq('')
38
- expect(status.exitstatus).to eq(0)
39
40
  end
40
41
 
41
42
  it 'reads Webservice.cors to a file' do
42
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-o', 'testout', '-c', 'outformat=json'))
43
+ out, err = murano_command_run(
44
+ 'setting read', 'Webservice.cors', '-o', 'testout', '-c', 'outformat=json',
45
+ )
43
46
  expect(err).to eq('')
44
47
  expect(out).to eq('')
45
- expect(status.exitstatus).to eq(0)
46
48
  expect(File.exist?('testout')).to be true
47
49
  end
48
50
 
49
51
  context 'Writes (using Webservice.cors)' do
50
52
  before(:example) do
51
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
53
+ out, err = murano_command_run(
54
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
55
+ )
52
56
  expect { @json_before = JSON.parse(out) }.to_not raise_error
53
57
  expect(err).to eq('')
54
- expect(status.exitstatus).to eq(0)
55
58
  end
56
59
  # {'origin'=>true,
57
60
  # 'methods'=>['HEAD', 'GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
@@ -60,172 +63,191 @@ RSpec.describe 'murano application setting', :cmd, :needs_password do
60
63
 
61
64
  context 'a bool value' do
62
65
  it 'Yes', :club_10s do
63
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'origin', '--bool', 'Yes'))
66
+ out, err = murano_command_run(
67
+ 'setting write', 'Webservice.cors', 'origin', '--bool', 'Yes',
68
+ )
64
69
  expect(err).to eq('')
65
70
  expect(out).to eq('')
66
- expect(status.exitstatus).to eq(0)
67
71
 
68
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
72
+ out, err = murano_command_run(
73
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
74
+ )
69
75
  json_after = nil
70
76
  expect { json_after = JSON.parse(out) }.to_not raise_error
71
77
  expect(err).to eq('')
72
- expect(status.exitstatus).to eq(0)
73
78
  @json_before['origin'] = true
74
79
  expect(json_after).to match(@json_before)
75
80
  end
76
81
 
77
82
  it 'true', :club_10s do
78
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'origin', '--bool', 'true'))
83
+ out, err = murano_command_run(
84
+ 'setting write', 'Webservice.cors', 'origin', '--bool', 'true',
85
+ )
79
86
  expect(err).to eq('')
80
87
  expect(out).to eq('')
81
- expect(status.exitstatus).to eq(0)
82
88
 
83
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
89
+ out, err = murano_command_run(
90
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
91
+ )
84
92
  json_after = nil
85
93
  expect { json_after = JSON.parse(out) }.to_not raise_error
86
94
  expect(err).to eq('')
87
- expect(status.exitstatus).to eq(0)
88
95
  @json_before['origin'] = true
89
96
  expect(json_after).to match(@json_before)
90
97
  end
91
98
 
92
99
  it 'on', :club_30s, :club_20s, :club_10s do
93
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'origin', '--bool', 'on'))
100
+ out, err = murano_command_run(
101
+ 'setting write', 'Webservice.cors', 'origin', '--bool', 'on',
102
+ )
94
103
  expect(err).to eq('')
95
104
  expect(out).to eq('')
96
- expect(status.exitstatus).to eq(0)
97
105
 
98
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
106
+ out, err = murano_command_run(
107
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
108
+ )
99
109
  json_after = nil
100
110
  expect { json_after = JSON.parse(out) }.to_not raise_error
101
111
  expect(err).to eq('')
102
- expect(status.exitstatus).to eq(0)
103
112
  @json_before['origin'] = true
104
113
  expect(json_after).to match(@json_before)
105
114
  end
106
115
 
107
116
  it '1', :club_10s do
108
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'origin', '--bool', '1'))
117
+ out, err = murano_command_run(
118
+ 'setting write', 'Webservice.cors', 'origin', '--bool', '1',
119
+ )
109
120
  expect(err).to eq('')
110
121
  expect(out).to eq('')
111
- expect(status.exitstatus).to eq(0)
112
122
 
113
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
123
+ out, err = murano_command_run(
124
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
125
+ )
114
126
  json_after = nil
115
127
  expect { json_after = JSON.parse(out) }.to_not raise_error
116
128
  expect(err).to eq('')
117
- expect(status.exitstatus).to eq(0)
118
129
  @json_before['origin'] = true
119
130
  expect(json_after).to match(@json_before)
120
131
  end
121
132
 
122
133
  it 'bob', :club_10s do
123
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'origin', '--bool', 'bob'))
124
- expect(err).to eq("\e[31mValue \"bob\" is not a bool type!\e[0m\n")
134
+ out, err = murano_command_exits(
135
+ 'setting write', 'Webservice.cors', 'origin', '--bool', 'bob',
136
+ )
137
+ expect(err).to eq("Value \"bob\" is not a bool type!\n")
125
138
  expect(out).to eq('')
126
- expect(status.exitstatus).to eq(2)
127
139
  end
128
140
 
129
141
  it 'No', :club_10s do
130
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'origin', '--bool', 'No'))
142
+ out, err = murano_command_run(
143
+ 'setting write', 'Webservice.cors', 'origin', '--bool', 'No',
144
+ )
131
145
  expect(err).to eq('')
132
146
  expect(out).to eq('')
133
- expect(status.exitstatus).to eq(0)
134
147
 
135
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
148
+ out, err = murano_command_run(
149
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
150
+ )
136
151
  json_after = nil
137
152
  expect { json_after = JSON.parse(out) }.to_not raise_error
138
153
  expect(err).to eq('')
139
- expect(status.exitstatus).to eq(0)
140
154
  @json_before['origin'] = false
141
155
  expect(json_after).to match(@json_before)
142
156
  end
143
157
 
144
158
  it 'false', :club_10s do
145
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'origin', '--bool', 'false'))
159
+ out, err = murano_command_run(
160
+ 'setting write', 'Webservice.cors', 'origin', '--bool', 'false',
161
+ )
146
162
  expect(err).to eq('')
147
163
  expect(out).to eq('')
148
- expect(status.exitstatus).to eq(0)
149
164
 
150
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
165
+ out, err = murano_command_run(
166
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
167
+ )
151
168
  json_after = nil
152
169
  expect { json_after = JSON.parse(out) }.to_not raise_error
153
170
  expect(err).to eq('')
154
- expect(status.exitstatus).to eq(0)
155
171
  @json_before['origin'] = false
156
172
  expect(json_after).to match(@json_before)
157
173
  end
158
174
 
159
175
  it 'off', :club_10s do
160
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'origin', '--bool', 'Off'))
176
+ out, err = murano_command_run(
177
+ 'setting write', 'Webservice.cors', 'origin', '--bool', 'Off',
178
+ )
161
179
  expect(err).to eq('')
162
180
  expect(out).to eq('')
163
- expect(status.exitstatus).to eq(0)
164
181
 
165
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
182
+ out, err = murano_command_run(
183
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
184
+ )
166
185
  json_after = nil
167
186
  expect { json_after = JSON.parse(out) }.to_not raise_error
168
187
  expect(err).to eq('')
169
- expect(status.exitstatus).to eq(0)
170
188
  @json_before['origin'] = false
171
189
  expect(json_after).to match(@json_before)
172
190
  end
173
191
 
174
192
  it '0', :club_30s, :club_20s, :club_10s do
175
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'origin', '--bool', '0'))
193
+ out, err = murano_command_run(
194
+ 'setting write', 'Webservice.cors', 'origin', '--bool', '0',
195
+ )
176
196
  expect(err).to eq('')
177
197
  expect(out).to eq('')
178
- expect(status.exitstatus).to eq(0)
179
198
 
180
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
199
+ out, err = murano_command_run(
200
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
201
+ )
181
202
  json_after = nil
182
203
  expect { json_after = JSON.parse(out) }.to_not raise_error
183
204
  expect(err).to eq('')
184
- expect(status.exitstatus).to eq(0)
185
205
  @json_before['origin'] = false
186
206
  expect(json_after).to match(@json_before)
187
207
  end
188
208
 
189
209
  it 'on STDIN', :club_10s do
190
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'origin', '--bool'), stdin_data: 'true')
210
+ # FIXME: (lb): Replace capcmd with murano_command_run (need to handle stdin_data).
211
+ out, err, status = Open3.capture3(capcmd(
212
+ 'murano', 'setting', 'write', 'Webservice.cors', 'origin', '--bool'
213
+ ), stdin_data: 'true')
191
214
  expect(err).to eq('')
192
215
  expect(out).to eq('')
193
216
  expect(status.exitstatus).to eq(0)
194
217
 
195
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
218
+ out, err = murano_command_run(
219
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
220
+ )
196
221
  json_after = nil
197
222
  expect { json_after = JSON.parse(out) }.to_not raise_error
198
223
  expect(err).to eq('')
199
- expect(status.exitstatus).to eq(0)
200
224
  @json_before['origin'] = true
201
225
  expect(json_after).to match(@json_before)
202
226
  end
203
227
  end
204
228
 
205
229
  it 'a json array blob', :club_10s do
206
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'headers', '--json', '["fidget", "forgotten", "tokens"]'))
230
+ out, err = murano_command_run(
231
+ 'setting write', 'Webservice.cors', 'headers', '--json', '--', '["fidget", "forgotten", "tokens"]',
232
+ )
207
233
  expect(err).to eq('')
208
234
  expect(out).to eq('')
209
- expect(status.exitstatus).to eq(0)
210
235
 
211
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
236
+ out, err = murano_command_run(
237
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
238
+ )
212
239
  json_after = nil
213
240
  expect { json_after = JSON.parse(out) }.to_not raise_error
214
241
  expect(err).to eq('')
215
- expect(status.exitstatus).to eq(0)
216
242
  @json_before['headers'] = %w[fidget forgotten tokens]
217
243
  expect(json_after).to match(@json_before)
218
244
  end
219
245
 
220
246
  it 'a json array blob with STDIN', :club_10s do
247
+ # FIXME: (lb): Replace capcmd with murano_command_run (need to handle stdin_data).
221
248
  out, err, status = Open3.capture3(
222
249
  capcmd(
223
- 'murano',
224
- 'setting',
225
- 'write',
226
- 'Webservice.cors',
227
- 'headers',
228
- '--json'
250
+ 'murano', 'setting', 'write', 'Webservice.cors', 'headers', '--json',
229
251
  ),
230
252
  stdin_data: '["fidget", "forgotten", "tokens"]'
231
253
  )
@@ -233,41 +255,46 @@ RSpec.describe 'murano application setting', :cmd, :needs_password do
233
255
  expect(out).to eq('')
234
256
  expect(status.exitstatus).to eq(0)
235
257
 
236
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
258
+ out, err = murano_command_run(
259
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
260
+ )
237
261
  json_after = nil
238
262
  expect { json_after = JSON.parse(out) }.to_not raise_error
239
263
  expect(err).to eq('')
240
- expect(status.exitstatus).to eq(0)
241
264
  @json_before['headers'] = %w[fidget forgotten tokens]
242
265
  expect(json_after).to match(@json_before)
243
266
  end
244
267
 
245
268
  it 'an array', :club_10s do
246
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'headers', '--array', 'fidget', 'forgotten', 'tokens'))
269
+ out, err = murano_command_run(
270
+ 'setting write', 'Webservice.cors', 'headers', '--array', 'fidget', 'forgotten', 'tokens',
271
+ )
247
272
  expect(err).to eq('')
248
273
  expect(out).to eq('')
249
- expect(status.exitstatus).to eq(0)
250
274
 
251
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
275
+ out, err = murano_command_run(
276
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
277
+ )
252
278
  json_after = nil
253
279
  expect { json_after = JSON.parse(out) }.to_not raise_error
254
280
  expect(err).to eq('')
255
- expect(status.exitstatus).to eq(0)
256
281
  @json_before['headers'] = %w[fidget forgotten tokens]
257
282
  expect(json_after).to match(@json_before)
258
283
  end
259
284
 
260
285
  it 'appends an array', :club_10s do
261
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'write', 'Webservice.cors', 'headers', '--array', '--append', 'fidget', 'forgotten', 'tokens'))
286
+ out, err = murano_command_run(
287
+ 'setting write', 'Webservice.cors', 'headers', '--array', '--append', 'fidget', 'forgotten', 'tokens',
288
+ )
262
289
  expect(err).to eq('')
263
290
  expect(out).to eq('')
264
- expect(status.exitstatus).to eq(0)
265
291
 
266
- out, err, status = Open3.capture3(capcmd('murano', 'setting', 'read', 'Webservice.cors', '-c', 'outformat=json'))
292
+ out, err = murano_command_run(
293
+ 'setting read', 'Webservice.cors', '-c', 'outformat=json',
294
+ )
267
295
  json_after = nil
268
296
  expect { json_after = JSON.parse(out) }.to_not raise_error
269
297
  expect(err).to eq('')
270
- expect(status.exitstatus).to eq(0)
271
298
  @json_before['headers'] = @json_before['headers'] + %w[fidget forgotten tokens]
272
299
  expect(json_after).to match(@json_before)
273
300
  end