Class: HammerCLIKatello::Repository::UploadContentCommand

Inherits:
InfoCommand
  • Object
show all
Includes:
HammerCLIKatello::RepositoryScopedToProduct
Defined in:
lib/hammer_cli_katello/repository.rb

Defined Under Namespace

Classes: BinaryPath

Constant Summary collapse

CONTENT_CHUNK_SIZE =

bytes

4_000_000

Instance Method Summary collapse

Methods included from HammerCLIKatello::RepositoryScopedToProduct

included

Methods included from HammerCLIKatello::ResolverCommons

included

Instance Method Details

#content_upload_resourceObject



216
217
218
# File 'lib/hammer_cli_katello/repository.rb', line 216

def content_upload_resource
  ::HammerCLIForeman.foreman_resource(:content_uploads)
end

#executeObject



207
208
209
210
211
212
213
214
# File 'lib/hammer_cli_katello/repository.rb', line 207

def execute
  @failure = false
  option_content.each do |file_path|
    File.open(file_path, 'rb') { |file| upload_file file }
  end

  @failure ? HammerCLI::EX_DATAERR : HammerCLI::EX_OK
end

#request_headersObject



203
204
205
# File 'lib/hammer_cli_katello/repository.rb', line 203

def request_headers
  {:content_type => 'multipart/form-data'}
end