self.set_command

in files/gitlab-ctl-commands/lib/praefect.rb [203:230]


  def self.set_command(options, config_file_path)
    
    command = [EXEC_PATH, "-config", config_file_path, options[:command]]

    
    if ['remove-repository', 'track-repository', 'list-storages'].include?(options[:command]) &&
        options.key?(:virtual_storage_name)
      command += ["-virtual-storage", options[:virtual_storage_name]]
    end

    
    command += ["-repository", options[:repository_relative_path]] if ['remove-repository', 'track-repository'].include?(options[:command])

    
    command += ["-authoritative-storage", options[:authoritative_storage]] if options[:command] == 'track-repository' && options.key?(:authoritative_storage)

    command += ["-input-path", options[:input_path]] if options[:command] == 'track-repositories' && options.key?(:input_path)

    command += ["-db-only"] if options[:command] == 'remove-repository' && options.key?(:db_only)

    command += ["-apply"] if options[:command] == 'remove-repository' && options.key?(:apply)

    
    command += ["-replicate-immediately"] if ['track-repository', 'track-repositories'].include?(options[:command]) && options.key?(:replicate_immediately)

    command
  end