Class: HammerCLIKatello::Repository::UploadContentCommand
- Inherits:
-
InfoCommand
- Object
- HammerCLIForeman::InfoCommand
- InfoCommand
- HammerCLIKatello::Repository::UploadContentCommand
- Extended by:
- HammerCLIKatello::RepositoryScopedToProduct
- Includes:
- HammerCLIForemanTasks::Helper
- Defined in:
- lib/hammer_cli_katello/repository.rb
Overview
rubocop:disable ClassLength
Defined Under Namespace
Classes: BinaryPath
Constant Summary collapse
- CONTENT_CHUNK_SIZE =
bytes to make sure it’s lower than django’s default 2621440
2_500_000
Instance Method Summary collapse
Methods included from HammerCLIKatello::RepositoryScopedToProduct
validate_repo_name_requires_product_options
Methods included from HammerCLIKatello::ResolverCommons
Instance Method Details
#content_upload_resource ⇒ Object
445 446 447 |
# File 'lib/hammer_cli_katello/repository.rb', line 445 def content_upload_resource ::HammerCLIForeman.foreman_resource(:content_uploads) end |
#execute ⇒ Object
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/hammer_cli_katello/repository.rb', line 428 def execute @failure = false files = option_content.sort if files.length.zero? output.print_error _("Could not find any files matching PATH") return HammerCLI::EX_NOINPUT end files.each do |file_path| last_file = file_path == files.last File.open(file_path, 'rb') { |file| upload_file(file, last_file: last_file) } end @failure ? HammerCLI::EX_DATAERR : HammerCLI::EX_OK end |
#request_headers ⇒ Object
424 425 426 |
# File 'lib/hammer_cli_katello/repository.rb', line 424 def request_headers {:content_type => 'multipart/form-data'} end |