morpheus-cli 3.6.12 → 3.6.13
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/clouds_interface.rb +2 -2
- data/lib/morpheus/cli/account_groups_command.rb +84 -106
- data/lib/morpheus/cli/apps.rb +12 -11
- data/lib/morpheus/cli/archives_command.rb +2 -9
- data/lib/morpheus/cli/blueprints_command.rb +0 -8
- data/lib/morpheus/cli/boot_scripts_command.rb +3 -6
- data/lib/morpheus/cli/cli_command.rb +6 -2
- data/lib/morpheus/cli/cloud_datastores_command.rb +2 -5
- data/lib/morpheus/cli/clouds.rb +9 -10
- data/lib/morpheus/cli/commands/standard/history_command.rb +7 -3
- data/lib/morpheus/cli/containers_command.rb +0 -1
- data/lib/morpheus/cli/cypher_command.rb +0 -2
- data/lib/morpheus/cli/deployments.rb +6 -5
- data/lib/morpheus/cli/deploys.rb +0 -2
- data/lib/morpheus/cli/groups.rb +7 -10
- data/lib/morpheus/cli/hosts.rb +7 -4
- data/lib/morpheus/cli/image_builder_command.rb +1 -7
- data/lib/morpheus/cli/instances.rb +26 -40
- data/lib/morpheus/cli/key_pairs.rb +2 -2
- data/lib/morpheus/cli/library_option_lists_command.rb +13 -19
- data/lib/morpheus/cli/library_option_types_command.rb +2 -2
- data/lib/morpheus/cli/license.rb +0 -1
- data/lib/morpheus/cli/load_balancers.rb +1 -2
- data/lib/morpheus/cli/mixins/accounts_helper.rb +4 -12
- data/lib/morpheus/cli/mixins/print_helper.rb +53 -2
- data/lib/morpheus/cli/mixins/processes_helper.rb +0 -1
- data/lib/morpheus/cli/mixins/whoami_helper.rb +0 -1
- data/lib/morpheus/cli/monitoring_contacts_command.rb +0 -1
- data/lib/morpheus/cli/network_domains_command.rb +1 -4
- data/lib/morpheus/cli/network_groups_command.rb +2 -5
- data/lib/morpheus/cli/network_pool_servers_command.rb +2 -5
- data/lib/morpheus/cli/network_pools_command.rb +2 -5
- data/lib/morpheus/cli/network_proxies_command.rb +2 -5
- data/lib/morpheus/cli/network_services_command.rb +2 -5
- data/lib/morpheus/cli/networks_command.rb +2 -5
- data/lib/morpheus/cli/old_cypher_command.rb +0 -2
- data/lib/morpheus/cli/policies_command.rb +1 -4
- data/lib/morpheus/cli/preseed_scripts_command.rb +2 -5
- data/lib/morpheus/cli/remote.rb +3 -4
- data/lib/morpheus/cli/roles.rb +5 -5
- data/lib/morpheus/cli/security_group_rules.rb +0 -1
- data/lib/morpheus/cli/security_groups.rb +0 -1
- data/lib/morpheus/cli/shell.rb +89 -38
- data/lib/morpheus/cli/storage_providers_command.rb +2 -5
- data/lib/morpheus/cli/tasks.rb +2 -3
- data/lib/morpheus/cli/users.rb +1 -1
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli/virtual_images.rb +4 -7
- data/lib/morpheus/cli/whoami.rb +1 -1
- data/lib/morpheus/cli/workflows.rb +0 -2
- data/lib/morpheus/formatters.rb +17 -0
- data/lib/morpheus/logging.rb +17 -7
- data/morpheus-cli.gemspec +0 -1
- metadata +2 -16
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rest_client'
|
2
2
|
require 'optparse'
|
3
3
|
require 'filesize'
|
4
|
-
require 'table_print'
|
5
4
|
require 'morpheus/cli/cli_command'
|
6
5
|
|
7
6
|
class Morpheus::Cli::PreseedScriptsCommand
|
@@ -369,12 +368,10 @@ class Morpheus::Cli::PreseedScriptsCommand
|
|
369
368
|
elsif preseed_scripts.size > 1
|
370
369
|
print_red_alert "#{preseed_scripts.size} preseed scripts found by name #{name}"
|
371
370
|
# print_preseed_scripts_table(preseed_scripts, {color: red})
|
372
|
-
rows = preseed_scripts.collect do |
|
371
|
+
rows = preseed_scripts.collect do |it|
|
373
372
|
{id: it['id'], name: it['fileName']}
|
374
373
|
end
|
375
|
-
|
376
|
-
tp rows, [:id, :name]
|
377
|
-
print reset,"\n"
|
374
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
378
375
|
return nil
|
379
376
|
else
|
380
377
|
return preseed_scripts[0]
|
data/lib/morpheus/cli/remote.rb
CHANGED
@@ -71,10 +71,9 @@ EOT
|
|
71
71
|
print reset, "\n"
|
72
72
|
else
|
73
73
|
print cyan
|
74
|
-
#tp rows, {:active => {:display_name => ""}}, {:name => {:width => 16}}, {:host => {:width => 40}}
|
75
74
|
columns = [
|
76
|
-
{:active => {:display_name => "", :display_method => lambda {|it| it[:active] ? "=>" : "" } } },
|
77
|
-
{:name => {:width => 16} },
|
75
|
+
#{:active => {:display_name => "", :display_method => lambda {|it| it[:active] ? "=>" : "" } } },
|
76
|
+
{:name => {display_method: lambda {|it| it[:active] ? "#{green}#{it[:name]}#{reset}#{cyan}" : it[:name] }, :width => 16 } },
|
78
77
|
{:url => {display_method: lambda {|it| it[:host] || it[:url] }, :width => 40 } },
|
79
78
|
{:version => lambda {|it| it[:build_version] } },
|
80
79
|
{:status => lambda {|it| format_appliance_status(it, cyan) } },
|
@@ -86,7 +85,7 @@ EOT
|
|
86
85
|
print reset
|
87
86
|
if @appliance_name
|
88
87
|
#unless appliances.keys.size == 1
|
89
|
-
print cyan, "\n# => Currently using #{@appliance_name}\n", reset
|
88
|
+
print cyan, "\n# => Currently using remote #{green}#{@appliance_name}#{reset}\n", reset
|
90
89
|
#end
|
91
90
|
else
|
92
91
|
print "\n# => No current remote appliance, see `remote use`\n", reset
|
data/lib/morpheus/cli/roles.rb
CHANGED
@@ -200,7 +200,7 @@ class Morpheus::Cli::Roles
|
|
200
200
|
access: get_access_string(it['access']),
|
201
201
|
}
|
202
202
|
end
|
203
|
-
|
203
|
+
print as_pretty_table(rows, [:code, :name, :access], options)
|
204
204
|
else
|
205
205
|
puts "Use --feature-access to list feature access"
|
206
206
|
end
|
@@ -216,7 +216,7 @@ class Morpheus::Cli::Roles
|
|
216
216
|
access: get_access_string(it['access']),
|
217
217
|
}
|
218
218
|
end
|
219
|
-
|
219
|
+
print as_pretty_table(rows, [:name, :access], options)
|
220
220
|
else
|
221
221
|
puts "Use --group-access to list custom access"
|
222
222
|
end
|
@@ -233,7 +233,7 @@ class Morpheus::Cli::Roles
|
|
233
233
|
access: get_access_string(it['access']),
|
234
234
|
}
|
235
235
|
end
|
236
|
-
|
236
|
+
print as_pretty_table(rows, [:name, :access], options)
|
237
237
|
else
|
238
238
|
puts "Use --cloud-access to list custom access"
|
239
239
|
end
|
@@ -250,7 +250,7 @@ class Morpheus::Cli::Roles
|
|
250
250
|
access: get_access_string(it['access']),
|
251
251
|
}
|
252
252
|
end
|
253
|
-
|
253
|
+
print as_pretty_table(rows, [:name, :access], options)
|
254
254
|
else
|
255
255
|
puts "Use --instance-type-access to list custom access"
|
256
256
|
end
|
@@ -269,7 +269,7 @@ class Morpheus::Cli::Roles
|
|
269
269
|
access: get_access_string(it['access']),
|
270
270
|
}
|
271
271
|
end
|
272
|
-
|
272
|
+
print as_pretty_table(rows, [:name, :access], options)
|
273
273
|
else
|
274
274
|
puts "Use --blueprint-access to list custom access"
|
275
275
|
end
|
data/lib/morpheus/cli/shell.rb
CHANGED
@@ -246,10 +246,10 @@ class Morpheus::Cli::Shell
|
|
246
246
|
# logs entire input as one command in shell history
|
247
247
|
# logging is skipped for certain commands: exit, !, !!
|
248
248
|
def execute(input)
|
249
|
-
|
250
|
-
unless input.strip.empty? || (["exit"].include?(input.strip)) || input.strip[0].to_s.chr == "!"
|
249
|
+
unless input.strip.empty? || input.strip[0] == "!"
|
251
250
|
log_history_command(input.strip)
|
252
251
|
end
|
252
|
+
result = execute_commands_as_expression(input)
|
253
253
|
return result
|
254
254
|
end
|
255
255
|
|
@@ -331,7 +331,7 @@ class Morpheus::Cli::Shell
|
|
331
331
|
|
332
332
|
if input == 'exit'
|
333
333
|
#print cyan,"Goodbye\n",reset
|
334
|
-
|
334
|
+
#@history_logger.info "exit" if @history_logger
|
335
335
|
@exit_now_please = true
|
336
336
|
return 0
|
337
337
|
#exit 0
|
@@ -620,7 +620,41 @@ class Morpheus::Cli::Shell
|
|
620
620
|
return logger
|
621
621
|
end
|
622
622
|
|
623
|
-
def load_history_from_log_file
|
623
|
+
def load_history_from_log_file
|
624
|
+
|
625
|
+
# @history ||= {}
|
626
|
+
# @last_command_number ||= 0
|
627
|
+
@history = {}
|
628
|
+
@last_command_number = 0
|
629
|
+
|
630
|
+
begin
|
631
|
+
file_path = history_file_path
|
632
|
+
FileUtils.mkdir_p(File.dirname(file_path))
|
633
|
+
|
634
|
+
File.open(file_path).each_line do |line|
|
635
|
+
# this is pretty goofy, but this looks for the format: (cmd $command_number) $command_string
|
636
|
+
matches = line.match(/\(cmd (\d+)\) (.+)/)
|
637
|
+
if matches && matches.size == 3
|
638
|
+
cmd_number = matches[1].to_i
|
639
|
+
cmd = matches[2]
|
640
|
+
|
641
|
+
@last_command_number = cmd_number
|
642
|
+
@history[@last_command_number] = cmd
|
643
|
+
|
644
|
+
# for Ctrl+R history searching
|
645
|
+
Readline::HISTORY << cmd
|
646
|
+
end
|
647
|
+
end
|
648
|
+
rescue => e
|
649
|
+
# raise e
|
650
|
+
puts_error "failed to load history from log: #{e}"
|
651
|
+
@history ||= {}
|
652
|
+
end
|
653
|
+
return @history
|
654
|
+
end
|
655
|
+
|
656
|
+
# remove this..
|
657
|
+
def _old_load_history_from_log_file(n_commands=1000)
|
624
658
|
@history ||= {}
|
625
659
|
@last_command_number ||= 0
|
626
660
|
|
@@ -659,8 +693,10 @@ class Morpheus::Cli::Shell
|
|
659
693
|
end
|
660
694
|
|
661
695
|
def log_history_command(cmd)
|
662
|
-
|
663
|
-
|
696
|
+
load_history_from_log_file if !@history
|
697
|
+
#todo: a fast log_history_command, that doesnt need to load the file..
|
698
|
+
#@history ||= {}
|
699
|
+
#@last_command_number ||= 0
|
664
700
|
previous_cmd = @history[@last_command_number]
|
665
701
|
# skip logging consecutive history commands.
|
666
702
|
if previous_cmd && previous_cmd =~ /history/ && previous_cmd == cmd
|
@@ -674,7 +710,7 @@ class Morpheus::Cli::Shell
|
|
674
710
|
return @last_command_number
|
675
711
|
end
|
676
712
|
|
677
|
-
def last_command
|
713
|
+
def last_command
|
678
714
|
if @history && @last_command_number
|
679
715
|
@history[@last_command_number]
|
680
716
|
else
|
@@ -686,49 +722,54 @@ class Morpheus::Cli::Shell
|
|
686
722
|
# the most recent 25 are returned by default.
|
687
723
|
# @return Hash like {:commands => [], :command_count => total}
|
688
724
|
def load_history_commands(options={})
|
689
|
-
options[:phrase]
|
690
|
-
|
691
|
-
options[:direction]
|
692
|
-
|
693
|
-
|
725
|
+
phrase = options[:phrase]
|
726
|
+
sort = options[:sort] ? options[:sort].to_sym : :number
|
727
|
+
direction = options[:direction] == 'desc' ? 'desc' : 'asc'
|
728
|
+
offset = options[:offset].to_i > 0 ? options[:offset].to_i : 0
|
729
|
+
max = options[:max].to_i > 0 ? options[:max].to_i : 25
|
730
|
+
|
731
|
+
if !@history
|
732
|
+
load_history_from_log_file
|
733
|
+
end
|
694
734
|
|
695
|
-
load_history_from_log_file if !@history
|
696
735
|
|
697
736
|
# collect records as [{:number => 1, :command => "instances list"}, etc]
|
698
737
|
history_records = []
|
699
738
|
history_count = 0
|
700
|
-
|
739
|
+
|
740
|
+
# sort is a bit different for this command, the default sort is by number
|
741
|
+
# it sorts oldest -> newest, but shows the very last page by default.
|
742
|
+
sort_key = :number
|
743
|
+
if sort.to_sym == :command
|
701
744
|
sort_key = :command
|
702
|
-
else
|
703
|
-
sort_key = :number
|
704
745
|
end
|
705
|
-
|
746
|
+
|
747
|
+
if phrase || sort_key != :number
|
706
748
|
# this could be a large object...need to index our shell_history file lol
|
707
749
|
history_records = @history.keys.collect { |k| {number: k, command: @history[k]} }
|
708
|
-
|
709
|
-
|
710
|
-
|
750
|
+
if direction == 'desc'
|
751
|
+
history_records = history_records.sort {|x,y| y[sort_key] <=> x[sort_key] }
|
752
|
+
else
|
753
|
+
history_records = history_records.sort {|x,y| x[sort_key] <=> y[sort_key] }
|
754
|
+
end
|
755
|
+
if phrase
|
756
|
+
history_records = history_records.select {|it| it[:command].include?(phrase) || it[:number].to_s == phrase }
|
711
757
|
end
|
712
|
-
# get count and then slice it
|
713
758
|
command_count = history_records.size
|
714
|
-
history_records = history_records[
|
759
|
+
history_records = history_records[offset..max-1]
|
715
760
|
else
|
716
761
|
# default should try to be as fast as possible..
|
717
762
|
# no searching or sorting, default order by :number works
|
718
763
|
# desc here means show oldest commands
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
cmd_numbers = @history.keys.first(options[:max])
|
724
|
-
end
|
725
|
-
cmd_count = @history.keys.size
|
764
|
+
cmd_count = @history.keys.size
|
765
|
+
cmd_numbers = []
|
766
|
+
if direction == 'desc'
|
767
|
+
cmd_numbers = @history.keys[offset..(offset + max-1)]
|
726
768
|
else
|
727
|
-
|
728
|
-
|
729
|
-
cmd_numbers = @history.keys.last(options[:max] + options[:offset]).first(options[:max])
|
769
|
+
if offset != 0
|
770
|
+
cmd_numbers = @history.keys.last(max + offset).first(max)
|
730
771
|
else
|
731
|
-
cmd_numbers = @history.keys.last(
|
772
|
+
cmd_numbers = @history.keys.last(max)
|
732
773
|
end
|
733
774
|
history_records = cmd_numbers.collect { |k| {number: k, command: @history[k]} }
|
734
775
|
command_count = @history.size
|
@@ -741,12 +782,22 @@ class Morpheus::Cli::Shell
|
|
741
782
|
history_result = load_history_commands(options)
|
742
783
|
history_records = history_result[:commands]
|
743
784
|
command_count = history_result[:command_count]
|
744
|
-
|
745
|
-
|
746
|
-
|
785
|
+
if history_records.size == 0
|
786
|
+
if options[:phrase]
|
787
|
+
print cyan,"0 commands found matching '#{options[:phrase]}'.",reset,"\n"
|
788
|
+
else
|
789
|
+
print cyan,"0 commands found.",reset,"\n"
|
790
|
+
end
|
791
|
+
else
|
792
|
+
print cyan
|
793
|
+
history_records.each do |history_record|
|
794
|
+
puts "#{history_record[:number].to_s.rjust(3, ' ')} #{history_record[:command]}"
|
795
|
+
end
|
796
|
+
if options[:show_pagination]
|
797
|
+
print_results_pagination({size:history_records.size,total:command_count.to_i})
|
798
|
+
print reset, "\n"
|
799
|
+
end
|
747
800
|
end
|
748
|
-
#print_results_pagination({size:history_records.size,total:command_count.to_i}, {:label => "command", :n_label => "commands"})
|
749
|
-
print reset
|
750
801
|
#print "\n"
|
751
802
|
return 0
|
752
803
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rest_client'
|
2
2
|
require 'optparse'
|
3
3
|
require 'filesize'
|
4
|
-
require 'table_print'
|
5
4
|
require 'morpheus/cli/cli_command'
|
6
5
|
require 'morpheus/cli/mixins/infrastructure_helper'
|
7
6
|
|
@@ -1277,12 +1276,10 @@ class Morpheus::Cli::StorageProvidersCommand
|
|
1277
1276
|
return nil
|
1278
1277
|
elsif storage_providers.size > 1
|
1279
1278
|
print_red_alert "#{storage_providers.size} storage buckets found by name #{name}"
|
1280
|
-
rows = storage_providers.collect do |
|
1279
|
+
rows = storage_providers.collect do |it|
|
1281
1280
|
{id: it['id'], name: it['name']}
|
1282
1281
|
end
|
1283
|
-
|
1284
|
-
tp rows, [:id, :name]
|
1285
|
-
print reset,"\n"
|
1282
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
1286
1283
|
return nil
|
1287
1284
|
else
|
1288
1285
|
return storage_providers[0]
|
data/lib/morpheus/cli/tasks.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
require 'io/console'
|
3
3
|
require 'rest_client'
|
4
4
|
require 'optparse'
|
5
|
-
require 'table_print'
|
6
5
|
require 'morpheus/cli/cli_command'
|
7
6
|
|
8
7
|
class Morpheus::Cli::Tasks
|
@@ -244,10 +243,10 @@ class Morpheus::Cli::Tasks
|
|
244
243
|
print yellow,"No task types currently exist on this appliance. This could be a seed issue.",reset,"\n"
|
245
244
|
else
|
246
245
|
print cyan
|
247
|
-
|
246
|
+
rows = task_types.collect do |task_type|
|
248
247
|
{name: task_type['name'], id: task_type['id'], code: task_type['code'], description: task_type['description']}
|
249
248
|
end
|
250
|
-
|
249
|
+
puts as_pretty_table(rows, [:id, :name, :code], {color:red})
|
251
250
|
end
|
252
251
|
|
253
252
|
print reset,"\n"
|
data/lib/morpheus/cli/users.rb
CHANGED
@@ -223,7 +223,7 @@ class Morpheus::Cli::Users
|
|
223
223
|
rows = user_feature_permissions.collect do |code, access|
|
224
224
|
{code: code, access: get_access_string(access) }
|
225
225
|
end
|
226
|
-
|
226
|
+
print as_pretty_table(rows, [:name, :access], options)
|
227
227
|
else
|
228
228
|
puts yellow,"No permissions found.",reset
|
229
229
|
end
|
data/lib/morpheus/cli/version.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
require 'io/console'
|
3
3
|
require 'rest_client'
|
4
4
|
require 'optparse'
|
5
|
-
require 'table_print'
|
6
5
|
require 'morpheus/cli/cli_command'
|
7
6
|
|
8
7
|
# JD: I don't think a lot of this has ever worked, fix it up.
|
@@ -310,16 +309,14 @@ class Morpheus::Cli::VirtualImages
|
|
310
309
|
if image_types.nil? || image_types.empty?
|
311
310
|
print yellow,"No image types currently exist on this appliance. This could be a seed issue.",reset,"\n"
|
312
311
|
else
|
313
|
-
|
314
|
-
lb_table_data = image_types.collect do |lb_type|
|
312
|
+
rows = image_types.collect do |lb_type|
|
315
313
|
{name: lb_type['name'], code: lb_type['code']}
|
316
314
|
end
|
317
|
-
|
315
|
+
puts as_pretty_table(rows, [:name, :code], options)
|
318
316
|
end
|
319
|
-
|
320
|
-
print reset,"\n"
|
317
|
+
return 0
|
321
318
|
end
|
322
|
-
|
319
|
+
rescue RestClient::Exception => e
|
323
320
|
print_rest_exception(e, options)
|
324
321
|
exit 1
|
325
322
|
end
|
data/lib/morpheus/cli/whoami.rb
CHANGED
@@ -191,7 +191,7 @@ class Morpheus::Cli::Whoami
|
|
191
191
|
rows = @user_permissions.collect do |code, access|
|
192
192
|
{code: code, access: get_access_string(access) }
|
193
193
|
end
|
194
|
-
|
194
|
+
print as_pretty_table(rows, [:code, :access], options)
|
195
195
|
else
|
196
196
|
puts yellow,"No permissions found.",reset
|
197
197
|
end
|
data/lib/morpheus/formatters.rb
CHANGED
@@ -309,3 +309,20 @@ end
|
|
309
309
|
def no_colors(str)
|
310
310
|
str.to_s.gsub /\e\[\d+m/, ""
|
311
311
|
end
|
312
|
+
|
313
|
+
def format_number(n, opts={})
|
314
|
+
delim = opts[:delimiter] || ','
|
315
|
+
out = ""
|
316
|
+
parts = n.to_s.split(".")
|
317
|
+
whole_number = parts[0]
|
318
|
+
decimal = parts[1] ? parts[1..-1].join('.') : nil
|
319
|
+
i = 0
|
320
|
+
whole_number.reverse.each_char do |c|
|
321
|
+
out = (i > 0 && i % 3 == 0) ? "#{c}#{delim}#{out}" : "#{c}#{out}"
|
322
|
+
i+= 1
|
323
|
+
end
|
324
|
+
if decimal
|
325
|
+
out << "." + decimal
|
326
|
+
end
|
327
|
+
return out
|
328
|
+
end
|
data/lib/morpheus/logging.rb
CHANGED
@@ -8,6 +8,9 @@ module Morpheus::Logging
|
|
8
8
|
|
9
9
|
DEFAULT_LOG_LEVEL = ENV['DEBUG'] ? Logger::DEBUG : Logger::INFO
|
10
10
|
|
11
|
+
AUTHORIZATION_HEADER = 'Authorization'
|
12
|
+
SECRET_TOKEN_HEADERS = ['X-Morpheus-Token', 'X-Cypher-Token', 'X-Vault-Token', 'X-Morpheus-Lease']
|
13
|
+
|
11
14
|
@@log_level = DEFAULT_LOG_LEVEL
|
12
15
|
@@logger = nil
|
13
16
|
|
@@ -80,13 +83,20 @@ module Morpheus::Logging
|
|
80
83
|
def self.scrub_message(msg)
|
81
84
|
if msg.is_a?(String)
|
82
85
|
msg = msg.clone
|
83
|
-
|
84
|
-
msg.gsub!(/Authorization
|
85
|
-
msg.gsub!(/
|
86
|
-
msg.gsub!(
|
87
|
-
msg.gsub!(
|
88
|
-
|
89
|
-
|
86
|
+
# looks for RestClient format (hash.inspect) and request/curl output name: value
|
87
|
+
msg.gsub!(/Authorization\"\s?\=\>\s?\"Bearer [^"]+/i, 'Authorization"=>"Bearer ************')
|
88
|
+
msg.gsub!(/Authorization\:\s?Bearer [^"'']+/i, 'Authorization: Bearer ************')
|
89
|
+
# msg.gsub!(/#{AUTHORIZATION_HEADER}\"\s?\=\>\s?\"Bearer [^"]+/, "#{AUTHORIZATION_HEADER}"=>"Bearer ************")
|
90
|
+
# msg.gsub!(/#{AUTHORIZATION_HEADER}\:\s?Bearer [^"'']+/, "#{AUTHORIZATION_HEADER}: Bearer ************")
|
91
|
+
SECRET_TOKEN_HEADERS.each do |header|
|
92
|
+
msg.gsub!(/#{header}\"\s?\=\>\s?\"[^"]+/, "#{header}\"=>\"************")
|
93
|
+
msg.gsub!(/#{header}\:\s?[^"'']+/, "#{header}: ************")
|
94
|
+
end
|
95
|
+
msg.gsub!(/password\"\s?\=\>\s?\"[^"]+/i, 'password"=>"************')
|
96
|
+
msg.gsub!(/password\=\"[^"]+/i, 'password="************')
|
97
|
+
msg.gsub!(/password\=[^"'&\Z]+/i, 'password=************') # buggy, wont work with ampersand or quotes in passwords! heh
|
98
|
+
msg.gsub!(/passwordConfirmation\=[^" ]+/i, 'passwordConfirmation="************')
|
99
|
+
msg.gsub!(/passwordConfirmation\=[^" ]+/i, 'passwordConfirmation=************')
|
90
100
|
end
|
91
101
|
msg
|
92
102
|
end
|