Top Level Namespace

Defined Under Namespace

Modules: Debug, Storazzo

Instance Method Summary collapse

Instance Method Details

#backquote_execute(cmd, opts = {}) ⇒ Object



435
436
437
438
439
440
441
# File 'lib/storazzo/ric_disk.rb', line 435

def backquote_execute(cmd, opts = {})
  dryrun = opts.fetch :dryrun, false
  # executed a command wrapped by dryrun though
  return "DRYRUN backquote_execute(#{cmd})" if dryrun # $opts[:dryrun]

  `#{cmd}`
end

#upload_to_gcs(file, _opts = {}) ⇒ Object



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
# File 'lib/storazzo/ric_disk.rb', line 443

def upload_to_gcs(file, _opts = {})
  deb("upload_to_gcs(#{file}). TODO(ricc) after breafast upload to GCS : #{file}")
  mount_name = file.split('/')[-2]
  filename = "#{mount_name}-#{File.basename file}"
  hostname = Socket.gethostname[/^[^.]+/]
  command = "gsutil cp '#{file}' gs://#{$gcs_bucket}/backup/ricdisk-magic/#{hostname}-#{filename}"
  deb("Command: #{command}")
  puts azure("GCS upload disabled until I know if it works :) command='#{command}'")
  backquote_execute(command, dryrun: true)
  # if $opts[:debug] do
  #   puts "+ Current list of files:"
  #   ret = backquote_execute("gsutil ls -al gs://#{$gcs_bucket}/backup/ricdisk-magic/")
  #   puts ret
  # end
end